0

我正在尝试使用 Wikidata 查询服务编写一个 SPARQL 查询,以检索 1970 年以来荷兰的所有首相。但是,我想通过检查首相是否为大学工作来过滤输出。如果部长为一所大学工作,则不应出现在输出中。

我想我必须使用 FILTER NOT EXISTS 表达式,但不知道如何正确编写这一行。有人可以帮我吗?

请参阅下面的查询和输出:

SELECT ?pmLabel ?start ?companyLabel
WHERE
{   
  ?pm wdt:P39 wd:Q3058109.
  ?pm p:P39 ?posHeld.
  ?pm wdt:P108 ?company.
  ?posHeld ps:P39 wd:Q3058109.
  ?posHeld pq:P580 ?start.
    
  FILTER(year(?start) > 1970) 
  # FILTER NOT EXISTS(?company (something) "Universit") 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } # labels

 } 
ORDER BY DESC(?start)

+----------------------+------------------+------------------------------+
|  primeMinisterLabel  |      start       |         companyLabel         |
+----------------------+------------------+------------------------------+
| Mark Rutte           | 14 October 2010  | Unilever                     |
| Mark Rutte           | 14 October 2010  | Calvé                        |
| Jan Peter Balkenende | 22 July 2002     | Erasmus University Rotterdam |
| Jan Peter Balkenende | 22 July 2002     | Vrije Universiteit Amsterdam |
| Ruud Lubbers         | 4 November 1982  | United Nations               |
| Ruud Lubbers         | 4 November 1982  | Harvard University           |
| Ruud Lubbers         | 4 November 1982  | Tilburg University           |
| Ruud Lubbers         | 4 November 1982  | Hollandia                    |
| Dries van Agt        | 19 December 1977 | Kyoto University             |
| Dries van Agt        | 19 December 1977 | Radboud University Nijmegen  |
| Dries van Agt        | 19 December 1977 | Kwansei Gakuin University    |
| Dries van Agt        | 19 December 1977 | Ritsumeikan University       |
+----------------------+------------------+------------------------------+
4

0 回答 0