9

In one of the samples for querying Wikidata, I found the following query, which includes p:P6/v:P6 in the line after SELECT. What does it mean?

PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX v: <http://www.wikidata.org/prop/statement/>

SELECT ?p ?w ?l ?wl WHERE {
   wd:Q30 p:P6/v:P6 ?p .       #-- This line
   ?p wdt:P26 ?w .
   OPTIONAL  {  
     ?p rdfs:label ?l filter (lang(?l) = "en") . 
   }
   OPTIONAL {
     ?w rdfs:label ?wl filter (lang(?wl) = "en"). 
   }
 }
4

1 回答 1

18

它是SPARQL 1.1 属性路径的SequencePath风格。

wd:Q30 p:P6/v:P6 ?p .

意味着有一个三元组(wd:Q30, p:P6, ?x)和另一个三元组(?x, v:P6, ?p),没有明确需要写(或命名)中间节点?x。换句话说,它说:“?p可以通过从 开始wd:Q30,跟随属性p:P6,然后是属性来找到v:P6

于 2015-08-08T20:07:14.630 回答