Tolog query questions

9 views
Skip to first unread message

Pierre Thibault

unread,
Mar 18, 2015, 4:17:50 PM3/18/15
to ont...@googlegroups.com
Hello,

I am a newbie to Tolog.

I'm having some difficulties with Tolog. I am trying a query from Ontopia Tolog documentation:

select $A, count($B) from
  composed-by($A : composer, $B : opera)?

I am using Ontopia 5.3.0, the website itself, with the example file ItalianOpera.ltm and the query above returns no row at all.

But if I change the query by changing 'opera' to 'work':

select $A, count($B) from
  composed-by($A : composer, $B : work)?

then it returns:

AB
Alfano, Franco12
Puccini, Giacomo12
Ponchielli, Amilcare12
Montemezzi, Italo8
Smareglia, Antonio10
Franchetti, Alberto10
Giordano, Umberto13
Leoni, Franco10
Leoncavallo, Ruggero10
Cilèa, Francesco7
Faccio, Franco4
Boïto, Arrigo2
Mascagni, Pietro16
Catalani, Alfredo5
Zandonai, Riccardo13
Verdi, Giuseppe28

The definition of composed-by is:

[composed-by = "Composed by"
             = "Composed" / composer
    @"http://psi.ontopedia.net/composed_by"]

and each time it used with "work":

composed-by( alfano : composer, cyrano-de-bergerac : work )

and "cyrano-de-bergerac" is an opera:

[cyrano-de-bergerac : opera = "Cyrano di Bergerac"
    @"http://psi.ontopedia.net/Cyrano_di_Bergerac"]

So why is the initial query for the tutorial returns no result?

The fix to me is:

select $A, count($B) from
  composed-by($A : composer, $B : work),
  instance-of($B, opera)?

It gives the same result. I guess all works are opera. Right?

But a problem here is that I don't know the type of the second end of "composed-by". And why would I need to know?

It does not make sense for me. Could someone explain?

Dan Speck

unread,
Mar 18, 2015, 4:40:22 PM3/18/15
to Ontopia list
Pierre,

The composed-by association type has two roles: composer and work so you need to use those to find pairs of composers and works. If you want to only get the works that are operas you can narrow these results as follows:

select $A, count($B) from
  composed-by($A : composer, $B : work)
, instance-of($B, opera)
?

-dan

--
You received this message because you are subscribed to the Google Groups "ontopia" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ontopia+u...@googlegroups.com.
To post to this group, send email to ont...@googlegroups.com.
Visit this group at http://groups.google.com/group/ontopia.
For more options, visit https://groups.google.com/d/optout.

Pierre Thibault

unread,
Mar 18, 2015, 4:50:43 PM3/18/15
to ont...@googlegroups.com
OK,

But why is the composer role only present in the definition?


[composed-by = "Composed by"
             = "Composed" / composer
    @"http://psi.ontopedia.net/composed_by"]


Why is "work" not present on the defintion?

Dan Speck

unread,
Mar 18, 2015, 5:00:14 PM3/18/15
to Ontopia list
Pierre,

This LTM fragment:


[composed-by = "Composed by"
             = "Composed" / composer
    @"http://psi.ontopedia.net/composed_by"]


1. Defines a topic "Composed by" with item identifier "composed-by", subject identifier "http://psi.ontopedia.net/composed_by". The

= "Composed" / composer

assigns the name "Composed" with scope "composer" so that when viewing the association in, e.g., Omnigator, from the perspective of the "composer" you will see "Composed", otherwise you see "Composed by". This is really just a convention that Omnigator uses.

You really need to look at the topic map itself to see the role types in a given association type. If you export the ItalianOpera topic map in LTM format you will see:

...
/* -- AT: composed-by */
composed-by( alfano : composer, cyrano-de-bergerac : work )
composed-by( alfano : composer, don-juan-de-manara : work )
composed-by( alfano : composer, i-cavalieri-e-la-bella : work )
...

-dan

Reply all
Reply to author
Forward
0 new messages