query-918f4513d619a38c5891d5c0557cb156
Get the item that has an external identifier of a specific valueHi! I am trying to write a query that returns an item that has an external identifier of a specific value (e.g. "UCZGYJFUizSax-yElQaFDp5Q") This is the value of the YouTube channel ID of this item Q462). I don't want to specify the property ID in the query, like the example below. I just want to specify that a property of type external identifier has this value "UCZGYJFUizSax-yElQaFDp5Q". Same query does work with other properties, for example this one returns an item
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel WHERE{
?item wdt:P2397 "UCZGYJFUizSax-yElQaFDp5Q"
SERVICE wikibase:label { bd:serviceParam wikibase:language "en"
}
}
Query found at
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2021/08
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2021/09
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
c4(["bd:serviceParam"]):::iri
c2(["UCZGYJFUizSax-yElQaFDp5Q"]):::literal
c6(["en"]):::literal
v1 --"wdt:P2397"--> c2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c4 --"wikibase:language"--> c6
end