Sparql: getting all politicians who ruled a city -
i'm new sparql , i'm trying understand how resources need building query. started trying politicians ruled city or country, , @ moment following:
i started following links in snorql (in prefixes) , looking entity adding "politician" @ end. found 1 :
prefix : <http://dbpedia.org/resource/>
so wrote http://dbpedia.org/resource/politician , resource exist. tryed use in way:
prefix dbo: <http://dbpedia.org/ontology/> prefix dbpedia: <http://dbpedia.org/resource/> select ?thing { ?thing :politician . ?thing dbo:birthplace dbpedia:italy. } limit 50
even if remove second line of select
, have no results. if change first line with: ?thing dbo:person
. or if remove it, people born in italy. not politicians. second problem don't need politicians born ruled place. how or can find kind of "relations/descriptors"? googling , copy-pasting existing examples, understand how more specific things.
thanks in advance
your first query isn't working because politician
not part of default (:
) namespace, instead present in dbpedia ontology namespace (dbo
).
so, query should be:
prefix dbo: <http://dbpedia.org/ontology/> prefix dbpedia: <http://dbpedia.org/resource/> select ?thing { ?thing dbo:politician . ?thing dbo:birthplace dbpedia:italy. } limit 50
to list politician ruled italy need know predicate "ruled". once have can construct query.
to list predicates present in database can write this
select distinct(?b) { ?a ?b ?c. }
and list predicates.
i recommend browse through 1 or 2 politician , see predicates have check if 1 works you.
Comments
Post a Comment