query-2b5710b9727eaa8c25ac74539762d613
procurar surnames wikidata (04Jul)
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/wdt:P279* wd:Q101352 . } #/wdt:P279*
{ ?surname rdfs:label ?label FILTER(lang(?label) = 'en') . }
#g filter (regex (?label , "^[A-B].*" )) # 7 act
#g filter (regex (?label , "^C.*" )) # 5 act
#g filter (regex (?label , "^D.*" )) # 4 act
#g filter (regex (?label , "^[A-E].*" )) # 0 act
#g filter (regex (?label , "^F.*" )) # 0 act
#g filter (regex (?label , "^G.*" )) # 2 act
#g filter (regex (?label , "^H.*" )) # 5 act
#g filter (regex (?label , "^I.*" )) # 1 act
#g filter (regex (?label , "^J.*" )) # 0 act
#g filter (regex (?label , "^K.*" )) # 4 act
#g filter (regex (?label , "^[L-N].*" )) # 12 act
#g filter (regex (?label , "^O.*" )) # 3 act
#g filter (regex (?label , "^[P-Q].*" )) # 4 act
#g filter (regex (?label , "^[R-T].*" )) # 11 act
#g filter (regex (?label , "^[U-Z].*" )) # 7 act
#g filter (regex (?label , "^[A-Z].*" )) # 64 act
# 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
# { ?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
#g FILTER (?birth > "1900-01-01"^^xsd:date && ?birth < "1950-01-01"^^xsd:dat) # birth 0N 97 act
#g FILTER (?birth > "1950-01-01"^^xsd:date && ?birth < "2024-01-01"^^xsd:dat) # birth 1N 235 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;
v7("?birth")
v2("?commcat"):::projected
v5("?commper")
v3("?family")
v4("?label")
v6("?person"):::projected
v1("?surname"):::projected
a1((" "))
c4(["wd:Q101352"]):::iri
c9([https://commons.wikimedia.org/]):::iri
c5(["en"]):::literal
c16(["bd:serviceParam"]):::iri
c11(["wd:Q5"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"wdt:P373"--> e0v2
e0v2("?commcat"):::projected
e0v1("?surname"):::projected
end
f0--EXISTS--> f0e0
f0 --> v1
f0 --> c1
f0 --> v2
v1 --"wdt:P373"--> v2
v1 --"wdt:P31"--> v3
v1 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
f1[["?label = 'en'"]]
f1 --> v4
v1 --"rdfs:label"--> v4
v5 --"schema:about"--> v6
v5 --"schema:isPartOf"--> c9
v6 --"wdt:P569"--> v7
v6 --"wdt:P31"--> c11
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;
v6 --"wdt:P9139"--> v1
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P1950"--> v1
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P734"--> v1
end
union0r <== or ==> union0l
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c16 --"wikibase:language"--> c5
end