query-52f8c428c9f718af90ddda88feb52be1

rq turtle/ttl

Look after a/some specific Indian Railways code(s)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?item ?itemLabel ?Indian ?natureLabel WHERE {
{?item wdt:P5696 ?Indian
VALUES ?Indian { "AMS" "BOO" }.} #item has a P5696 value   
  OPTIONAL { ?item wdt:P31 ?nature. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } . #this bit gets labels for Qid values
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?Indian"):::projected v1("?item"):::projected v3("?nature") c4(["bd:serviceParam"]):::iri c6(["#91;AUTO_LANGUAGE#93;,en"]):::literal v1 --"wdt:P5696"--> v3 bind0[/VALUES ?Indian/] bind0-->v3 bind00(["AMS"]) bind00 --> bind0 bind01(["BOO"]) bind01 --> bind0 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P31".-> v3 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c4 --"wikibase:language"--> c6 end