query-500b023091347b6baea12925c46bd75c

rq turtle/ttl

Propertiesinstance of (P31)publisher (P123)title (P1476)published in (P1433)corrigendum / erratum (P2507)

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?title ?item2 ?item2Label ?journalLabel 
WHERE {
   {
  SELECT DISTINCT ?journal WHERE {
    ?journal wdt:P31 wd:Q5633421; # scientific journal
             wdt:P123 wd:Q180419; # published by Nature Portfolio
             wdt:P1476 ?jtitle.
    FILTER ( STRSTARTS(?jtitle, "Nature") ) . # with name starting with "Nature"
  }
}  FILTER (?journal != wd:Q24908540) . # Short article titles in this journal causing problems
  ?item wdt:P31 wd:Q1348305;
        wdt:P1433 ?journal;
        wdt:P1476 ?title.
  FILTER (STRSTARTS(?title, 'Author Correction: ')). # also seen: "Publisher Correction: ", "Erratum: "
  BIND(REPLACE(?title, "^Author Correction: (.*)$", "$1") AS ?substring) # extract title of original article
  ?item2 wdt:P1476 ?substring. # title matching (case sensitive!) 
  FILTER ( NOT EXISTS { ?item2 wdt:P2507 ?item } ) # not already linked as a corrigendum 
#  ?item2 wdt:P1433 ?journal2.   # Trying to ensure that article is in same journal, as sanity check
#  FILTER (?journal = ?journal2) # Why does this time out?
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". 
    ?item2 rdfs:label ?item2Label .
    ?journal rdfs:label ?journalLabel .
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v1("?item2"):::projected v7("?item2Label"):::projected v4("?journal") v8("?journalLabel"):::projected v5("?jtitle") v6("?substring") v3("?title"):::projected c10(["wd:Q1348305"]):::iri c8(["wd:Q180419"]):::iri c6(["wd:Q5633421"]):::iri c13(["bd:serviceParam"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P2507"--> e0v2 e0v2("?item"):::projected e0v1("?item2"):::projected end f0--EXISTS--> f0e0 f0 --> v1 f0 --> c1 f0 --> v2 v1 --"wdt:P2507"--> v2 f1[["starts-with(?title,'Author Correction: ')"]] f1 --> v3 f2[["?journal != 'wd:Q24908540'"]] f2 --> v4 f3[["starts-with(?jtitle,'Nature')"]] f3 --> v5 v4 --"wdt:P31"--> c6 v4 --"wdt:P123"--> c8 v4 --"wdt:P1476"--> v5 v2 --"wdt:P31"--> c10 v2 --"wdt:P1433"--> v4 v2 --"wdt:P1476"--> v3 bind4[/"replace(?title,'^Author Correction: (.*)$','$1')"/] v3 --o bind4 bind4 --as--o v6 v1 --"wdt:P1476"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 v1 --"rdfs:label"--> v7 v4 --"rdfs:label"--> v8 end