query-3ab252fdde681f771d03d4f8410bee5e
Colouring graph nodes and labelling relationshipsI've been creating a new Wikidata query which shows tunes which are contrafacts (melodies based on another tune's chords) along with the composer etc.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Show tunes and tunes on which they are based
#defaultView:Graph
SELECT
?item ?itemLabel ?composer ?composerLabel ?image
?other ?otherLabel ("7FFF00" as ?rgb)
WHERE
{
?item wdt:P31 wd:Q23817390 . # tune
?item wdt:P144 ?other . # if the tune is based on another
?item wdt:P86 ?composer .
OPTIONAL {?composer wdt:P18 ?image . } # grab image
#?other wdt:P18 ?image2 . # grab image
#?other wdt:P86 ?otherComposer .
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("?composer"):::projected
v4("?image"):::projected
v1("?item"):::projected
v2("?other"):::projected
v5("?rgb")
c7(["bd:serviceParam"]):::iri
c9(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c2(["wd:Q23817390"]):::iri
v1 --"wdt:P31"--> c2
v1 --"wdt:P144"--> v2
v1 --"wdt:P86"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."wdt:P18".-> v4
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind0[/"'7FFF00'"/]
bind0 --as--o v5