I am trying to find all the far-right parties in EU, in addition I want their leader. In dbpedia for property has is dbpedia-owl:party of and I dont know how to use it.
Here is my query so far:
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")).
}
I was solving a query similar to yours and after a while I realised that some of the
?Leaders
are already labels and some others are URIs that the label needs to be extracted. For example, in your condition if you change the "problematic part" into?Party dbpprop:leader ?Leader.
, you can get answers such asHendrik Elias
andhttp://dbpedia.org/resource/Wies_Moens
at the same time. So if you actually need the label in both cases, you need to decide when to dig deeper. Since my version was part of a bigger program it is faster for me to programatically resolve this issue. Based on these explanations, the easiest query I could write was:}