Project:SPARQL/examples: Difference between revisions

Line 244: Line 244:
}
}
ORDER BY ?personLabel ?propLabel ?s
ORDER BY ?personLabel ?propLabel ?s
</sparql>
=== Women's interactions with RAI (Q35 and Q29) ===
<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/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd:  <http://www.wikidata.org/entity/>
SELECT distinct ?person ?personLabel  ?prop ?propLabel ?prop_type  ?pq_value ?pq_valueLabel ?qual_prop_label ?qual_prop_type ?rai ?s
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . # women
  ?person ?p ?s .
      ?prop wikibase:claim ?p;     
        wikibase:statementProperty ?ps; 
        wikibase:statementValue ?psv;
        wikibase:propertyType ?prop_type.   
   
      # to get both q35 and q29
      { ?s ?ps bnwd:Q35 . }  union { ?s ?ps bnwd:Q29 . }
      ?s ?ps ?rai.
      # qualifiers.
      optional {
        ?s ?pq ?pq_value . 
       
        ?qual_prop wikibase:qualifier ?pq . 
        ?qual_prop rdfs:label ?qual_prop_label. filter(lang(?qual_prop_label)="en-gb") .
        ?qual_prop wikibase:propertyType ?qual_prop_type .
       
      } # /qualifiers
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". }
}
ORDER BY ?personLabel
</sparql>
</sparql>


579

edits