问题
I have found this query, but i'm not able what does it do. I don't know what the "^a" means, particularly.
select distinct ?type where {
dbpedia:Stephen_King a ?type .
filter not exists {
?subtype ^a dbpedia:Stephen_King ;
rdfs:subClassOf ?type .
filter ( ?subtype != ?type )
}
}
回答1:
It's a SPARQL 1.1 property path which describes a route through a graph between two graph nodes, in your case it denotes the inverse path, i.e. from object to subject, thus, it's equivalent to
dbpedia:Stephen_King a ?subtype .
with a
being just a shortcut for rdf:type
It's just used here to be able to use the more compact Turtle syntax, i.e. instead of writing
dbpedia:Stephen_King a ?subtype .
?subtype rdfs:subClassOf ?type .
you can write
?subtype ^a dbpedia:Stephen_King
?subtype rdfs:subClassOf ?type .
and therefore since subjects are the same
?subtype ^a dbpedia:Stephen_King ;
rdfs:subClassOf ?type .
来源:https://stackoverflow.com/questions/43827050/what-does-a-mean-in-this-sparql-query