query-b0792582e0850dd9efeb6d63c7f4e6a5

rq turtle/ttl

Moebeus(Q1353749)Michelle (Q15621047)Michelle

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?song ?female_name ?title (LANG(?title) AS ?title_language) ?note
{
  {

{
  SELECT DISTINCT ?song ?title
  {
    ?song wdt:P31 / wdt:P279 * wd:Q105543609 .
    ?song wdt:P1476 ?title .
  }
}    ?female_name wdt:P1705 ?title .
    ?female_name wdt:P31 wd:Q11879590 .
  }
  UNION
  {

{
  SELECT DISTINCT ?song ?title
  {
    ?song wdt:P31 / wdt:P279 * wd:Q105543609 .
    ?song wdt:P1476 ?title .
  }
}    FILTER (LANG(?title) != "mul")
    BIND (STRLANG(STR(?title), "mul") AS ?title_mul)
    ?female_name wdt:P1705 ?title_mul .
    ?female_name wdt:P31 wd:Q11879590 .  
    BIND ("match one to multiple" AS ?note)
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?female_name"):::projected v5("?note"):::projected v1("?song"):::projected v2("?title"):::projected v6("?title_language") v4("?title_mul") a1((" ")) a2((" ")) c3(["wd:Q105543609"]):::iri c6(["wd:Q11879590"]):::iri subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["?title != 'mul'"]] f0 --> v2 v1 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c3 v1 --"wdt:P1476"--> v2 bind1[/"STRLANG(str(?title),'mul')"/] v2 --o bind1 bind1 --as--o v4 v3 --"wdt:P1705"--> v4 v3 --"wdt:P31"--> c6 bind2[/"'match one to multiple'"/] bind2 --as--o v5 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v1 --"wdt:P1476"--> v2 v3 --"wdt:P1705"--> v2 v3 --"wdt:P31"--> c6 end union0r <== or ==> union0l end bind3[/"?title"/] v2 --o bind3 bind3 --as--o v6