query-d1b4330ee171f7a2956bed86619fb674
persons surnames 21 jun
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?surname ?a ?b ?c ?d ?surnameLabel ?commcat ?person ?personLabel ?familyLabel
{
{ ?surname wdt:P31 ?family . }
{ ?surname wdt:P31 wd:Q101352 . } #/wdt:P279*
{ ?surname rdfs:label ?label FILTER(lang(?label) = 'en') . }
filter (regex (?label , "^.*" ))
# minus { ?commsu schema:about ?surname ; schema:isPartOf <https://commons.wikimedia.org/> . }
# { ?surname wdt:P407 wd:Q9043 . } # lingua norway
filter not exists { ?surname wdt:P373 ?commcat . }
{ ?commper schema:about ?person ; schema:isPartOf <https://commons.wikimedia.org/> . }
{ ?person wdt:P569 ?birth . } # birth date
#g { ?person wdt:P570 ?death . } # death date
{ ?person wdt:P31 wd:Q5 . } # é pessoa
{ ?person wdt:P734 ?surname . } union # tem famyli name <======
{ ?person wdt:P1950 ?surname . } union # tem second famyli name <======
{ ?person wdt:P9139 ?surname . } # tem first famyli name <======
# ?person wdt:P27 wd:Q183 . # pais ou continente ortugal # /wdt:P361*
# ?person wdt:P21 wd:Q6581072 . # mulher
# ?person wdt:P373 ?commcatper . # comm cat
# ?person wdt:P18 ?image . # comm cat
#???????
# tell the optimizer that fields doesn’t mix dates, strings, integers or other data types, which simplifies the range comparison
#g FILTER (?death < "1900-01-01"^^xsd:dat) # death 3N 65 act
#g FILTER (?death > "1900-01-01"^^xsd:date && ?death < "1950-01-01"^^xsd:dat) # death 4N 72 act
#g FILTER (?death > "1950-01-01"^^xsd:date && ?death < "2024-01-01"^^xsd:dat) # birth 0N 106 act
#g FILTER (?birth < "1900-01-01"^^xsd:dat) # birth 7N 175 act
FILTER (?birth > "1900-01-01"^^xsd:date && ?birth < "1950-01-01"^^xsd:dat) # birth 0N act
#g FILTER (?birth > "1950-01-01"^^xsd:date && ?birth < "2024-01-01"^^xsd:dat) # birth 1N act
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?birth")
v3("?commcat"):::projected
v6("?commper")
v5("?family")
v4("?label")
v7("?person"):::projected
v2("?surname"):::projected
c6(["wd:Q101352"]):::iri
c11([https://commons.wikimedia.org/]):::iri
c7(["en"]):::literal
c18(["bd:serviceParam"]):::iri
c13(["wd:Q5"]):::iri
f0[["?birth > '1900-01-01^^xsd:date'?birth < s1950-01-01^^<http://www.w3.org/2001/XMLSchema#dat>'"]]
f0 --> v1
f1[["not "]]
subgraph f1e0["Exists Clause"]
e0v1 --"wdt:P373"--> e0v2
e0v2("?commcat"):::projected
e0v1("?surname"):::projected
end
f1--EXISTS--> f1e0
f1 --> v2
f1 --> c3
f1 --> v3
v2 --"wdt:P373"--> v3
f2[["regex(?label,'^.*')"]]
f2 --> v4
v2 --"wdt:P31"--> v5
v2 --"wdt:P31"--> c6
f3[["?label = 'en'"]]
f3 --> v4
v2 --"rdfs:label"--> v4
v6 --"schema:about"--> v7
v6 --"schema:isPartOf"--> c11
v7 --"wdt:P569"--> v1
v7 --"wdt:P31"--> c13
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;
v7 --"wdt:P9139"--> v2
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v7 --"wdt:P1950"--> v2
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v7 --"wdt:P734"--> v2
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c18 --"wikibase:language"--> c7
end