query-d35d342540363b2a215fb01b3f5f7f84

rq turtle/ttl

Trade(P2561)name (P1651)YouTube video ID

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?YouTubeVideoID ?name
WHERE
{
  ?statement pq:P2561 ?name . # Start here because P2561 is only used as qualifier ca. 2500 times.
  ?item p:P1651 ?statement .
  FILTER (CONTAINS (?name, "music video") || CONTAINS (?name, "musicvideo") || CONTAINS (?name, "official"))
  MINUS { ?item wdt:P31 wd:Q193977 }
  ?statement ps:P1651 ?YouTubeVideoID .
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?YouTubeVideoID"):::projected v3("?item"):::projected v1("?name"):::projected v2("?statement") c7(["wd:Q193977"]):::iri c10(["bd:serviceParam"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["(contains(?name,'music video') || (contains(?name,'musicvideo') || contains(?name,'official')))"]] f0 --> v1 v2 --"p:qualifier/P2561"--> v1 v3 --"p:P1651"--> v2 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v3 --"p:direct/P31"--> c7 end v2 --"p:statement/P1651"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end