query-4e20f85fc2a09042edf60465e2c4c2e2

rq turtle/ttl

Propertiesinstance of (P31)connecting line (P81)series ordinal (P1545)towards (P5051)

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?towardsLabel ?order
WHERE {
  ?item wdt:P31 wd:Q3201814 .    # instance of fast tram stop
  ?item wdt:P81 wd:Q2735863 .    # connecting line RandstadRail 4
  ?item p:P81 ?station_query .   # build query to look at qualifiers (note use of lower case p: )
  ?station_query ps:P81 wd:Q2735863 . # connecting line - item must be same as the item for p:P81 above
  ?station_query pq:P1545 ?order .    # qualifier: series ordinal value, later used in ORDER BY
  ?station_query pq:P5051 ?towards .  # qualifier: towards, to later limit to one direction
  FILTER ( ?towards != wd:Q2740322 )  # to only show one direction  

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY xsd:integer(?order)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?item"):::projected v1("?order"):::projected v4("?station_query") v2("?towards") c5(["wd:Q2735863"]):::iri c3(["wd:Q3201814"]):::iri c11(["bd:serviceParam"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?towards != 'wd:Q2740322'"]] f0 --> v2 v3 --"p:direct/P31"--> c3 v3 --"p:direct/P81"--> c5 v3 --"p:P81"--> v4 v4 --"p:statement/P81"--> c5 v4 --"p:qualifier/P1545"--> v1 v4 --"p:qualifier/P5051"--> v2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end