query-c3cb656b9c570a8613d6cd4114324e43

rq turtle/ttl

No problems until there was an item with 2 channel id's. My tool ran 4 times instead of the expected 2 times. Because both GUID's were returned for each value. After trying various things, I finally found out that my logic was wrong. I needed to get the GUID's first and not the values for the P2397 claim, but the values for the GUID's.

Use at

PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?YouTube ?YouTubeEntity WHERE {
    ?item p:P2397 ?YouTubeEntity .
    ?YouTubeEntity ps:P2397 ?YouTube .
    filter(SUBSTR(str(?YouTube),1,2)!="UC")
           }

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?YouTube"):::projected v3("?YouTubeEntity"):::projected v2("?item"):::projected f0[["substring(str(?YouTube),'1^^xsd:integer','2^^xsd:integer') != 'UC'"]] f0 --> v1 v2 --"p:P2397"--> v3 v3 --"p:statement/P2397"--> v1