query-1a8774eb74054f1d74c944c5b8ad66f7
16:10, 6 February 2017 (UTC)) talk (Pasleimno consensus to delete -- Subsequent comments should be made in a new section. A summary of the conclusions reached follows.Please do not modify it.The following discussion is closed. )discussion | logs | entity usage | links | history | delete(: (P150)contains the administrative territorial entity - creating two way links is always error prone - there are 71,857 of P150, and 3,520,325 of P131, which means most of the time we only link one way, from child to parent. We can easily query the whole tree top to bottom using this query: (P131)located in the administrative territorial entity Duplicates
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX gas: <http://www.bigdata.com/rdf/gas#>
SELECT ?item ?itemLabel ?itemAltLabel ?itemDescription ?linkTo ?depth WHERE
{
SERVICE gas:service {
gas:program gas:gasClass "com.bigdata.rdf.graph.analytics.SSSP" ;
gas:in wd:Q145 ;
gas:traversalDirection "Reverse" ;
gas:out ?item ;
gas:out1 ?depth ;
gas:out2 ?linkTo ;
gas:maxIterations 2 ;
gas:linkType wdt:P131 .
}
FILTER EXISTS { ?item wdt:P31/wdt:P279* wd:Q56061 }
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY ?depth
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?depth"):::projected
v2("?item"):::projected
v3("?linkTo"):::projected
a1((" "))
c5(["gas:program"]):::iri
c7(["com.bigdata.rdf.graph.analytics.SSSP"]):::literal
c11(["Reverse"]):::literal
c22(["en"]):::literal
c3(["wd:Q56061"]):::iri
c18(["wdt:P131"]):::iri
c16(["2^^xsd:integer"]):::literal
c20(["bd:serviceParam"]):::iri
c9(["wd:Q145"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P31"--> e0a1
e0a1 --"wdt:P279"--> e0c3
e0v1("?item"):::projected
e0a1((" ")):::projected
e0c3(["wd:Q56061"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> a1
f0 --> c2
f0 --> c3
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c3
subgraph s1["http://www.bigdata.com/rdf/gas#service"]
style s1 stroke-width:4px;
c5 --"gas:gasClass"--> c7
c5 --"gas:in"--> c9
c5 --"gas:traversalDirection"--> c11
c5 --"gas:out"--> v2
c5 --"gas:out1"--> v1
c5 --"gas:out2"--> v3
c5 --"gas:maxIterations"--> c16
c5 --"gas:linkType"--> c18
end
subgraph s2["http://wikiba.se/ontology#label"]
style s2 stroke-width:4px;
c20 --"wikibase:language"--> c22
end