SPARQL examples: Difference between revisions

From Wer Leitet?
(Created page with "==Persons== ===Persons in advisory boards in a time range=== {{SPARQL|query= 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 }}")
 
No edit summary
Line 13: Line 13:
FILTER("1940-01-01"^^xsd:dateTime <= ?pubDate && ?pubDate < "1941-01-01"^^xsd:dateTime).
FILTER("1940-01-01"^^xsd:dateTime <= ?pubDate && ?pubDate < "1941-01-01"^^xsd:dateTime).
} ORDER BY ?surname
} ORDER BY ?surname
}}
===Count of occupations===
{{SPARQL|query=
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)
}}
}}

Revision as of 12:51, 5 August 2024

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)