query-a1aaa5e53741728e3853b9e2e11db6e8
Indian rails without Indian Railways train number (P8180) SELECT ?item ?itemLabel ?strt ?dest ?itemDescription (COUNT(?sitelink) AS ?sitelinks) ?irtno WHERE { ?item wdt:P31 wd:Q15141321. ?item wdt:P17 wd:Q668. # MINUS { ?item wdt:P8180 [] } . # without Indian Railways train number ?sitelink schema:about ?item. OPTIONAL {?item wdt:P8180 ?irtno .} OPTIONAL {?item wdt:P1427 ?strt .} OPTIONAL {?item wdt:P1444 ?dest .} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?itemLabel ?itemDescription ?twitter ?item ?irtno ?strt ?dest ORDER BY DESC (?sitelinks)
ORDER BY DESC (?irtno)
Use at
- https://query.wikidata.org/sparql
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 bd: <http://www.bigdata.com/rdf#>
# Indian rails without Indian Railways train number (P8180)
SELECT ?item ?itemLabel ?strt ?dest ?itemDescription (COUNT(?sitelink) AS ?sitelinks) ?irtno WHERE {
?item wdt:P31 wd:Q15141321.
?item wdt:P17 wd:Q668.
# MINUS { ?item wdt:P8180 [] } . # without Indian Railways train number
?sitelink schema:about ?item.
OPTIONAL {?item wdt:P8180 ?irtno .}
OPTIONAL {?item wdt:P1427 ?strt .}
OPTIONAL {?item wdt:P1444 ?dest .}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?itemLabel ?itemDescription ?twitter ?item ?irtno ?strt ?dest
ORDER BY DESC (?sitelinks)
#ORDER BY DESC (?irtno)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?dest"):::projected
v4("?irtno"):::projected
v2("?item"):::projected
v3("?sitelink"):::projected
v7("?sitelinks")
v5("?strt"):::projected
c2(["wd:Q15141321"]):::iri
c10(["bd:serviceParam"]):::iri
c4(["wd:Q668"]):::iri
c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal
v2 --"wdt:P31"--> c2
v2 --"wdt:P17"--> c4
v3 --"schema:about"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P8180".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1427".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v2 -."wdt:P1444".-> v6
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c10 --"wikibase:language"--> c12
end
bind1[/"count(?sitelink)"/]
v3 --o bind1
bind1 --as--o v7