jena - Count a specific relationship in OWL File using sparql query -
i want count assertions of specific relationship in owl file. if following whole ontology:-
<owl:namedindividual rdf:about="file:/c:/myont.owl#comfort"> <synonymof rdf:resource="file:/c:/myont.owl#impunity"/> <synonymof rdf:resource="file:/c:/myont.owl#sooth"/> <synonymof rdf:resource="file:/c:/myont.owl#ease"/> </owl:namedindividual> <owl:namedindividual rdf:about="file:/c:/myont.owl#population"> <synonymof rdf:resource="file:/c:/myont.owl#habitation"/> </owl:namedindividual>
then sparql query should give me like:-
synonymof = 4 (i.e 4 assertions <synonymof> relation
i intend run query on jena fuzeki.
a straightforward way be:
prefix : <http://example.com#> select (count(?o) ?count) { ?s :synonymof ?o }
however, binding assigned specific objects, might want consider using group by
:
prefix : <http://example.com#> select ?s (count(?o) ?count) { ?s :synonymof ?o } group ?s
Comments
Post a Comment