query-8c5252c8c4cb6bf84df5abd653f096bb

rq turtle/ttl

doesn't want to be concatenated. 🤷 ?itemLabel: this almost works except the Tagishsimon@

Use at

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#>
SELECT ?item ?anidb WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

  { ?item wdt:P31 wd:Q80447738. }
  UNION
  { ?item wdt:P31 wd:Q87576284. }
  OPTIONAL { ?item wdt:P5648 ?_anidb. }

  BIND(
    IF(!BOUND(?_anidb),
       CONCAT("[https://anidb.net/character/label?do.search=1&adb.search=",?itemLabel," missing]"),
       CONCAT("[https://anidb.net/character/",?_anidb," ",?_anidb,"]")
    )
  AS ?anidb)
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?_anidb") v3("?anidb"):::projected v1("?item"):::projected c2(["bd:serviceParam"]):::iri c7(["wd:Q87576284"]):::iri c6(["wd:Q80447738"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c7 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v1 --"wdt:P31"--> c6 end union0r <== or ==> union0l end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."wdt:P5648".-> v2 end bind0[/"if(not bound(?_anidb),concat('#91;https://anidb.net/character/label?do.search=1&adb.search=',?itemLabel,' missing#93;'),concat('#91;https://anidb.net/character/',?_anidb,' ',?_anidb,'#93;'))"/] v2 --o bind0 null --o bind0 bind0 --as--o v3