query-4a108e5b4d5a5ae3c6fd4de3c2f48190

rq turtle/ttl

Only using the first matching UNION?I have the following query, to display a map of depiction of dragon I wrote a while ago and enhanced today:

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 ?coords ?coordsApprox ?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. }

      {
        ?item p:P625 ?statement1.
        ?statement1 (ps:P625) ?coords.
      } UNION {
        ?item p:P276 ?statement2.
        ?statement2 (ps:P276) ?place.
        ?place p:P625 ?statement3.
        ?statement3 (ps:P625) ?coordsApprox.
      }

      OPTIONAL { ?item wdt:P18 ?image. }

    }
    LIMIT 500
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?coords"):::projected v8("?coordsApprox"):::projected v2("?depict") v9("?image"):::projected 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 union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v1 --"p:P276"--> v5 v5 --"p:statement/P276"--> v6 v6 --"p:P625"--> v7 v7 --"p:statement/P625"--> v8 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v1 --"p:P625"--> v3 v3 --"p:statement/P625"--> v4 end union1r <== or ==> union1l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v9 end