query-a56182e8de7aac33fc71254f3c57631d
TODO
Use at
- https://query.wikidata.org/sparql
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#>
SELECT distinct ?errata ?errataLabel ?itemLabel ?item (count(?item) as ?count)
WHERE
{
?errata wdt:P31 wd:Q1348305 . # ?errata is an errata
filter not exists {?itemZ wdt:P2507 ?errata . } # there's no ?item pointing to the errata.
?errata rdfs:label ?errataLabel . filter(lang(?errataLabel)="en")
filter(strstarts(?errataLabel,"Erratum:"))
bind(replace(?errataLabel,"Erratum: ","") as ?itemLabel) .
?item rdfs:label ?itemLabel.
filter(strlen(?itemLabel)>20)
?errata wdt:P1433 ?PI .
?item wdt:P1433 ?PI .
# ?errata wdt:P50 ?nn .
# ?item wdt:P50 ?nn .
# ?errata wdt:P2093 ?nn2 .
# ?item wdt:P2093 ?nn2 .
} group by ?errata ?errataLabel ?itemLabel ?item having (?count=1)
Query found at
- https://www.wikidata.org/wiki/User:Trilotat/SPARQL
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2019/01
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?PI")
v8("?count")
v5("?errata"):::projected
v3("?errataLabel"):::projected
v6("?item"):::projected
v6("?itemLabel"):::projected
v4("?itemZ")
c7(["wd:Q1348305"]):::iri
f0[["?count = '1^^xsd:integer'"]]
f0 --> v8
f1[["string-length(?itemLabel) > '20^^xsd:integer'"]]
f1 --> v6
f2[["starts-with(?errataLabel,'Erratum:')"]]
f2 --> v3
f3[["?errataLabel = 'en'"]]
f3 --> v3
f4[["not "]]
subgraph f4e0["Exists Clause"]
e0v1 --"wdt:P2507"--> e0v2
e0v2("?errata"):::projected
e0v1("?itemZ"):::projected
end
f4--EXISTS--> f4e0
f4 --> v4
f4 --> c5
f4 --> v5
v4 --"wdt:P2507"--> v5
v5 --"wdt:P31"--> c7
v5 --"rdfs:label"--> v3
bind5[/"replace(?errataLabel,'Erratum: ','')"/]
v3 --o bind5
bind5 --as--o v6
v6 --"rdfs:label"--> v6
v5 --"wdt:P1433"--> v7
v6 --"wdt:P1433"--> v7
bind7[/"count(?item)"/]
v6 --o bind7
bind7 --as--o v8