Project:SPARQL/examples: Difference between revisions
From Beyond Notability
Line 1,322: | Line 1,322: | ||
<sparql tryit="1"> | <sparql tryit="1"> | ||
# Query for women living in (greater) london in the 1890s | #title:Women living in 1890s London | ||
# Query for women living in (greater) london in the 1890s | |||
# 1 row per person per address per date, could be reduced to 1 row per person if preferred. | # 1 row per person per address per date, could be reduced to 1 row per person if preferred. | ||
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/> | PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/> | ||
Line 1,331: | Line 1,332: | ||
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/> | PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/> | ||
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | ||
SELECT distinct ?personLabel | SELECT distinct ?personLabel ?date_label ?date ?person ?address ?address_item ?londonLabel ?geo ?long ?lat | ||
WHERE { | WHERE { | ||
?person bnwdt:P3 bnwd:Q3 . # women | ?person bnwdt:P3 bnwd:Q3 . # women | ||
?person bnp:P29 ?s . # resided at | ?person bnp:P29 ?s . # resided at | ||
?s bnps:P29 ? | ?s bnps:P29 ?london . | ||
? | ?london bnwdt:P33+ bnwd:Q322 . # in Q322 greater london. | ||
# optional street address (text) | |||
optional { | |||
?s bnpq:P31 ?address . | |||
} | |||
# optional street address (item) | |||
optional { | |||
?s bnpq:P100 ?address_item . | |||
} | |||
# dates. About 30? not dated. | # dates. About 30? not dated. | ||
#optional { | #optional { | ||
Line 1,362: | Line 1,372: | ||
BIND(geof:latitude(?geo) AS ?lat) | BIND(geof:latitude(?geo) AS ?lat) | ||
} | } | ||
# todo booth codes | # todo booth codes | ||