Project:SPARQL/examples: Difference between revisions

m
Line 1,006: Line 1,006:
</sparql>
</sparql>


=== Academic degrees ===
<sparql tryit="1">
# Fetch academic degrees for women, with date and conferring institution where available
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 distinct ?person ?personLabel ?degree ?degreeLabel ?by ?byLabel ?date ?date_label  ?s
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  # academic degree = P59.
  ?person bnp:P59 ?s . 
    ?s bnps:P59 ?degree . # type of degree
 
  # optional qualifiers for degree
 
  # P61 conferred by
    optional { ?s bnpq:P61 ?by . }
 
  # date with type
    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") . # kind of date
      } # /dates
     
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?date ?degreeLabel
</sparql>


=== Women who were FSAs who went to Oxford or Cambridge colleges ===
=== Women who were FSAs who went to Oxford or Cambridge colleges ===
Line 1,119: Line 1,078:
order by ?personLabel ?collegeLabel ?date
order by ?personLabel ?collegeLabel ?date


</sparql>
=== Academic degrees ===
<sparql tryit="1">
# Fetch academic degrees for women, with date and conferring institution where available
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 distinct ?person ?personLabel ?degree ?degreeLabel ?by ?byLabel ?date ?date_label  ?s
WHERE { 
  ?person bnwdt:P3 bnwd:Q3 . #select women
  FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team
 
  # academic degree = P59.
  ?person bnp:P59 ?s . 
    ?s bnps:P59 ?degree . # type of degree
 
  # optional qualifiers for degree
 
  # P61 conferred by
    optional { ?s bnpq:P61 ?by . }
 
  # date with type
    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") . # kind of date
      } # /dates
     
  SERVICE wikibase:label {bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en".}
}
order by ?personLabel ?date ?degreeLabel
</sparql>
</sparql>


579

edits