我想找到欧盟的所有极右翼政党,此外我想要他们的领导人。在dbpedia for property中,是dbpedia-owl:party of ,我不知道如何使用它。
到目前为止,这是我的查询:
SELECT str(?Lparty) as ?Politicalparty str(?Lcountry) as ?EUCountry str(?Lleader) as ?EUleader
WHERE
{
?Party dbpprop:position ?Position ;
rdfs:label ?Lparty ;
dbpedia-owl:country ?Country ;
a dbpedia-owl:PoliticalParty ;
# The following are the problematic lines
dbpedia-owl:party ?Leader ;
rdfs:label ?Lleader.
# End problematic lines
FILTER(LANGMATCHES(LANG(?Lleader), "en")).
FILTER(?Position IN (dbpedia:Far-right_politics,dbpedia:Nazism, dbpedia:Nationalism)).
FILTER(NOT EXISTS{?Party dbpprop:dissolved ?otherBalue}).
FILTER(NOT EXISTS{?Party dbpprop:dissolution ?otherBalue}).
FILTER(LANGMATCHES(LANG(?Lparty), "en")).
?Country dcterms:subject category:Member_states_of_the_European_Union;
rdfs:label ?Lcountry.
FILTER(LANGMATCHES(LANG(?Lcountry), "en")).
}
答案 0 :(得分:1)
我正在解决类似于你的查询,过了一段时间我意识到有些?Leaders
已经是标签,有些则是需要提取标签的URI。例如,在您的情况下,如果您更改"有问题的部分"进入?Party dbpprop:leader ?Leader.
,您可以同时获得Hendrik Elias
和http://dbpedia.org/resource/Wies_Moens
等答案。因此,如果您在两种情况下都需要标签,则需要决定何时深入挖掘。由于我的版本是更大程序的一部分,因此以编程方式解决此问题更快。基于这些解释,我能写的最简单的查询是:
SELECT distinct str(?Lparty) as ?Politicalparty str(?Lcountry) as ?EUCountry str(?Leader) as ?EUleader
WHERE
{
?Party dbpprop:position ?Position ;
rdfs:label ?Lparty ;
dbpedia-owl:country ?Country ;
a dbpedia-owl:PoliticalParty.
?Party dbpprop:leader ?Leader.
FILTER(?Position IN (dbpedia:Far-right_politics,dbpedia:Nazism, dbpedia:Nationalism)).
FILTER(NOT EXISTS{?Party dbpprop:dissolved ?otherBalue}).
FILTER(NOT EXISTS{?Party dbpprop:dissolution ?otherBalue}).
FILTER(LANGMATCHES(LANG(?Lparty), "en")).
?Country dcterms:subject category:Member_states_of_the_European_Union;
rdfs:label ?Lcountry.
FILTER(LANGMATCHES(LANG(?Lcountry), "en")).
}