Reputation: 259
I am currently using the SPARQL package in R to query DBPedia and get the information for a list of specific person names. But I only know how to query one person or the "person category", such as
query= "SELECT *{
dbpedia:Veit_Dietrich ?p ?o
}"
qd=SPARQL(endpoint,query)
df=qd$results
Is there anyway to iterative query several names (a,b and c) by only using one single query?
Upvotes: 1
Views: 467
Reputation: 85833
For a query like this, the easiest thing is to use values. E.g.,
select * {
values ?person { dbpedia:Johnny_Cash dbpedia:Johann_Sebastian_Bach }
?person ?p ?o
}
I'm not familiar with R, but hui pointed out in the comments that R's paste function can be used to concatenate the list of URIs to produce the content for values.
Upvotes: 3