Simple queries in openWordnet-PT

Our OpenWordnet-PT is freely available for download and online use since its beginning. Nevertheless, some people still have difficulties to use the data without a proper introduction to our ‘data model’. Although we have already presented it in many conferences and articles, I believe some examples of queries can help people understand better our data.

All relations are between synsets from PWN (Princeton). Since we haven’t created any new synset yet, all our synsets are linked to Princeton Synsets via owl:sameAs relation. Thus, our network is a projection of the PWN network, we have a injective map between our synsets and PWN synsets. Obviously, we have new senses and new words and these resources are linked to our synsets.

In other words, to know the hypernyms of the word “cachorro” one must ‘use’ the PWN synsets and relations:

select ?sspt ?otherpt ?otherword 
{
  ?word wn30:lexicalForm "cachorro"@pt .
  ?sspt wn30:containsWordSense/wn30:word ?word .
  ?ssen owl:sameAs ?sspt .   
  ?ssen wn30:hyponymOf+ ?other .
  ?other owl:sameAs ?otherpt .
  ?otherpt wn30:containsWordSense/wn30:word/wn30:lexicalForm ?otherword .
}

Note that hyponymOf+ is a SPARQL 1.1 construction (property paths). It means the transitive closure of the hyponymOf relation. The idea is to first get the synset in OWN-PT which contains “cachorro”, then find the equivalent synset in PWN. With the right synsets in PWN, we look for the related ones in OWN-PT and return them. Finally, we get the words from the OWN-PT synsets that we found.

Note also that not all relations are between synsets, some relations such as derivationallyRelated are relation between senses:

select ?s ?p
{
   ?s wn30:derivationallyRelated ?p.
}

We associate synsets via skos:inScheme to two special resources representing the PWN and OWN-PT wordnets to facilitate queries.

select distinct ?schema
{
   ?wsa wn30:derivationallyRelated ?wsb .
   ?ss skos:inScheme ?schema ;
       wn30:containsWordSense ?wsa .
}

Our data model is described in the wn30.ttl file. This is our ‘vocabulary’ in Semantic Web terms. The queries above can be tested in our SPARQL endpoint.