query-f824ee60fa0d805485df1232876cd142
TODO
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 bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?label ?output4 WHERE {
?item skos:altLabel ?label .
?item wdt:P31 wd:Q5.
# beroep = fotograaf of onderliggend
?item (wdt:P106/wdt:P279*) wd:Q3391743.
# nationality = Kingdom of the Netherlands
{?item wdt:P27 wd:Q29999}
# OR place of birth within Netherlands
UNION {?item wdt:P19 ?pob .
?pob wdt:P17 wd:Q55}
# OR work location within Netherlands
UNION {?item wdt:P937 ?pow .
?pow wdt:P17 wd:Q55}
# OR residency within Netherlands
UNION {?item wdt:P551 ?por .
?por wdt:P17 wd:Q55}
# OR place of death within Netherlands
UNION {?item wdt:P20 ?pod .
?pod wdt:P17 wd:Q55}
BIND(replace(?label,"([A-Z])[a-z\u0080-\uFFFF]+ (?:([A-Z])[a-z\u0080-\uFFFF]+ )?(?:([A-Z])[a-z\u0080-\uFFFF]+ )?(?:([A-Z])[a-z\u0080-\uFFFF]+ )?(.*)([A-Z][a-z\u0080-\uFFFF]+)$","$1.$2.$3.$4. $5$6") AS ?output) .
BIND(replace(?output,"[\\.]+",".") AS ?output2) .
BIND(replace(?output2,"([A-Z])\\.? ?([A-Z])\\.?(?: ?([A-Z])\\.?)? ","$1.$2.$3. ") AS ?output3) .
BIND(replace(?output3,"[\\.]+",".") AS ?output4) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "nl, en". }
FILTER((LANG(?label)) = "nl")
FILTER(REGEX(?label, "^[A-z]{3,}"))
FILTER(!REGEX(?label, "\\("))#geen altnamen met haakjes
FILTER NOT EXISTS {
?item skos:altLabel ?alt .
FILTER(REGEX(?alt, ?output4))#bestaat al
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?alt")
v3("?item"):::projected
v4("?label"):::projected
v9("?output")
v10("?output2")
v11("?output3")
v12("?output4"):::projected
v5("?pob")
v8("?pod")
v7("?por")
v6("?pow")
a1((" "))
c21(["nl, en"]):::literal
c9(["wd:Q3391743"]):::iri
c14(["wd:Q55"]):::iri
c11(["wd:Q29999"]):::iri
c19(["bd:serviceParam"]):::iri
c6(["wd:Q5"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0f0[["regex(?alt,?output4)"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"skos:altLabel"--> e0v1
e0v1("?alt"):::projected
e0v3("?item"):::projected
e0v2("?output4"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> v12
f0 --> v3
f0 --> c1
f1[["regex(?alt,?output4)"]]
f1 --> v1
f1 --> v12
v3 --"skos:altLabel"--> v1
f2[["not regex(?label,'\(')"]]
f2 --> v4
f3[["regex(?label,'^#91;A-z#93;{3,}')"]]
f3 --> v4
f4[["?label = 'nl'"]]
f4 --> v4
v3 --"skos:altLabel"--> v4
v3 --"wdt:P31"--> c6
v3 --"wdt:P106"--> a1
a1 --"wdt:P279"--> c9
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P20"--> v8
v8 --"wdt:P17"--> c14
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P551"--> v7
v7 --"wdt:P17"--> c14
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P937"--> v6
v6 --"wdt:P17"--> c14
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P19"--> v5
v5 --"wdt:P17"--> c14
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"wdt:P27"--> c11
end
union0r <== or ==> union0l
end
bind5[/"replace(?label,'(#91;A-Z#93;)#91;a-z-#93;+ (?:(#91;A-Z#93;)#91;a-z-#93;+ )?(?:(#91;A-Z#93;)#91;a-z-#93;+ )?(?:(#91;A-Z#93;)#91;a-z-#93;+ )?(.*)(#91;A-Z#93;#91;a-z-#93;+)$','$1.$2.$3.$4. $5$6')"/]
v4 --o bind5
bind5 --as--o v9
bind6[/"replace(?output,'#91;\.#93;+','.')"/]
v9 --o bind6
bind6 --as--o v10
bind7[/"replace(?output2,'(#91;A-Z#93;)\.? ?(#91;A-Z#93;)\.?(?: ?(#91;A-Z#93;)\.?)? ','$1.$2.$3. ')"/]
v10 --o bind7
bind7 --as--o v11
bind8[/"replace(?output3,'#91;\.#93;+','.')"/]
v11 --o bind8
bind8 --as--o v12
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c19 --"wikibase:language"--> c21
end