All, I have a query in the system I'm migrating that I have stared my eyes dry on now. It intended to return a skos:Concept and the skos:prefLabels of its nearest related skos:Concepts. I feel this is among my cleverest moments, because it only relies on the relations being declared as a rdfs:subPropertyOf skos:semanticRelation, so it is trivially extensible. This is an example query:
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix skos: <http://www.w3.org/2004/02/skos/core#> prefix owl: <http://www.w3.org/2002/07/owl#> CONSTRUCT { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> a skos:Concept ; skos:prefLabel ?preflabel ; skos:altLabel ?altlabel ; skos:definition ?definition ; ?semrelation ?object . ?semrelation rdfs:subPropertyOf skos:semanticRelation ; rdfs:label ?semrellabel ; a owl:ObjectProperty . ?object skos:prefLabel ?preflabel2 ; a skos:Concept . } WHERE { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> skos:prefLabel ?preflabel ; a skos:Concept . OPTIONAL { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> skos:altLabel ?altlabel . } OPTIONAL { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> skos:definition ?definition . } OPTIONAL { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> ?semrelation ?object . ?semrelation rdfs:subPropertyOf skos:semanticRelation ; rdfs:label ?semrellabel ; a owl:ObjectProperty . ?object a skos:Concept ; skos:prefLabel ?preflabel2 . } } With Jena, this query gives the expected result (skipping namespaces): <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> rdf:type skos:Concept ; skos:altLabel "Paramyxoviridaeinfeksjoner"@no , "Parainfluenzavirusinfektioner"@da , "Parainfluensavirusinfektioner"@sv ; skos:broader <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/Concept_52> ; skos:prefLabel "Paramyxoviridaeinfektioner "@da , "Paramyxoviridaeinfektioner "@sv , "Parainfluensavirusinfeksjoner "@no . skos:broader rdf:type owl:ObjectProperty ; rdfs:label "Bredere"@no ; rdfs:subPropertyOf skos:semanticRelation . <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/Concept_52> rdf:type skos:Concept ; skos:prefLabel "Virusinfeksjoner"@no , "Virussjukdomar"@sv , "Virusinfektioner"@da . But with Virtuoso, apparently the OPTIONAL section where the relations are given. Furthermore, the following query gives the expected result: CONSTRUCT { ?semrelation rdfs:subPropertyOf skos:semanticRelation ; rdfs:label ?semrellabel ; a owl:ObjectProperty . } WHERE { ?semrelation rdfs:subPropertyOf skos:semanticRelation ; rdfs:label ?semrellabel ; a owl:ObjectProperty . } for example: skos:broader rdf:type owl:ObjectProperty . skos:broader rdfs:label "Bredere"@no ; rdfs:subPropertyOf skos:semanticRelation . Also CONSTRUCT { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> skos:broader ?object . ?object a skos:Concept ; skos:prefLabel ?preflabel2 . } WHERE { <http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747> skos:broader ?object . ?object a skos:Concept ; skos:prefLabel ?preflabel2 . } gives ns1:Concept_52 rdf:type skos:Concept ; skos:prefLabel "Virusinfektioner"@da , "Virussjukdomar"@sv , "Virusinfeksjoner"@no . ns1:topic000747 skos:broader ns1:Concept_52 . which is indeed correct. We see that there is a skos:broader relationship here, which should be included as the predicate in the original query. Thus, I would think that the query I'm sending to Jena is correct and that Jena returns the correct result... Or am I wrong here? The original query results in this SQL, I guess that's useful: SELECT TOP 1 DB.DBA.SPARQL_CONSTRUCT ( vector ( vector ( 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747' ), 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2004/02/skos/core#prefLabel' ), 1, 6), vector ( 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747' ), 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2004/02/skos/core#altLabel' ), 1, 5), vector ( 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747' ), 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2004/02/skos/core#definition' ), 1, 4), vector ( 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://rabbit.computas.int:8180/sublima-webapp-1.0-SNAPSHOT/topic/topic000747' ), 1, 2, 1, 0), vector ( 1, 2, 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2000/01/rdf-schema#subPropertyOf' ), 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2004/02/skos/core#semanticRelation' )), vector ( 1, 2, 3, DB.DBA.RDF_MAKE_IID_OF_QNAME ( UNAME'http://www.w3.org/2000/01/rdf-schema#label' ), 1, 3), vector ( 1, 2, 3, DB.DBA.RDF 1 Rows. -- 2 msec. Kind regards Kjetil Kjernsmo -- Senior Knowledge Engineer Mobile: +47 986 48 234 Email: kjetil.kjern...@computas.com Web: http://www.computas.com/ | SHARE YOUR KNOWLEDGE | Computas AS PO Box 482, N-1327 Lysaker | Phone:+47 6783 1000 | Fax:+47 6783 1001