query-9ea1912111ab5e0dc0feb414436b227e

rq turtle/ttl

Routes départementalesNombre : 1 134 (au 18/01/2023)

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#>
SELECT DISTINCT ?item ?itemLabel WHERE {
  { ?item wdt:P31/wdt:P279* wd:Q34442 ; p:P16/ps:P16/wdt:P279* wd:Q19796778 } . 
  ?item wdt:P131 ?loc . 
  OPTIONAL { ?item wdt:P1824 ?p1824 } 
  BIND(STRLEN(str(?p1824)) as ?longp1824) 
  BIND(SUBSTR(str(?p1824),1,1) as ?statut) 
  BIND(SUBSTR(str(?p1824),2,(?longp1824 - 1)) as ?numero) 
  BIND(REPLACE(SUBSTR(str(?numero),1,4),"[A-Za-z ]","") as ?num) 
  BIND(STRLEN(str(?num)) as ?longnum) 
  BIND(CONCAT(IF(?longnum=1,"000",IF(?longnum=2,"00",IF(?longnum=3,"0",""))), str(?num)) as ?numz) 
  BIND(CONCAT(str(?statut),str(?num)) as ?numsp) 
  BIND(STRLEN(str(?numsp)) as ?longnumsp) 
  BIND((?longp1824 - ?longnumsp) as ?longprefixe) 
  BIND(SUBSTR(str(?p1824),(?longnumsp + 1),?longprefixe) as ?prefixe) 
  BIND(CONCAT(str(?statut),str(?numz),str(?prefixe)) as ?cledetri) 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr" . } 
} ORDER BY ?cledetri

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v15("?cledetri") v2("?item"):::projected v3("?loc") v9("?longnum") v12("?longnumsp") v5("?longp1824") v13("?longprefixe") v8("?num") v7("?numero") v11("?numsp") v10("?numz") v4("?p1824") v14("?prefixe") v6("?statut") a1((" ")) a2((" ")) a3((" ")) c3(["wd:Q34442"]):::iri c10(["bd:serviceParam"]):::iri c6(["wd:Q19796778"]):::iri c12(["fr"]):::literal v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v2 --"p:P16"--> a2 a2 --"p:statement/P16"--> a3 a3 --"p:direct/P279"--> c6 v2 --"p:direct/P131"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P1824".-> v4 end bind0[/"string-length(str(?p1824))"/] v4 --o bind0 bind0 --as--o v5 bind1[/"substring(str(?p1824),'1^^xsd:integer','1^^xsd:integer')"/] v4 --o bind1 bind1 --as--o v6 bind2[/"substring(str(?p1824),'2^^xsd:integer',?longp1824 - '1^^xsd:integer')"/] v4 --o bind2 v5 --o bind2 bind2 --as--o v7 bind3[/"replace(substring(str(?numero),'1^^xsd:integer','4^^xsd:integer'),'#91;A-Za-z #93;','')"/] v7 --o bind3 bind3 --as--o v8 bind4[/"string-length(str(?num))"/] v8 --o bind4 bind4 --as--o v9 bind5[/"concat(if(?longnum = '1^^xsd:integer','000',if(?longnum = '2^^xsd:integer','00',if(?longnum = '3^^xsd:integer','0',''))),str(?num))"/] v9 --o bind5 v8 --o bind5 bind5 --as--o v10 bind6[/"concat(str(?statut),str(?num))"/] v6 --o bind6 v8 --o bind6 bind6 --as--o v11 bind7[/"string-length(str(?numsp))"/] v11 --o bind7 bind7 --as--o v12 bind8[/"?longp1824 - ?longnumsp"/] v5 --o bind8 v12 --o bind8 bind8 --as--o v13 bind9[/"substring(str(?p1824),?longnumsp + '1^^xsd:integer',?longprefixe)"/] v4 --o bind9 v12 --o bind9 v13 --o bind9 bind9 --as--o v14 bind10[/"concat(str(?statut),str(?numz),str(?prefixe))"/] v6 --o bind10 v10 --o bind10 v14 --o bind10 bind10 --as--o v15 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end