query-3dee6ef23725fc08ad781d0780ce390f

rq turtle/ttl

Possible duplicates with sv/cebwiki articles

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?layer WHERE {
   {
  SELECT DISTINCT ?item1 ?coord1 ?itemLabel {
    VALUES ?links { 1 2 3 } .
    VALUES ?wikis { <https://ceb.wikipedia.org/> <https://sv.wikipedia.org/> } .
    ?item1 wdt:P17 wd:Q213; wikibase:sitelinks ?links; wdt:P625 ?coord1;
           ^schema:about/schema:isPartOf ?wikis; rdfs:label ?label .
    MINUS { ?item1 ^schema:about/schema:isPartOf <https://cs.wikipedia.org/> } .
    BIND( STRLANG( STR( IF( CONTAINS( ?label, ' (' ), STRBEFORE( ?label, ' (' ), ?label ) ), 'cs' ) AS ?itemLabel ) .
  }
}.
  ?itemLabel ^rdfs:label ?item2 .
  FILTER( ?item2 != ?item1 ) .
  FILTER EXISTS {
    ?item2 wdt:P17 wd:Q213; wdt:P625 ?coord2 .
    FILTER( geof:distance( ?coord1, ?coord2 ) < 2 ) .
  } .
  OPTIONAL { ?item2 wdt:P625 ?coord2 } .
  VALUES ?x { 1 2 } .
  BIND( IF( ?x = 1, ?item1, ?item2 ) AS ?item ) .
  BIND( IF( ?x = 1, ?coord1, ?coord2 ) AS ?coord ) .
  BIND( IF( ?x = 1, 'sv/ceb', 'ok' ) AS ?layer ) .
} ORDER BY ?itemLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?coord"):::projected v2("?coord1") v3("?coord2") v10("?item"):::projected v5("?item1") v4("?item2") v9("?itemLabel"):::projected v8("?label") v12("?layer"):::projected v6("?links") v7("?wikis") v9("?x") a1((" ")) a2((" ")) c9([https://cs.wikipedia.org/]):::iri c3(["wd:Q213"]):::iri f0[[" "]] subgraph f0e0["Exists Clause"] e0f0[["http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2) < '2^^xsd:integer'"]] e0f0 --> e0v1 e0f0 --> e0v2 e0v3 --"wdt:P17"--> e0c3 e0v3 --"wdt:P625"--> e0v2 e0v1("?coord1"):::projected e0v2("?coord2"):::projected e0v3("?item2"):::projected e0c3(["wd:Q213"]):::iri end f0--EXISTS--> f0e0 f0 --> v2 f0 --> v3 f0 --> v4 f0 --> c2 f0 --> c3 f0 --> c4 f1[["http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2) < '2^^xsd:integer'"]] f1 --> v2 f1 --> v3 v4 --"wdt:P17"--> c3 v4 --"wdt:P625"--> v3 f2[["?item2 != ?item1"]] f2 --> v4 f2 --> v5 bind3[/VALUES ?links/] bind3-->v6 bind30(["1^^xsd:integer"]) bind30 --> bind3 bind31(["2^^xsd:integer"]) bind31 --> bind3 bind32(["3^^xsd:integer"]) bind32 --> bind3 bind4[/VALUES ?wikis/] bind4-->v7 bind40([https://ceb.wikipedia.org/]) bind40 --> bind4 bind41([https://sv.wikipedia.org/]) bind41 --> bind4 v5 --"wdt:P17"--> c3 v5 --"wikibase:sitelinks"--> v6 v5 --"wdt:P625"--> v2 a1 --"schema:about"--> v5 a1 --"schema:isPartOf"--> v7 v5 --"rdfs:label"--> v8 subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; a2 --"schema:about"--> v5 a2 --"schema:isPartOf"--> c9 end bind6[/"STRLANG(str(if(contains(?label,' ('),substring-before(?label,' ('),?label)),'cs')"/] v8 --o bind6 bind6 --as--o v9 v4 --"rdfs:label"--> v9 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P625".-> v3 end bind7[/VALUES ?x/] bind7-->v9 bind70(["1^^xsd:integer"]) bind70 --> bind7 bind71(["2^^xsd:integer"]) bind71 --> bind7 bind8[/"if(?x = '1^^xsd:integer',?item1,?item2)"/] v9 --o bind8 v5 --o bind8 v4 --o bind8 bind8 --as--o v10 bind9[/"if(?x = '1^^xsd:integer',?coord1,?coord2)"/] v9 --o bind9 v2 --o bind9 v3 --o bind9 bind9 --as--o v11 bind10[/"if(?x = '1^^xsd:integer','sv/ceb','ok')"/] v9 --o bind10 bind10 --as--o v12