query-31ac04c97f0537517144b58ed81c12cd

rq turtle/ttl

WDQS wäre am einfachsten, und möglicherweise gar die einzige Lösung. Ich würde mal sowas hier machen:

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX schema: <http://schema.org/>
SELECT ?dewiki_name ?dewiki_sitelink ?dewiki_commonslink ?item ?wikidata_commonslink ?wikidata_P373 ?diff_de_wd WHERE {
  VALUES (?dewiki_name ?dewiki_commonslink) {
    ( 'Albert Miller (Politiker)'@de 'Albert Miller (Politiker)' )
    # add further input tuples here ....
  }
  OPTIONAL {
    ?dewiki_sitelink schema:about ?item; schema:isPartOf <https://de.wikipedia.org/>; schema:name ?dewiki_name .
    OPTIONAL {
      ?item wdt:P373 ?wikidata_P373 .
    }
    OPTIONAL {
      ?wikidata_commons_sitelink schema:about ?item; schema:isPartOf <https://commons.wikimedia.org/>; schema:name ?wikidata_commonslink .
    }
  }
  BIND(IF(BOUND(?wikidata_commonslink) && ?dewiki_commonslink = ?wikidata_P373, 'same', 'different') AS ?diff_de_wd) .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?dewiki_commonslink"):::projected v1("?dewiki_name"):::projected v3("?dewiki_sitelink"):::projected v8("?diff_de_wd"):::projected v4("?item"):::projected v5("?wikidata_P373"):::projected v6("?wikidata_commons_sitelink") v7("?wikidata_commonslink"):::projected c3([https://de.wikipedia.org/]):::iri c6([https://commons.wikimedia.org/]):::iri bind0[/VALUES ?dewiki_commonslink ?dewiki_name/] bind0-->v1 bind0-->v2 bind00([sAlbert Miller (Politiker)^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>"]) bind00 --> bind0 bind01(["Albert Miller (Politiker)"]) bind01 --> bind0 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."schema:about".-> v4 v3 --"schema:isPartOf"--> c3 v3 --"schema:name"--> v1 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v4 -."wdt:P373".-> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."schema:about".-> v4 v6 --"schema:isPartOf"--> c6 v6 --"schema:name"--> v7 end end bind1[/"if(bound(?wikidata_commonslink)?dewiki_commonslink = ?wikidata_P373,'same','different')"/] v7 --o bind1 v2 --o bind1 v5 --o bind1 bind1 --as--o v8