query-6a3a89865cfc2608a4fb304e46345294
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?id ?idLabel ?wikilink
(concat('[[', ?idLabel, ']]') as ?title)
(REPLACE( ?idLabel , "National Highway ", "" ) AS ?high_no)
?number
WHERE
{
?id wdt:P16 wd:Q1967342 . # National Higway (India)
?id rdfs:label ?label . FILTER(lang(?label)='en')
#Note: Different languages seem to have different numbers in the labels for some roads, e.g. for Q643144
BIND(xsd:integer(REPLACE(?label,'\\D','')) AS ?number)
FILTER(?number<100)
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en'}
?wikilink schema:about ?id; schema:isPartOf <https://en.wikipedia.org/> .
}
ORDER BY ?number
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?high_no")
v3("?id"):::projected
v2("?label")
v4("?number"):::projected
v5("?title")
v4("?wikilink"):::projected
c4(["wd:Q1967342"]):::iri
c11([https://en.wikipedia.org/]):::iri
c7(["bd:serviceParam"]):::iri
c2(["en"]):::literal
f0[["?number < '100^^xsd:integer'"]]
f0 --> v4
f1[["?label = 'en'"]]
f1 --> v2
v3 --"wdt:P16"--> c4
v3 --"rdfs:label"--> v2
bind2[/"http://www.w3.org/2001/XMLSchema#integer(replace(?label,'\D',''))"/]
v2 --o bind2
bind2 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c2
end
v4 --"schema:about"--> v3
v4 --"schema:isPartOf"--> c11
bind3[/"concat('#91;#91;',?idLabel,'#93;#93;')"/]
null --o bind3
bind3 --as--o v5
bind4[/"replace(?idLabel,'National Highway ','')"/]
null --o bind4
bind4 --as--o v6