query-4262e0eb4caa534d80a2e94eadaed2d8

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 psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX schema: <http://schema.org/>
SELECT ?commune ?communeLabel ?wikivoyageTitel ?wikipediaTitel ?communeImage ?communePostalCode ?communeWebsite ?latitude ?longitude



    WHERE {
       {
      SELECT ?commune (SAMPLE(?lat) AS ?latitude) (SAMPLE(?lng) AS ?longitude) ?communePostalCode WHERE {
        ?commune wdt:P31 wd:Q484170;
                 p:P625 ?coordinate.
        ?coordinate psv:P625 ?coordinate_node.
        ?coordinate_node wikibase:geoLatitude ?lat. 
        ?coordinate_node wikibase:geoLongitude ?lng.
        ?commune wdt:P281 ?communePostalCode
        FILTER (?communePostalCode > "0" && ?communePostalCode < "10000")
      }
      GROUP BY ?commune ?communePostalCode
    }
      OPTIONAL { ?commune wdt:P18 ?communeImage }.
      OPTIONAL { ?commune wdt:P856 ?communeWebsite }.
      OPTIONAL { 
        ?wikivoyageArticle schema:about ?commune.
        ?wikivoyageArticle schema:isPartOf <https://en.wikivoyage.org/>.
        ?wikivoyageArticle schema:name ?wikivoyageTitel.
      }.
      OPTIONAL { 
        ?wikipediaArticle schema:about ?commune.
        ?wikipediaArticle schema:isPartOf <https://en.wikipedia.org/>.
        ?wikipediaArticle schema:name ?wikipediaTitel.
      }.
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    }
GROUP BY ?commune ?communeLabel ?wikivoyageTitel ?wikipediaTitel ?communeImage ?communePostalCode ?communeWebsite ?latitude ?longitude
ORDER BY ?communePostalCode

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?commune"):::projected v9("?communeImage"):::projected v1("?communePostalCode"):::projected v10("?communeWebsite"):::projected v3("?coordinate") v4("?coordinate_node") v5("?lat") v7("?latitude"):::projected v6("?lng") v8("?longitude"):::projected v13("?wikipediaArticle") v14("?wikipediaTitel"):::projected v11("?wikivoyageArticle") v12("?wikivoyageTitel"):::projected c16([https://en.wikipedia.org/]):::iri c18(["bd:serviceParam"]):::iri c20(["#91;AUTO_LANGUAGE#93;,en"]):::literal c14([https://en.wikivoyage.org/]):::iri c4(["wd:Q484170"]):::iri f0[["?communePostalCode > '0'?communePostalCode < '10000'"]] f0 --> v1 v2 --"p:direct/P31"--> c4 v2 --"p:P625"--> v3 v3 --"p:statement/value/P625"--> v4 v4 --"wikibase:geoLatitude"--> v5 v4 --"wikibase:geoLongitude"--> v6 v2 --"p:direct/P281"--> v1 bind3[/"sample(?lat)"/] v5 --o bind3 bind3 --as--o v7 bind4[/"sample(?lng)"/] v6 --o bind4 bind4 --as--o v8 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P18".-> v9 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P856".-> v10 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v11 -."schema:about".-> v2 v11 --"schema:isPartOf"--> c14 v11 --"schema:name"--> v12 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v13 -."schema:about".-> v2 v13 --"schema:isPartOf"--> c16 v13 --"schema:name"--> v14 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c18 --"wikibase:language"--> c20 end