query-59584e81142021d242e6bfa0e7b089de

rq turtle/ttl

Fixing incorrect pairs of values + unlinked qualifiers = Punk + Punk Rock IDs, which are duplicated twice. (Q3071)punk rock I'm trying to make a list of URLs built through a property value and its qualifier (ID + named as). This works fine, except when the subject has two values. Then you get not only 1-1 / 2-2 pairs, but also incorrect 1-2 and 2-1 pairs of value+qualifier. In the table check

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel ?amurl WHERE {
    ?item wdt:P9185 ?amID.
    ?item p:P9185 [ pq:P1810 ?amQ ].
    wd:P9185 rdfs:label ?propItemLabelam.
    FILTER((LANG(?propItemLabelam)) = "en")
    BIND(CONCAT("[https://www.allmusic.com/style/", ?amID," ",?amQ, "]") AS ?amurl)
    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; v3("?amID") v4("?amQ") v5("?amurl"):::projected v2("?item"):::projected v1("?propItemLabelam") a1((" ")) c8(["bd:serviceParam"]):::iri c5(["wd:P9185"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["?propItemLabelam = 'en'"]] f0 --> v1 v2 --"p:direct/P9185"--> v3 a1 --"p:qualifier/P1810"--> v4 v2 --"p:P9185"--> a1 c5 --"rdfs:label"--> v1 bind1[/"concat('#91;https://www.allmusic.com/style/',?amID,' ',?amQ,'#93;')"/] v3 --o bind1 v4 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end