query-263266dde15121b7e42358882b613caa

rq turtle/ttl

14:01, 15 December 2022 (UTC) pagetalk / TomT0m author (the optimiser needs to be hinted that "wikibase:sitelinks" is a way to big predicate to start with when there is several value, otherwise it timeouts) 17:05, 15 December 2022 (UTC)) talk (Geagea the ons that are redirect. or b. simply give me the ones that are not redirect. ora. in two columns. the original Q id and the redirect Q id . But the point is that I need also the original Q. I need that the output be:https://w.wiki/67Sp thanks. I have tried also TomT0m@ May I ask what you want to do with that in the end ? Geagea@I’m not sure I understand very well your needs, so it might be simpler if you gave your end goal, potentially it would save time to us all if there is a more direct solution you did not thought about, and would save us all headeaches :) But if I understood well this is what you seem to be looking for, just add a column to my query

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
select ?candidate ?item {
  #
  values ?candidate {
    # replace with your list of item
   wd:Q5991982 #redirect to Q488
    wd:Q488 
    wd:Q13055412 #redirect to Q1008
    wd:Q19747477 #redirect to Q1008
    wd:Q19746706 #redirect to Q1008
  } 
  ?candidate owl:sameAs? ?item.
  ?item wikibase:sitelinks ?nb . 
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?candidate"):::projected v2("?item"):::projected v3("?nb") bind0[/VALUES ?candidate/] bind0-->v1 bind00(["wd:Q5991982"]) bind00 --> bind0 bind01(["wd:Q488"]) bind01 --> bind0 bind02(["wd:Q13055412"]) bind02 --> bind0 bind03(["wd:Q19747477"]) bind03 --> bind0 bind04(["wd:Q19746706"]) bind04 --> bind0 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v1 --"owl:sameAs"--> v2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; end union0r <== or ==> union0l end v2 --"wikibase:sitelinks"--> v3