query-daa8024a7c2de843d3ffe49c823d0041

rq turtle/ttl

TODO

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?item ?label ?type (LANG(?label) AS ?language_code)
WHERE {
  VALUES ?item { wd:Q410237 wd:Q422761 }
  ?item wdt:P3345 ?rx .
  {
    ?item rdfs:label ?itemLabel .
    VALUES ?type { "label"}
  }
  UNION
  {
    ?item skos:altLabel ?itemAltLabel .
    VALUES ?type { "alias"}
  }
  BIND (COALESCE(?itemLabel, ?itemAltLabel) AS ?label)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v5("?itemAltLabel") v3("?itemLabel") v6("?label"):::projected v7("?language_code") v2("?rx") v6("?type"):::projected bind0[/VALUES ?item/] bind0-->v1 bind00(["wd:Q410237"]) bind00 --> bind0 bind01(["wd:Q422761"]) bind01 --> bind0 v1 --"wdt:P3345"--> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"skos:altLabel"--> v5 bind1[/VALUES ?type/] bind1-->v6 bind10(["alias"]) bind10 --> bind1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"rdfs:label"--> v3 bind2[/VALUES ?type/] bind2-->v6 bind20(["label"]) bind20 --> bind2 end union0r <== or ==> union0l end bind3[/"?itemLabel?itemAltLabel"/] v3 --o bind3 v5 --o bind3 bind3 --as--o v6 bind4[/"?label"/] v6 --o bind4 bind4 --as--o v7