query-5a3b83ec830c78d72a2d67fa605ed645

rq turtle/ttl

SPARQL - Städte in den USA, deren Einwohnerzahl per Referenz belegt ist https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Qualifiers,_References_and_RanksSiehe: The prefix pr: within the reference node retrieves the reference information. The prov:wasDerivedFrom within the statement node points to a new reference node. The prefix ps: within the statement node retrieves the object. The prefix p: points not to the object, but to a statement node. This node then is the subject of other triples.

Use at

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 prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?town ?townLabel ?anzahl  ?ref ?refLabel ?county ?countyLabel
  WHERE
  {
     ?town wdt:P31 wd:Q1093829   .   # ?town ist eine City in den Vereinigten Staaten
     ?town wdt:P131 ?county      .   # ?town liegt in der Verwaltungseinheit ?county
     ?town p:P1082 ?statement    .   # ?town hat ?statement
     ?statement ps:P1082 ?anzahl .   # ?statement hat Einwohner ?anzahl
     ?statement prov:wasDerivedFrom ?refnode.   # points to a new reference node.
     ?refnode   pr:P248 ?ref     .   #  ?refnode hat die Referenz ?ref
     SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?anzahl"):::projected v2("?county"):::projected v6("?ref"):::projected v5("?refnode") v3("?statement") v1("?town"):::projected c2(["wd:Q1093829"]):::iri c9(["bd:serviceParam"]):::iri c11(["en"]):::literal v1 --"p:direct/P31"--> c2 v1 --"p:direct/P131"--> v2 v1 --"p:P1082"--> v3 v3 --"p:statement/P1082"--> v4 v3 --"prov:wasDerivedFrom"--> v5 v5 --"p:reference/P248"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end