What does “^a” mean in this SPARQL query?

走远了吗. 提交于 2019-12-25 16:17:23

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!