query-6c82677095ecb251d53875b693638419
TODO
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 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#>
#--------------------------------------------------------------------------------------------
# Preußischer optischer Telegraf (für interne Weiterverarbeitung zur tsv für "Historic.Place)
#--------------------------------------------------------------------------------------------
#defaultView:Map;Table
SELECT DISTINCT ?lon ?lat ?item ?itemLabel ?itemDescription ?start_date ?image ?coordinates ?URL1 ?URL2 (URI(CONCAT("Category:", ?wikimedia)) as ?wikimedia_commons) ?wikipedia {
?item p:P361/ps:P361 wd:Q870831 ;
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:P973 ?URL1.
FILTER(REGEX(STR(?URL1), "www.optische-telegraphie.de")) . }
OPTIONAL { ?item wdt:P973 ?URL2.
FILTER(REGEX(STR(?URL2), "www.optischertelegraph4.de")) . }
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/Preu%C3%9Fischer_optischer_Telegraf")) 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("?URL1"):::projected
v3("?URL2"):::projected
v6("?coordinate")
v7("?coordinate_node")
v10("?coordinates"):::projected
v14("?has_de_sitelink")
v12("?image"):::projected
v11("?inception")
v5("?item"):::projected
v1("?itemLabel"):::projected
v8("?lat"):::projected
v9("?lon"):::projected
v2("?sitelink")
v17("?start_date"):::projected
v15("?url2")
v13("?wikimedia"):::projected
v18("?wikimedia_commons")
v16("?wikipedia"):::projected
a1((" "))
c20(["de"]):::literal
c6(["wd:Q870831"]):::iri
c18(["bd:serviceParam"]):::iri
v5 --"p:P361"--> a1
a1 --"p:statement/P361"--> c6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:P625".-> v6
v6 --"p:statement/value/P625"--> v7
v7 --"wikibase:geoLatitude"--> v8
v7 --"wikibase:geoLongitude"--> v9
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P625".-> v10
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P571".-> v11
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P18".-> v12
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P373".-> v13
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P973".-> v4
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:direct/P973".-> v3
end
subgraph optional7["(optional)"]
style optional7 fill:#bbf,stroke-dasharray: 5 5;
v2 -."schema:about".-> v5
end
bind0[/"bound(?sitelink)"/]
v2 --o bind0
bind0 --as--o v14
bind1[/"concat('https://de.wikipedia.org/wiki/Preu%C3%9Fischer_optischer_Telegraf')"/]
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))"/]
v11 --o bind3
bind3 --as--o v17
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c18 --"wikibase:language"--> c20
end
bind4[/"concat('Category:',?wikimedia)"/]
v13 --o bind4
bind4 --as--o v18