SPARQL Query - class and subclass give class name and namespace
2 answers
How about this :
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?subClass ?predicate
WHERE {
?subClass rdfs:subClassOf <http://dbpedia.org/ontology/Work> .
?predicate rdfs:domain ?subClass
}
Try a SPARQL tool like DBPedia SNORQL interface .
+3
source to share
Are you trying to execute a recursive SPARQL query? In other words, select a given person and all his properties. If the property object is another person, select its properties, etc.
I don't believe SPARQL supports this.
A naive approach would be to do something like this (and, assuming you mean people, not classes, this actually suits your requirements, but does not handle the next "level" of triplets).
CONSTRUCT {
?s ?p ?o .
?o ?p2 ?o2 .
} WHERE {
?s ?p ?o .
?o ?p2 ?o2 .
}
Note that if ?o2
is the subject of any operators, this query will not return them.
+3
source to share