SPARQL examples

From Wer Leitet?
Revision as of 12:51, 5 August 2024 by Admin (talk | contribs)

Persons

Persons in advisory boards in a time range

SELECT DISTINCT ?person ?personLabel ?beirat WHERE {
  ?person rdfs:label ?personLabel;
     wdt:P3 wd:Q2; 
     wdt:P463 ?surname;
     p:P1012 [ps:P1012 ?beirat;
              pq:P4 ?pubDate].
FILTER((LANG(?personLabel)) = "de")
FILTER("1940-01-01"^^xsd:dateTime <= ?pubDate && ?pubDate < "1941-01-01"^^xsd:dateTime).
} ORDER BY ?surname

Count of occupations

SELECT DISTINCT (COUNT (?person) as ?noPeople) ?occupation WHERE {
 ?person wdt:P3 wd:Q2;
             wdt:P999 ?occupation.
 }
GROUP BY ?occupation HAVING (?noPeople  > 1)
ORDER BY DESC(?noPeople)