query-e3fd116c44f4d43676e8c0135c871207
by CamelCaseNick prefix commons:http://commons.wikimedia.org/wiki/Special:FilePath/
select (?stolperstein as ?item) ?nameImage ?addressImage ?quarterImage with { select distinct ?stolperstein ?nameImage ?addressImage ?quarterImage where { ?stolperstein wdt:P31 wd:Q26703203; wdt:P131+ wd:Q1055; wdt:P18 ?image.
bind(wikibase:decodeUri(replace(str(?image), str(commons:), "")) as ?title)
values (?nameGroup ?addressGroup ?quarterGroup ?regex) {
("$1" "$2" "$3" "^((?:[\\p{L}\\d\\.]+[\\- ])*[\\p{L}\\d]+) ?[\\-–] ((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: \\d+(?:[a-z]| ?[\\-–] ?\\d+)?)?)) \\(([\\p{L}\\- \\.]+)\\)(?:\\.| )Stolperstein(e| 20\\d{2}|\\-\\d{4}\\-\\d{2}\\-\\d{2})?(\\.\\d+)?(\\.(nnw|(crop\\.)?ajb|ccn))?\\.jpg$")
("$2" "$1" "$3" "^(?:Stolpersteine? )?((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: ?\\d+(?: ?[a-zA-Z]|[\\-–]\\d+)?)?)) \\( *((?:[\\p{L}\\d]+[\\-\\.,]? ?)*[\\p{L}\\d]+) *\\)(?: ?[Ii]n)? ([\\p{L}\\. \\-]+?)(?: ?\\(\\d+\\)| ?\\d+)?(?: ShiftN)?\\.(jpg|JPG)$")
}
filter(regex(?title, ?regex))
bind(replace(?title, ?regex, ?nameGroup) as ?nameImage)
bind(replace(?title, ?regex, ?addressGroup) as ?addressImage)
bind(replace(?title, ?regex, ?quarterGroup) as ?quarterImage)
} } as %matches with { select ?stolperstein ?nameImage ?addressImage ?quarterImage where { include %matches.
filter exists {
?stolperstein skos:altLabel|rdfs:label ?alias.
filter(lang(?alias) = "de")
filter(regex(?alias, "Stolperstein für (?!den|die|das)"))
filter(?alias = strlang(concat("Stolperstein für ", ?nameImage), "de"))
}
filter exists {
?stolperstein p:P6375/ps:P6375 ?address.
filter(regex(?address, "^((\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?( \\d+( [a-z])?(( – |/)\\d+( [a-z])?)?)?), \\d{5} Hamburg$"))
bind(replace(?address, "^((\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?( \\d+( [a-z])?(( – |/)\\d+( [a-z])?)?)?), \\d{5} Hamburg$", "$1") as ?addr)
filter(?addr = strlang(?addressImage, "de"))
}
filter exists {
?stolperstein p:P276/ps:P276 ?quarter.
?quarter wdt:P31 wd:Q15830667;
skos:altLabel|rdfs:label ?alias.
filter(lang(?alias) = "de")
filter(?alias = strlang(replace(?quarterImage, "Hamburg ", "Hamburg-"), "de"))
}
} } as %perfect where { include %matches. minus { include %perfect. } }
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
#by CamelCaseNick
prefix commons:<http://commons.wikimedia.org/wiki/Special:FilePath/>
select (?stolperstein as ?item) ?nameImage ?addressImage ?quarterImage where {
{
select distinct ?stolperstein ?nameImage ?addressImage ?quarterImage where {
?stolperstein wdt:P31 wd:Q26703203;
wdt:P131+ wd:Q1055;
wdt:P18 ?image.
bind(wikibase:decodeUri(replace(str(?image), str(commons:), "")) as ?title)
values (?nameGroup ?addressGroup ?quarterGroup ?regex) {
("$1" "$2" "$3" "^((?:[\\p{L}\\d\\.]+[\\- ])*[\\p{L}\\d]+) ?[\\-–] ((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: \\d+(?:[a-z]| ?[\\-–] ?\\d+)?)?)) \\(([\\p{L}\\- \\.]+)\\)(?:\\.| )Stolperstein(e| 20\\d{2}|\\-\\d{4}\\-\\d{2}\\-\\d{2})?(\\.\\d+)?(\\.(nnw|(crop\\.)?ajb|ccn))?\\.jpg$")
("$2" "$1" "$3" "^(?:Stolpersteine? )?((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: ?\\d+(?: ?[a-zA-Z]|[\\-–]\\d+)?)?)) \\( *((?:[\\p{L}\\d]+[\\-\\.,]? ?)*[\\p{L}\\d]+) *\\)(?: ?[Ii]n)? ([\\p{L}\\. \\-]+?)(?: ?\\(\\d+\\)| ?\\d+)?(?: ShiftN)?\\.(jpg|JPG)$")
}
filter(regex(?title, ?regex))
bind(replace(?title, ?regex, ?nameGroup) as ?nameImage)
bind(replace(?title, ?regex, ?addressGroup) as ?addressImage)
bind(replace(?title, ?regex, ?quarterGroup) as ?quarterImage)
}
}
minus {
{
select ?stolperstein ?nameImage ?addressImage ?quarterImage where {
{
select distinct ?stolperstein ?nameImage ?addressImage ?quarterImage where {
?stolperstein wdt:P31 wd:Q26703203;
wdt:P131+ wd:Q1055;
wdt:P18 ?image.
bind(wikibase:decodeUri(replace(str(?image), str(commons:), "")) as ?title)
values (?nameGroup ?addressGroup ?quarterGroup ?regex) {
("$1" "$2" "$3" "^((?:[\\p{L}\\d\\.]+[\\- ])*[\\p{L}\\d]+) ?[\\-–] ((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: \\d+(?:[a-z]| ?[\\-–] ?\\d+)?)?)) \\(([\\p{L}\\- \\.]+)\\)(?:\\.| )Stolperstein(e| 20\\d{2}|\\-\\d{4}\\-\\d{2}\\-\\d{2})?(\\.\\d+)?(\\.(nnw|(crop\\.)?ajb|ccn))?\\.jpg$")
("$2" "$1" "$3" "^(?:Stolpersteine? )?((?:(?:\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?(?: ?\\d+(?: ?[a-zA-Z]|[\\-–]\\d+)?)?)) \\( *((?:[\\p{L}\\d]+[\\-\\.,]? ?)*[\\p{L}\\d]+) *\\)(?: ?[Ii]n)? ([\\p{L}\\. \\-]+?)(?: ?\\(\\d+\\)| ?\\d+)?(?: ShiftN)?\\.(jpg|JPG)$")
}
filter(regex(?title, ?regex))
bind(replace(?title, ?regex, ?nameGroup) as ?nameImage)
bind(replace(?title, ?regex, ?addressGroup) as ?addressImage)
bind(replace(?title, ?regex, ?quarterGroup) as ?quarterImage)
}
}
filter exists {
?stolperstein skos:altLabel|rdfs:label ?alias.
filter(lang(?alias) = "de")
filter(regex(?alias, "Stolperstein für (?!den|die|das)"))
filter(?alias = strlang(concat("Stolperstein für ", ?nameImage), "de"))
}
filter exists {
?stolperstein p:P6375/ps:P6375 ?address.
filter(regex(?address, "^((\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?( \\d+( [a-z])?(( – |/)\\d+( [a-z])?)?)?), \\d{5} Hamburg$"))
bind(replace(?address, "^((\\p{L}+\\.?[ \\-/])*\\p{L}+\\.?( \\d+( [a-z])?(( – |/)\\d+( [a-z])?)?)?), \\d{5} Hamburg$", "$1") as ?addr)
filter(?addr = strlang(?addressImage, "de"))
}
filter exists {
?stolperstein p:P276/ps:P276 ?quarter.
?quarter wdt:P31 wd:Q15830667;
skos:altLabel|rdfs:label ?alias.
filter(lang(?alias) = "de")
filter(?alias = strlang(replace(?quarterImage, "Hamburg ", "Hamburg-"), "de"))
}
}
}
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v15("?addr")
v14("?address")
v15("?addressGroup")
v15("?addressImage"):::projected
v11("?alias")
v4("?image")
v15("?item")
v15("?nameGroup")
v15("?nameImage"):::projected
v12("?quarter")
v15("?quarterGroup")
v15("?quarterImage"):::projected
v15("?regex")
v3("?stolperstein"):::projected
v15("?title")
a2((" "))
a1((" "))
c11(["wd:Q15830667"]):::iri
c2(["wd:Q26703203"]):::iri
c4(["wd:Q1055"]):::iri
f0[["regex(?title,?regex)"]]
f0 --> v15
f0 --> v15
v3 --"p:direct/P31"--> c2
v3 --"p:direct/P131"--> c4
v3 --"p:direct/P18"--> v4
bind1[/"http://wikiba.se/ontology#decodeUri(replace(str(?image),str(http://commons.wikimedia.org/wiki/Special:FilePath/),''))"/]
v4 --o bind1
bind1 --as--o v15
bind2[/VALUES ?addressGroup ?nameGroup ?quarterGroup ?regex/]
bind2-->v15
bind2-->v15
bind2-->v15
bind2-->v15
bind20(["$1"])
bind20 --> bind2
bind21(["$2"])
bind21 --> bind2
bind22(["$3"])
bind22 --> bind2
bind23(["^((?:#91;\p{L}\d\.#93;+#91;\- #93;)*#91;\p{L}\d#93;+) ?#91;\-–#93; ((?:(?:\p{L}+\.?#91; \-/#93;)*\p{L}+\.?(?: \d+(?:#91;a-z#93;| ?#91;\-–#93; ?\d+)?)?)) \((#91;\p{L}\- \.#93;+)\)(?:\.| )Stolperstein(e| 20\d{2}|\-\d{4}\-\d{2}\-\d{2})?(\.\d+)?(\.(nnw|(crop\.)?ajb|ccn))?\.jpg$"])
bind23 --> bind2
bind24(["$2"])
bind24 --> bind2
bind25(["$1"])
bind25 --> bind2
bind26(["$3"])
bind26 --> bind2
bind27(["^(?:Stolpersteine? )?((?:(?:\p{L}+\.?#91; \-/#93;)*\p{L}+\.?(?: ?\d+(?: ?#91;a-zA-Z#93;|#91;\-–#93;\d+)?)?)) \( *((?:#91;\p{L}\d#93;+#91;\-\.,#93;? ?)*#91;\p{L}\d#93;+) *\)(?: ?#91;Ii#93;n)? (#91;\p{L}\. \-#93;+?)(?: ?\(\d+\)| ?\d+)?(?: ShiftN)?\.(jpg|JPG)$"])
bind27 --> bind2
bind3[/"replace(?title,?regex,?nameGroup)"/]
v15 --o bind3
v15 --o bind3
v15 --o bind3
bind3 --as--o v15
bind4[/"replace(?title,?regex,?addressGroup)"/]
v15 --o bind4
v15 --o bind4
v15 --o bind4
bind4 --as--o v15
bind5[/"replace(?title,?regex,?quarterGroup)"/]
v15 --o bind5
v15 --o bind5
v15 --o bind5
bind5 --as--o v15
subgraph minus6["MINUS"]
style minus6 stroke-width:6px,fill:pink,stroke:red;
f7[[" "]]
subgraph f7e0["Exists Clause"]
e0f0[["?alias = STRLANG(replace(?quarterImage,'Hamburg ','Hamburg-'),'de')"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0f1[["?alias = 'de'"]]
e0f1 --> e0v1
e0v3 --"p:P276"--> e0a1
e0a1 --"p:statement/P276"--> e0v4
e0v4 --"p:direct/P31"--> e0c7
subgraph unione00[" Union "]
subgraph unione00l[" "]
style unione00l fill:#abf,stroke-dasharray: 3 3;
e0v4 --"rdfs:label"--> e0v1
end
subgraph unione00r[" "]
style unione00r fill:#abf,stroke-dasharray: 3 3;
e0v4 --"skos:altLabel"--> e0v1
end
unione00r <== or ==> unione00l
end
e0v1("?alias"):::projected
e0v4("?quarter"):::projected
e0v2("?quarterImage"):::projected
e0v3("?stolperstein"):::projected
e0a1((" ")):::projected
e0c7(["wd:Q15830667"]):::iri
end
f7--EXISTS--> f7e0
f7 --> v11
f7 --> v15
f7 --> v3
f7 --> c9
f7 --> a1
f7 --> c10
f7 --> v12
f7 --> c1
f7 --> c11
f7 --> c12
f7 --> c13
f8[["?alias = STRLANG(replace(?quarterImage,'Hamburg ','Hamburg-'),'de')"]]
f8 --> v11
f8 --> v15
f9[["?alias = 'de'"]]
f9 --> v11
v3 --"p:P276"--> a1
a1 --"p:statement/P276"--> v12
v12 --"p:direct/P31"--> c11
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v12 --"rdfs:label"--> v11
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v12 --"skos:altLabel"--> v11
end
union0r <== or ==> union0l
end
f10[[" "]]
subgraph f10e1["Exists Clause"]
e1f0[["?addr = STRLANG(?addressImage,'de')"]]
e1f0 --> e1v5
e1f0 --> e1v2
e1f1[["regex(?address,'^((\p{L}+\.?#91; \-/#93;)*\p{L}+\.?( \d+( #91;a-z#93;)?(( – |/)\d+( #91;a-z#93;)?)?)?), \d{5} Hamburg$')"]]
e1f1 --> e1v3
e1v4 --"p:P6375"--> e1a1
e1a1 --"p:statement/P6375"--> e1v3
e1bind2[/"replace(?address,'^((\p{L}+\.?#91; \-/#93;)*\p{L}+\.?( \d+( #91;a-z#93;)?(( – |/)\d+( #91;a-z#93;)?)?)?), \d{5} Hamburg$','$1')"/]
e1v3 --o e1bind2
e1bind2 --as--o e1v5
e1v5("?addr"):::projected
e1v3("?address"):::projected
e1v2("?addressImage"):::projected
e1v4("?stolperstein"):::projected
e1a1((" ")):::projected
end
f10--EXISTS--> f10e1
f10 --> v15
f10 --> v15
f10 --> v14
f10 --> v3
f10 --> c15
f10 --> a2
f10 --> c16
f11[["?addr = STRLANG(?addressImage,'de')"]]
f11 --> v15
f11 --> v15
f12[["regex(?address,'^((\p{L}+\.?#91; \-/#93;)*\p{L}+\.?( \d+( #91;a-z#93;)?(( – |/)\d+( #91;a-z#93;)?)?)?), \d{5} Hamburg$')"]]
f12 --> v14
v3 --"p:P6375"--> a2
a2 --"p:statement/P6375"--> v14
bind13[/"replace(?address,'^((\p{L}+\.?#91; \-/#93;)*\p{L}+\.?( \d+( #91;a-z#93;)?(( – |/)\d+( #91;a-z#93;)?)?)?), \d{5} Hamburg$','$1')"/]
v14 --o bind13
bind13 --as--o v15
f14[[" "]]
subgraph f14e2["Exists Clause"]
e2f0[["?alias = STRLANG(concat('Stolperstein für ',?nameImage),'de')"]]
e2f0 --> e2v1
e2f0 --> e2v2
e2f1[["regex(?alias,'Stolperstein für (?!den|die|das)')"]]
e2f1 --> e2v1
e2f2[["?alias = 'de'"]]
e2f2 --> e2v1
subgraph unione20[" Union "]
subgraph unione20l[" "]
style unione20l fill:#abf,stroke-dasharray: 3 3;
e2v3 --"rdfs:label"--> e2v1
end
subgraph unione20r[" "]
style unione20r fill:#abf,stroke-dasharray: 3 3;
e2v3 --"skos:altLabel"--> e2v1
end
unione20r <== or ==> unione20l
end
e2v1("?alias"):::projected
e2v2("?nameImage"):::projected
e2v3("?stolperstein"):::projected
end
f14--EXISTS--> f14e2
f14 --> v11
f14 --> v15
f14 --> v3
f14 --> c12
f14 --> c13
f15[["?alias = STRLANG(concat('Stolperstein für ',?nameImage),'de')"]]
f15 --> v11
f15 --> v15
f16[["regex(?alias,'Stolperstein für (?!den|die|das)')"]]
f16 --> v11
f17[["?alias = 'de'"]]
f17 --> v11
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v3 --"rdfs:label"--> v11
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"skos:altLabel"--> v11
end
union1r <== or ==> union1l
end
f18[["regex(?title,?regex)"]]
f18 --> v15
f18 --> v15
v3 --"p:direct/P31"--> c2
v3 --"p:direct/P131"--> c4
v3 --"p:direct/P18"--> v4
bind19[/"http://wikiba.se/ontology#decodeUri(replace(str(?image),str(http://commons.wikimedia.org/wiki/Special:FilePath/),''))"/]
v4 --o bind19
bind19 --as--o v15
bind20[/VALUES ?addressGroup ?nameGroup ?quarterGroup ?regex/]
bind20-->v15
bind20-->v15
bind20-->v15
bind20-->v15
bind200(["$1"])
bind200 --> bind20
bind201(["$2"])
bind201 --> bind20
bind202(["$3"])
bind202 --> bind20
bind203(["^((?:#91;\p{L}\d\.#93;+#91;\- #93;)*#91;\p{L}\d#93;+) ?#91;\-–#93; ((?:(?:\p{L}+\.?#91; \-/#93;)*\p{L}+\.?(?: \d+(?:#91;a-z#93;| ?#91;\-–#93; ?\d+)?)?)) \((#91;\p{L}\- \.#93;+)\)(?:\.| )Stolperstein(e| 20\d{2}|\-\d{4}\-\d{2}\-\d{2})?(\.\d+)?(\.(nnw|(crop\.)?ajb|ccn))?\.jpg$"])
bind203 --> bind20
bind204(["$2"])
bind204 --> bind20
bind205(["$1"])
bind205 --> bind20
bind206(["$3"])
bind206 --> bind20
bind207(["^(?:Stolpersteine? )?((?:(?:\p{L}+\.?#91; \-/#93;)*\p{L}+\.?(?: ?\d+(?: ?#91;a-zA-Z#93;|#91;\-–#93;\d+)?)?)) \( *((?:#91;\p{L}\d#93;+#91;\-\.,#93;? ?)*#91;\p{L}\d#93;+) *\)(?: ?#91;Ii#93;n)? (#91;\p{L}\. \-#93;+?)(?: ?\(\d+\)| ?\d+)?(?: ShiftN)?\.(jpg|JPG)$"])
bind207 --> bind20
bind21[/"replace(?title,?regex,?nameGroup)"/]
v15 --o bind21
v15 --o bind21
v15 --o bind21
bind21 --as--o v15
bind22[/"replace(?title,?regex,?addressGroup)"/]
v15 --o bind22
v15 --o bind22
v15 --o bind22
bind22 --as--o v15
bind23[/"replace(?title,?regex,?quarterGroup)"/]
v15 --o bind23
v15 --o bind23
v15 --o bind23
bind23 --as--o v15
end
bind24[/"?stolperstein"/]
v3 --o bind24
bind24 --as--o v15