Project:SPARQL/examples: Difference between revisions
From Beyond Notability
Line 78: | Line 78: | ||
</sparql> | </sparql> | ||
===People whose elections were proposed to SAL or RAI, including who proposed | ===People whose elections were proposed to SAL or RAI, including who proposed, seconded, or signed their proposal for election (seperated by type) and the date the proposals were made=== | ||
<sparql tryit="1"> | <sparql tryit="1"> | ||
PREFIX | PREFIX bnwd: <http://beyond-notability.wiki.opencura.com/entity/> | ||
PREFIX bnwds: <http://beyond-notability.wiki.opencura.com/entity/statement/> | |||
PREFIX bnwdv: <http://beyond-notability.wiki.opencura.com/value/> | |||
PREFIX bnwdt: <http://beyond-notability.wiki.opencura.com/prop/direct/> | PREFIX bnwdt: <http://beyond-notability.wiki.opencura.com/prop/direct/> | ||
PREFIX bnp: <http://beyond-notability.wiki.opencura.com/prop/> | |||
PREFIX bnps: <http://beyond-notability.wiki.opencura.com/prop/statement/> | PREFIX bnps: <http://beyond-notability.wiki.opencura.com/prop/statement/> | ||
PREFIX bnpq: <http://beyond-notability.wiki.opencura.com/prop/qualifier/> | PREFIX bnpq: <http://beyond-notability.wiki.opencura.com/prop/qualifier/> | ||
SELECT ?personLabel ?SALproposedLabel ?SALsignatoryLabel ?RAIproposedLabel ?RAIsecondedLabel ?date WHERE | |||
SELECT ?personLabel ?RAIproposedLabel ? | |||
{ | { | ||
?person ? | { | ||
? | ?person bnwdt:P3 bnwd:Q3 . | ||
? | ?person bnp:P16 ?SALstatement . | ||
?SALstatement bnps:P16 ?SALproposed . | |||
?SALstatement bnpq:P32 ?SALsignatory . | |||
?SALstatement bnpq:P1 ?date . | |||
} | |||
UNION | |||
{ | |||
?person bnwdt:P3 bnwd:Q3 . | |||
?person bnp:P7 ?RAIstatement . | |||
?RAIstatement bnps:P7 ?RAIproposed . | |||
OPTIONAL {?RAIstatement bnpq:P8 ?RAIseconded .} | |||
?RAIstatement bnpq:P1 ?date . | |||
} | |||
SERVICE wikibase:label { | SERVICE wikibase:label { | ||
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". | bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". | ||
} | } | ||
} | } | ||
ORDER BY ? | ORDER BY ?date | ||
# | # I only got how to do this when I read https://wdqs-tutorial.toolforge.org/index.php/category/simple-queries/qualifiers/ Huge thanks to @Tagishsimon for pointing out my error and forcing me to do it properly :) | ||
</sparql> | </sparql> | ||