query-eeb6cc97f73a1c36a571e8ffcf642250

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#------------------------------------------------------------------------------------------------
# Kursächsische Postmeilensäulen (für interne Weiterverarbeitung zur tsv für "Historic.Place)
#------------------------------------------------------------------------------------------------
#defaultView:Map;Table
SELECT DISTINCT ?lon ?lat ?group ?item ?itemLabel ?itemDescription ?start_date ?coordinates ?heritage2 ?image  ?heritage (URI(CONCAT("Category:", ?wikimedia)) as ?wikimedia_commons) ?wikipedia {
  ?item p:P31/ps:P31 wd:Q896635 ;
  OPTIONAL {?item p:P625 ?coordinate.
  ?coordinate psv:P625 ?coordinate_node.
  ?coordinate_node wikibase:geoLatitude ?lat.
  ?coordinate_node wikibase:geoLongitude ?lon. }
  OPTIONAL { ?item wdt:P625 ?coordinates. }
  OPTIONAL { ?item wdt:P571 ?inception. }
  OPTIONAL { ?item wdt:P18 ?image. }
  OPTIONAL { ?item wdt:P373 ?wikimedia. }
  OPTIONAL { ?item wdt:P1708 ?heritage2. }
  OPTIONAL { ?item wdt:P1708 ?heritage. }
  OPTIONAL { ?sitelink schema:about ?item.
             FILTER(REGEX(STR(?sitelink), "de.wikipedia.org/wiki/"))}      # nur deutsche Wikipedia-Artikel
  BIND((bound(?sitelink) ) AS ?has_de_sitelink).                         # true/false - wenn de-Artikel vorhanden   

  BIND(URI(CONCAT("https://de.wikipedia.org/wiki/Kurs%C3%A4chsische_Postmeilens%C3%A4ule")) as ?url2).  # alternative URL bauen

  BIND(  IF( ?has_de_sitelink ,?sitelink ,?url2 ) AS ?wikipedia).           # if ... then ... else



  BIND(str(YEAR(?inception)) AS ?start_date)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }

}
ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?coordinate") v5("?coordinate_node") v8("?coordinates"):::projected v14("?has_de_sitelink") v13("?heritage"):::projected v12("?heritage2"):::projected v10("?image"):::projected v9("?inception") v3("?item"):::projected v1("?itemLabel"):::projected v6("?lat"):::projected v7("?lon"):::projected v2("?sitelink") v17("?start_date"):::projected v15("?url2") v11("?wikimedia"):::projected v18("?wikimedia_commons") v16("?wikipedia"):::projected a1((" ")) c18(["de"]):::literal c4(["wd:Q896635"]):::iri c16(["bd:serviceParam"]):::iri v3 --"p:P31"--> a1 a1 --"p:statement/P31"--> c4 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:P625".-> v4 v4 --"p:statement/value/P625"--> v5 v5 --"wikibase:geoLatitude"--> v6 v5 --"wikibase:geoLongitude"--> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P625".-> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P571".-> v9 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P18".-> v10 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P373".-> v11 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P1708".-> v12 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:direct/P1708".-> v13 end subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v2 -."schema:about".-> v3 end bind0[/"bound(?sitelink)"/] v2 --o bind0 bind0 --as--o v14 bind1[/"concat('https://de.wikipedia.org/wiki/Kurs%C3%A4chsische_Postmeilens%C3%A4ule')"/] bind1 --as--o v15 bind2[/"if(?has_de_sitelink,?sitelink,?url2)"/] v14 --o bind2 v2 --o bind2 v15 --o bind2 bind2 --as--o v16 bind3[/"str(year-from-dateTime(?inception))"/] v9 --o bind3 bind3 --as--o v17 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c16 --"wikibase:language"--> c18 end bind4[/"concat('Category:',?wikimedia)"/] v11 --o bind4 bind4 --as--o v18