query-cf89e7566121f21005f6a2242753e16e

rq turtle/ttl

Straßen, Plätze und Brücken in Dresden (Übersicht mit Stadtwiki und Themenstadtplan)User:Stefan Kühn/DresdenAutor und weitere Beispiele:

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#-------------------------------------------------------------------------------
# Straßen, Plätze und Brücken in Dresden (Übersicht mit Stadtwiki und Themenstadtplan)
#-------------------------------------------------------------------------------

PREFIX schema: <http://schema.org/>
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?image 
   (URI(CONCAT("https://stadtplan.dresden.de/?POS-ADR=",?DDstreetID)) as ?DDstreetID_link)   
   (URI(CONCAT("https://www.stadtwikidd.de/wiki/",?stadtwikiDD)) as ?stadtwikiDD_link) 
   ?commons2 ?coordinate ?status ?rgb

WHERE {
  ?item wdt:P8710 ?streetID
  OPTIONAL { ?item wdt:P373 ?commons. }                                  # Commons-Kategorie
  #FILTER(!BOUND(?commons)) #commons leer
  OPTIONAL { ?item wdt:P18 ?image. }                                  # optional: Bild
  OPTIONAL { ?item wdt:P625 ?coordinate. }                          # optional: Koordinate (für Ansicht in Karte)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de". } # Sprachausgabe deutsch

  BIND(BOUND(?commons) && strlen(?commons)>0 as ?check_cat)          # true/false - gibt es eine Commons-Category 
  BIND(BOUND(?image) as ?check_img)                                  # true/false - gibt es ein Bild

  BIND(  IF( ?check_img , "image",
         IF( ?check_cat , "category",   
            "no cat")) AS ?status).

  BIND(  IF( ?check_img , "7FFF00",
         IF( ?check_cat , "009500",   
            "ff2d00")) AS ?rgb). 
  # https://htmlcolorcodes.com/
  # 7FFF00 neongrün
  # 009500 dunkelgrün
  # FFF000 gelb
  # 9B0058 rot
  # ff2d00 hellrot

  OPTIONAL {?item wdt:P8713 ?stadtwikiDD . }
  OPTIONAL {?item wdt:P8710 ?DDstreetID . }
  OPTIONAL {?commons2   schema:about ?item ;
           schema:isPartOf <https://commons.wikimedia.org/> .
  } 
  FILTER(?rgb="ff2d00").  
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v11("?DDstreetID"):::projected v13("?DDstreetID_link") v7("?check_cat") v8("?check_img") v4("?commons") v12("?commons2"):::projected v6("?coordinate"):::projected v5("?image"):::projected v2("?item"):::projected v10("?rgb"):::projected v10("?stadtwikiDD"):::projected v14("?stadtwikiDD_link") v9("?status"):::projected v3("?streetID") c9(["de"]):::literal c13([https://commons.wikimedia.org/]):::iri c7(["bd:serviceParam"]):::iri f0[["?rgb = 'ff2d00'"]] f0 --> v10 v2 --"wdt:P8710"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P373".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P625".-> v6 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c7 --"wikibase:language"--> c9 end bind1[/"bound(?commons)string-length(?commons) > '0^^xsd:integer'"/] v4 --o bind1 bind1 --as--o v7 bind2[/"bound(?image)"/] v5 --o bind2 bind2 --as--o v8 bind3[/"if(?check_img,'image',if(?check_cat,'category','no cat'))"/] v8 --o bind3 v7 --o bind3 bind3 --as--o v9 bind4[/"if(?check_img,'7FFF00',if(?check_cat,'009500','ff2d00'))"/] v8 --o bind4 v7 --o bind4 bind4 --as--o v10 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P8713".-> v10 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P8710".-> v11 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v12 -."schema:about".-> v2 v12 --"schema:isPartOf"--> c13 end bind5[/"concat('https://stadtplan.dresden.de/?POS-ADR=',?DDstreetID)"/] v11 --o bind5 bind5 --as--o v13 bind6[/"concat('https://www.stadtwikidd.de/wiki/',?stadtwikiDD)"/] v10 --o bind6 bind6 --as--o v14