Project:SPARQL/examples: Difference between revisions
From Beyond Notability
(→People) |
|||
Line 658: | Line 658: | ||
ORDER BY ?personLabel | ORDER BY ?personLabel | ||
</sparql> | </sparql> | ||
=== Women with family name at birth, married name and count of married names=== | |||
# Women with their family name at birth, family name after marriage and count of married names | |||
<sparql tryit="1"> | |||
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/> | |||
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/> | |||
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/> | |||
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/> | |||
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/> | |||
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/> | |||
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | |||
SELECT ?person ?personLabel ?birthname | |||
(GROUP_CONCAT(DISTINCT ?marriedname; SEPARATOR=", ") AS ?marriednames) | |||
(COUNT(?marriedname) AS ?marriedcount) | |||
WHERE { | |||
?person bnwdt:P3 bnwd:Q3 . #select women | |||
FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team | |||
OPTIONAL {?person bnwdt:P140 ?birthname .} #look for birth name | |||
OPTIONAL {?person bnwdt:P141 ?marriedname .} #look for married name | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,en-gb". } | |||
} | |||
group by ?person ?personLabel ?birthname | |||
ORDER BY ?personLabel | |||
</sparql> | |||
===Where women in our data are in wikidata, their spouses, fathers, and mothers according to wikidata=== | ===Where women in our data are in wikidata, their spouses, fathers, and mothers according to wikidata=== |