|
Is there a way to get from dbpedia's virtuoso's server all instances of a type <class> and of the subclasses of this <class>. I found some documentation about transitive queries in virtuoso but not sure how to use it. If there isn't a way to get all of that with a single sparql query, what will then be the preferred query sequence? |
|
since virtuoso (and hence:dbpedia) doesn't implement all SPARQL 1.1 features, you can't go straight forward using property paths (as scotthenninger mentioned). If you need more than one depth of subclasses (recursively) - virtuoso has its own workaround, try this:
(source : following links in property paths in dbpedia benchmark )
This query shows up 2863 - thats the number of all distinct (direct and indirect) subclasses (and not: instances of subclasses as vladtn described) of yago:Church103028079, |
|
If Virtuoso supports SPARQL 1.1, you can do:
I tried it and it doesn't unfortunately: http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+*%0D%0AWHERE%0D%0A%7B++%3Fcls+rdfs%3AsubClassOf*+%3Chttp%3A%2F%2Fdbpedia.org%2Fclass%2Fyago%2FChurch103028079%3E+.%0D%0A+++%3Finst+a+%3Fcls%0D%0A%7D&format=text%2Fhtml&timeout=0&debug=on it is not "rdfs:subClassOf*" but "rdfs:subClassOf" (that is: leave the wildcard) 1
ah - without the wildcard you get only one depth of subclasses and not all subclasses recursively. See http://www.w3.org/TR/sparql11-property-paths/ |
|
Let me answer the question, notice the Inference rules link at the top left corner of dbpedia's sparql endpoint. Adding a reference to the inference set you want to use (as I understand it a graph where inference has already been executed) will add inferred results to your query. For example the query:
returns 1790 results. While the same query using inference (below) returns 9065 results, taking into account instances of subclasses of cy:Church103028079.
|

