query-d9a695cc9889ea7bc13328e4557577c7

rq turtle/ttl

llista de topònims amb dimensions SELECT * WHERE {
{ ?item wdt:P17 wd:Q29. ?item wdt:P131+ wd:Q12668. } UNION {wd:Q12668 wdt:P206 ?item} BIND (REPLACE(STR(?item), "http://www.wikidata.org/entity/", "", "i") as ?itemId). MINUS { ?item wdt:P31/wdt:P279 wd:Q7075. } MINUS { ?item wdt:P31/wdt:P279 wd:Q5341295. MINUS {?item wdt:P31/wdt:P279 wd:Q811979} } ?item wdt:P31/wdt:P279 ?tipus. OPTIONAL {?item wdt:P1314 ?ulls} OPTIONAL {?item wdt:P1082 ?hab} OPTIONAL {?item p:P2043 ?sllarg. ?sllarg psv:P2043 ?sllargn. ?sllargn wikibase:quantityAmount ?llarg. ?sllargn wikibase:quantityUnit ?ullarg. OPTIONAL {?ullarg wdt:P5061 ?allarg. FILTER(LANG(?allarg) = "ca").} } OPTIONAL { ?item p:P2787 ?sllum. ?sllum psv:P2787 ?sllumn. ?sllumn wikibase:quantityAmount ?llum. ?sllumn wikibase:quantityUnit ?ullum. OPTIONAL {?ullum wdt:P5061 ?allum. FILTER(LANG(?allum) = "ca").} } OPTIONAL {?item p:P2049 ?sample. ?sample psv:P2049 ?samplen. ?samplen wikibase:quantityAmount ?ample. ?samplen wikibase:quantityAmount ?ample. ?samplen wikibase:quantityUnit ?uample. OPTIONAL {?uample wdt:P5061 ?aample. FILTER(LANG(?aample) = "ca").} } OPTIONAL {?item p:P2048 ?salt. ?salt psv:P2048 ?saltn. ?saltn wikibase:quantityAmount ?alt. ?saltn wikibase:quantityUnit ?uample. OPTIONAL {?uample wdt:P5061 ?aalt. FILTER(LANG(?aalt) = "ca").} } OPTIONAL {?item p:P4511 ?sprof. ?sprof psv:P4511 ?sprofn. ?sprofn wikibase:quantityAmount ?prof. ?sprofn wikibase:quantityUnit ?uprof. OPTIONAL {?uprof wdt:P5061 ?aprof. FILTER(LANG(?aprof) = "ca").} } OPTIONAL {?item p:P2547 ?sperim. ?sperim psv:P2547 ?sperimn. ?sperimn wikibase:quantityAmount ?perim. ?sperimn wikibase:quantityUnit ?uperim. OPTIONAL {?uperim wdt:P5061 ?aperim. FILTER(LANG(?aperim) = "ca").} } OPTIONAL {?item p:P2046 ?ssuperf. ?ssuperf psv:P2046 ?ssuperfn. ?ssuperfn wikibase:quantityAmount ?superf. ?ssuperfn wikibase:quantityUnit ?usuperf. OPTIONAL {?usuperf wdt:P5061 ?asuperf. FILTER(LANG(?asuperf) = "ca").} } OPTIONAL {?item p:P2234 ?svolum. ?svolum psv:P2234 ?svolumn. ?svolumn wikibase:quantityAmount ?volum. ?svolumn wikibase:quantityUnit ?uvolum. OPTIONAL {?uvolum wdt:P5061 ?avolum. FILTER(LANG(?avolum) = "ca").} } BIND(CONCAT(IF(BOUND(?hab),CONCAT(str(?hab)," hab"),""), IF(BOUND(?ulls),CONCAT("ulls: ",str(?ulls),""),""), IF(BOUND(?llum),CONCAT("llum: ",str(?llum)," ",str(?allum),""),""), IF(BOUND(?llarg),CONCAT("llarg: ",str(?llarg)," ",str(?allarg),""),""), IF(BOUND(?ample),CONCAT("ample: ",str(?ample)," ",str(?aample),""),""), IF(BOUND(?alt),CONCAT("alt: ",str(?alt)," ",str(?aalt),""),""), IF(BOUND(?prof),CONCAT("profunditat: ",str(?prof)," ",str(?aprof),""),""), IF(BOUND(?perim),CONCAT("perímetre: ",str(?perim)," ",str(?aperim),""),""), IF(BOUND(?superf),CONCAT("sup: ",str(?superf)," ",str(?asuperf),""),""), IF(BOUND(?volum),CONCAT("volum: ",str(?volum)," ",str(?avolum),""),"")) as ?mides) }

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/>
# llista de topònims amb dimensions
SELECT * WHERE {   
  {
  ?item wdt:P17 wd:Q29.
  ?item wdt:P131+ wd:Q12668.
  }
  UNION
  {wd:Q12668 wdt:P206 ?item}
   BIND (REPLACE(STR(?item), "http://www.wikidata.org/entity/", "", "i") as ?itemId).
  MINUS { ?item wdt:P31/wdt:P279* wd:Q7075. }
  MINUS { ?item wdt:P31/wdt:P279* wd:Q5341295.
         MINUS {?item wdt:P31/wdt:P279* wd:Q811979}
        }
 ?item wdt:P31/wdt:P279* ?tipus.
   OPTIONAL {?item wdt:P1314 ?ulls}
   OPTIONAL {?item wdt:P1082 ?hab}
        OPTIONAL {?item p:P2043 ?sllarg.
               ?sllarg psv:P2043 ?sllargn.
                ?sllargn wikibase:quantityAmount ?llarg. 
                ?sllargn wikibase:quantityUnit ?ullarg. 
                  OPTIONAL {?ullarg wdt:P5061 ?allarg.
                           FILTER(LANG(?allarg) = "ca").}
                 }
        OPTIONAL { ?item p:P2787  ?sllum.
               ?sllum psv:P2787  ?sllumn.
                ?sllumn wikibase:quantityAmount ?llum. 
                ?sllumn wikibase:quantityUnit ?ullum. 
                  OPTIONAL {?ullum wdt:P5061 ?allum.
                           FILTER(LANG(?allum) = "ca").}
              }
        OPTIONAL {?item p:P2049  ?sample.
               ?sample psv:P2049  ?samplen.
                ?samplen wikibase:quantityAmount ?ample. 
                ?samplen wikibase:quantityAmount ?ample. 
                ?samplen wikibase:quantityUnit ?uample. 
                  OPTIONAL {?uample wdt:P5061 ?aample.
                           FILTER(LANG(?aample) = "ca").}
              }
        OPTIONAL {?item p:P2048  ?salt.
               ?salt psv:P2048  ?saltn.
                ?saltn wikibase:quantityAmount ?alt. 
                ?saltn wikibase:quantityUnit ?uample. 
                  OPTIONAL {?uample wdt:P5061 ?aalt.
                           FILTER(LANG(?aalt) = "ca").}
              }
        OPTIONAL {?item p:P4511 ?sprof.
               ?sprof psv:P4511 ?sprofn.
                ?sprofn wikibase:quantityAmount ?prof. 
                ?sprofn wikibase:quantityUnit ?uprof. 
                  OPTIONAL {?uprof wdt:P5061 ?aprof.
                           FILTER(LANG(?aprof) = "ca").}
              }
        OPTIONAL {?item p:P2547 ?sperim.
               ?sperim psv:P2547 ?sperimn.
                ?sperimn wikibase:quantityAmount ?perim. 
                ?sperimn wikibase:quantityUnit ?uperim. 
                  OPTIONAL {?uperim wdt:P5061 ?aperim.
                           FILTER(LANG(?aperim) = "ca").}
              }
        OPTIONAL {?item p:P2046 ?ssuperf.
               ?ssuperf psv:P2046 ?ssuperfn.
                ?ssuperfn wikibase:quantityAmount ?superf. 
                ?ssuperfn wikibase:quantityUnit ?usuperf. 
                  OPTIONAL {?usuperf wdt:P5061 ?asuperf.
                           FILTER(LANG(?asuperf) = "ca").}
              }
        OPTIONAL {?item p:P2234 ?svolum.
               ?svolum psv:P2234 ?svolumn.
                ?svolumn wikibase:quantityAmount ?volum. 
                ?svolumn wikibase:quantityUnit ?uvolum. 
                  OPTIONAL {?uvolum wdt:P5061 ?avolum.
                           FILTER(LANG(?avolum) = "ca").}
              }
   BIND(CONCAT(IF(BOUND(?hab),CONCAT(str(?hab)," hab</br>"),""), 
               IF(BOUND(?ulls),CONCAT("ulls: ",str(?ulls),"</br>"),""), 
               IF(BOUND(?llum),CONCAT("llum: ",str(?llum)," ",str(?allum),"</br>"),""), 
               IF(BOUND(?llarg),CONCAT("llarg: ",str(?llarg)," ",str(?allarg),"</br>"),""), 
               IF(BOUND(?ample),CONCAT("ample: ",str(?ample)," ",str(?aample),"</br>"),""), 
               IF(BOUND(?alt),CONCAT("alt: ",str(?alt)," ",str(?aalt),"</br>"),""), 
               IF(BOUND(?prof),CONCAT("profunditat: ",str(?prof)," ",str(?aprof),"</br>"),""), 
               IF(BOUND(?perim),CONCAT("perímetre: ",str(?perim)," ",str(?aperim),"</br>"),""), 
               IF(BOUND(?superf),CONCAT("sup: ",str(?superf)," ",str(?asuperf),"</br>"),""), 
               IF(BOUND(?volum),CONCAT("volum: ",str(?volum)," ",str(?avolum),"</br>"),"")) as ?mides)
  }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v21("?aalt"):::projected v16("?aample"):::projected v6("?allarg"):::projected v11("?allum"):::projected v24("?alt"):::projected v19("?ample"):::projected v30("?aperim"):::projected v25("?aprof"):::projected v35("?asuperf"):::projected v40("?avolum"):::projected v5("?hab"):::projected v1("?item"):::projected v2("?itemId"):::projected v9("?llarg"):::projected v14("?llum"):::projected v45("?mides"):::projected v33("?perim"):::projected v28("?prof"):::projected v22("?salt"):::projected v23("?saltn"):::projected v17("?sample"):::projected v18("?samplen"):::projected v7("?sllarg"):::projected v8("?sllargn"):::projected v12("?sllum"):::projected v13("?sllumn"):::projected v31("?sperim"):::projected v32("?sperimn"):::projected v26("?sprof"):::projected v27("?sprofn"):::projected v36("?ssuperf"):::projected v37("?ssuperfn"):::projected v38("?superf"):::projected v41("?svolum"):::projected v42("?svolumn"):::projected v3("?tipus"):::projected v20("?uample"):::projected v10("?ullarg"):::projected v4("?ulls"):::projected v15("?ullum"):::projected v34("?uperim"):::projected v29("?uprof"):::projected v39("?usuperf"):::projected v44("?uvolum"):::projected v43("?volum"):::projected a1((" ")) a2((" ")) a3((" ")) a4((" ")) c9(["wd:Q5341295"]):::iri c2(["wd:Q29"]):::iri c10(["wd:Q811979"]):::iri c8(["wd:Q7075"]):::iri c4(["wd:Q12668"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; c4 --"p:direct/P206"--> v1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"p:direct/P17"--> c2 v1 --"p:direct/P131"--> c4 end union0r <== or ==> union0l end bind0[/"replace(str(?item),'http://www.wikidata.org/entity/','','i')"/] v1 --o bind0 bind0 --as--o v2 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c8 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v1 --"p:direct/P31"--> a2 a2 --"p:direct/P279"--> c9 subgraph minus3["MINUS"] style minus3 stroke-width:6px,fill:pink,stroke:red; v1 --"p:direct/P31"--> a3 a3 --"p:direct/P279"--> c10 end end v1 --"p:direct/P31"--> a4 a4 --"p:direct/P279"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P1314".-> v4 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P1082".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2043".-> v7 v7 --"p:statement/value/P2043"--> v8 v8 --"wikibase:quantityAmount"--> v9 v8 --"wikibase:quantityUnit"--> v10 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v10 -."p:direct/P5061".-> v6 end end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2787".-> v12 v12 --"p:statement/value/P2787"--> v13 v13 --"wikibase:quantityAmount"--> v14 v13 --"wikibase:quantityUnit"--> v15 subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v15 -."p:direct/P5061".-> v11 end end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2049".-> v17 v17 --"p:statement/value/P2049"--> v18 v18 --"wikibase:quantityAmount"--> v19 v18 --"wikibase:quantityAmount"--> v19 v18 --"wikibase:quantityUnit"--> v20 subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v20 -."p:direct/P5061".-> v16 end end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2048".-> v22 v22 --"p:statement/value/P2048"--> v23 v23 --"wikibase:quantityAmount"--> v24 v23 --"wikibase:quantityUnit"--> v20 subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v20 -."p:direct/P5061".-> v21 end end subgraph optional10["(optional)"] style optional10 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P4511".-> v26 v26 --"p:statement/value/P4511"--> v27 v27 --"wikibase:quantityAmount"--> v28 v27 --"wikibase:quantityUnit"--> v29 subgraph optional11["(optional)"] style optional11 fill:#bbf,stroke-dasharray: 5 5; v29 -."p:direct/P5061".-> v25 end end subgraph optional12["(optional)"] style optional12 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2547".-> v31 v31 --"p:statement/value/P2547"--> v32 v32 --"wikibase:quantityAmount"--> v33 v32 --"wikibase:quantityUnit"--> v34 subgraph optional13["(optional)"] style optional13 fill:#bbf,stroke-dasharray: 5 5; v34 -."p:direct/P5061".-> v30 end end subgraph optional14["(optional)"] style optional14 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2046".-> v36 v36 --"p:statement/value/P2046"--> v37 v37 --"wikibase:quantityAmount"--> v38 v37 --"wikibase:quantityUnit"--> v39 subgraph optional15["(optional)"] style optional15 fill:#bbf,stroke-dasharray: 5 5; v39 -."p:direct/P5061".-> v35 end end subgraph optional16["(optional)"] style optional16 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P2234".-> v41 v41 --"p:statement/value/P2234"--> v42 v42 --"wikibase:quantityAmount"--> v43 v42 --"wikibase:quantityUnit"--> v44 subgraph optional17["(optional)"] style optional17 fill:#bbf,stroke-dasharray: 5 5; v44 -."p:direct/P5061".-> v40 end end bind4[/"concat(if(bound(?hab),concat(str(?hab),' hab</br>'),''),if(bound(?ulls),concat('ulls: ',str(?ulls),'</br>'),''),if(bound(?llum),concat('llum: ',str(?llum),' ',str(?allum),'</br>'),''),if(bound(?llarg),concat('llarg: ',str(?llarg),' ',str(?allarg),'</br>'),''),if(bound(?ample),concat('ample: ',str(?ample),' ',str(?aample),'</br>'),''),if(bound(?alt),concat('alt: ',str(?alt),' ',str(?aalt),'</br>'),''),if(bound(?prof),concat('profunditat: ',str(?prof),' ',str(?aprof),'</br>'),''),if(bound(?perim),concat('perímetre: ',str(?perim),' ',str(?aperim),'</br>'),''),if(bound(?superf),concat('sup: ',str(?superf),' ',str(?asuperf),'</br>'),''),if(bound(?volum),concat('volum: ',str(?volum),' ',str(?avolum),'</br>'),''))"/] v5 --o bind4 v4 --o bind4 v14 --o bind4 v11 --o bind4 v9 --o bind4 v6 --o bind4 v19 --o bind4 v16 --o bind4 v24 --o bind4 v21 --o bind4 v28 --o bind4 v25 --o bind4 v33 --o bind4 v30 --o bind4 v38 --o bind4 v35 --o bind4 v43 --o bind4 v40 --o bind4 bind4 --as--o v45