Project:SPARQL/examples: Difference between revisions

Line 1,037: Line 1,037:
}
}
order by ?personLabel ?collegeLabel
order by ?personLabel ?collegeLabel
</sparql>
=== All women who went to tertiary education institutions and dates where available ===
<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 bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/>
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/>
SELECT ?person ?personLabel ?college ?collegeLabel ?university ?universityLabel ?date ?date_label
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  # note: academic degree is P59. possible extra info?
  ?person bnp:P94 ?s .  # educated at
    ?s bnps:P94 ?college .
    optional {?college bnwdt:P4 ?university . } # a few ?college aren't part of (P4) a ?university
  ?college bnwdt:P12 bnwd:Q2914 .  # tertiary ed inst
 
  # dates.
    optional {
    ?s ?pq ?date .     
      ?qual_prop wikibase:qualifier ?pq;
              wikibase:propertyType wikibase:Time ; # nb excludes edtf dates
              rdfs:label ?date_label . filter(lang(?date_label)="en-gb") . # what kind of date is it.
      } # /dates
   
 
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?collegeLabel ?date
</sparql>
</sparql>


579

edits