Project:SPARQL/examples: Difference between revisions

Line 287: Line 287:
}
}
ORDER BY ?personLabel
ORDER BY ?personLabel
</sparql>
===FSAs who didn't interact with SAL [in Q1 or Q8] apart from record of election ===
<sparql tryit="1">
#title: FSAs with no record of interacting with SAL in Q1 / Q8
# only active engagements like spoke at, corresponded with, etc, and excluding P75 "was fellow of" and P5 "archives at".
# WIP: to update with other SAL records as I work through queries for them. Plus caveat that there may be other sources of interaction not recorded in the database!
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/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>
SELECT distinct ?person ?personLabel
(if(bound(?sal), "yes", "no") as ?q1_q8_interaction)
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person bnwdt:P16 ?whatever . # FSAs
 
  # optional query FSAs who do have record of interaction.
  optional { 
    ?person ?p ?s .
 
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps.   
      # union query to get both q8 and q1  but *drop* fellow of q8 p75 and p5 q8 archives at (Q712; catalogue says archives bequeathed by another person)
      { ?s ?ps bnwd:Q8 . filter not exists { ?s (bnps:P75|bnps:P5) ?anything . } } 
      union
      { ?s ?ps bnwd:Q1 . }
      ?s ?ps ?sal.
   
  } #/optional union. 
 
  # to filter out interacters completely uncomment the next line and comment out if(bound) in select
  # filter(!bound(?sal)).
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
ORDER BY ?q1_q8_interaction  ?personLabel
</sparql>
</sparql>


579

edits