query-4eb05655c1660baf1f7963e6bf886751
Editing a query to include results with curly quotation marksI'm trying to match errata with their original articles. The team here has provided the following, but it's not providing some expected (hoped for) results. I was expecting to see Q107473026 but I think the “ (curly quotes - is that what they're called?) is creating a problem. They aren't the straight quotes as used in the query and I cannot seem to add them to the filter in the query. I would prefer to get results with: Correction to “Original Article“ Correction to "Original Article" Correction to (original)This one is really helpful, but can it be adjusted so that it provides the results with those pesky curly quotation marks?
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 ?errata ?errataLabel ?itemLabel ?item
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,"Correction to "))
bind(replace(?errataLabel,"Correction to ","") as ?itemLabel) .
?item rdfs:label ?itemLabel.
filter(strlen(?itemLabel)>20)
filter(?item != ?errata)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?errata"):::projected
v4("?errataLabel"):::projected
v1("?item"):::projected
v6("?itemLabel"):::projected
v5("?itemZ")
c6(["wd:Q1348305"]):::iri
f0[["?item != ?errata"]]
f0 --> v1
f0 --> v2
f1[["string-length(?itemLabel) > '20^^xsd:integer'"]]
f1 --> v6
f2[["starts-with(?errataLabel,'Correction to ')"]]
f2 --> v4
f3[["?errataLabel = 'en'"]]
f3 --> v4
f4[["not "]]
subgraph f4e0["Exists Clause"]
e0v1 --"wdt:P2507"--> e0v2
e0v2("?errata"):::projected
e0v1("?itemZ"):::projected
end
f4--EXISTS--> f4e0
f4 --> v5
f4 --> c4
f4 --> v2
v5 --"wdt:P2507"--> v2
v2 --"wdt:P31"--> c6
v2 --"rdfs:label"--> v4
bind5[/"replace(?errataLabel,'Correction to ','')"/]
v4 --o bind5
bind5 --as--o v6
v1 --"rdfs:label"--> v6