Project:SPARQL/examples: Difference between revisions

Line 78: Line 78:
</sparql>
</sparql>


===People whose elections were proposed to SAL or RAI, including who proposed them for election (seperated by type) and date proposals made===
===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 bn: <http://beyond-notability.wiki.opencura.com/entity/>
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 ?SALproposedLabel ?date WHERE
{
{
   ?person ?y ?z .
  {
   ?person bnwdt:P3 ?gender . #this line is a crude hack for 'is person'
  ?person bnwdt:P3 bnwd:Q3 .
   ?z bnpq:P1 ?date .
   ?person bnp:P16 ?SALstatement .
    {?person bnwdt:P7 ?RAIproposed .}
  ?SALstatement bnps:P16 ?SALproposed .
    UNION
   ?SALstatement bnpq:P32 ?SALsignatory .
    {?person bnwdt:P16 ?SALproposed .}
   ?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 ?person
ORDER BY ?date
# per https://twitter.com/Tagishsimon/status/1445127301306490891, I (James) and aware that this is a hack of the datamodel that isn't using the datamodel to full effect.
# 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>


6,317

edits