query-26fef6242ac75d50fa7793d606f33016

rq turtle/ttl

Propertiesinstance of (P31)subclass of (P279)located in protected area (P3018)located in the administrative territorial entity (P131)length (P2043)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psn: <http://www.wikidata.org/prop/statement/value-normalized/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?trail ?trailLabel ?length ?located_in_protected_area ?located_in_protected_areaLabel ?administrative_areaLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?trail wdt:P31/wdt:P279* wd:Q628179.
  ?trail wdt:P3018 ?located_in_protected_area.
  ?located_in_protected_area wdt:P31/wdt:P279* wd:Q17000624.
  ?located_in_protected_area wdt:P131 ?administrative_area.
  ?administrative_area wdt:P31/wdt:P279* wd:Q178712.
  OPTIONAL { ?trail p:P2043/psn:P2043/wikibase:quantityAmount ?length }.
}
ORDER BY DESC(?length) ASC(?located_in_protected_areaLabel) ASC(?trailLabel)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?administrative_area") v1("?length"):::projected v5("?located_in_protected_area"):::projected v2("?located_in_protected_areaLabel"):::projected v4("?trail"):::projected v3("?trailLabel"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) c11(["wd:Q178712"]):::iri c9(["wd:Q17000624"]):::iri c7(["wd:Q628179"]):::iri c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v4 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c7 v4 --"p:direct/P3018"--> v5 v5 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c9 v5 --"p:direct/P131"--> v6 v6 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> c11 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:P2043".-> a4 a4 --"p:statement/value-normalized/P2043"--> a5 a5 --"wikibase:quantityAmount"--> v1 end