query-fc1ce9f3d59b93ac9f9e1f97c9c11d80

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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coords ?coordsApprox ?image ?location WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,de". }
  {
    SELECT DISTINCT ?item (sample(?coords_) as ?coords) (sample(?coordsApprox_) as ?coordsApprox) (sample(?image_) as ?image) ?location ?place WHERE {
      ?item p:P180 ?depict.
      { ?depict (ps:P180/wdt:P31*/wdt:P279*) wd:Q7559. }
      UNION
      { ?depict (ps:P180/wdt:P31*/wdt:P279*) wd:Q30170627. }

      OPTIONAL {
        ?item p:P625 ?statement1.
        ?statement1 (ps:P625) ?coords_.
        } 
      OPTIONAL {
        ?item p:P276 ?statement2.
        ?statement2 (ps:P276) ?place.
        ?place p:P625 ?statement3.
        ?statement3 (ps:P625) ?coordsApprox_.
      }

      OPTIONAL { ?item wdt:P18 ?image_. }

    } group by ?item  ?location ?place
    LIMIT 500
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v10("?coords"):::projected v11("?coordsApprox"):::projected v8("?coordsApprox_") v4("?coords_") v2("?depict") v12("?image"):::projected v9("?image_") v1("?item"):::projected v6("?place") v3("?statement1") v5("?statement2") v7("?statement3") a1((" ")) a2((" ")) a3((" ")) a4((" ")) c4(["#91;AUTO_LANGUAGE#93;,en,fr,de"]):::literal c2(["bd:serviceParam"]):::iri c9(["wd:Q7559"]):::iri c10(["wd:Q30170627"]):::iri subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"p:P180"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"p:statement/P180"--> a3 a3 --"p:direct/P31"--> a4 a4 --"p:direct/P279"--> c10 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:statement/P180"--> a1 a1 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c9 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P625".-> v3 v3 --"p:statement/P625"--> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P276".-> v5 v5 --"p:statement/P276"--> v6 v6 --"p:P625"--> v7 v7 --"p:statement/P625"--> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v9 end bind3[/"sample(?coords_)"/] v4 --o bind3 bind3 --as--o v10 bind4[/"sample(?coordsApprox_)"/] v8 --o bind4 bind4 --as--o v11 bind5[/"sample(?image_)"/] v9 --o bind5 bind5 --as--o v12