[英]How can I retrieve a list of specific person names from DBPedia by using SPARQL query in R
I am currently using the SPARQL package in R to query DBPedia and get the information for a list of specific person names. 我目前正在使用R中的SPARQL包来查询DBPedia并获取特定人名列表的信息。 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? 反过来只使用一个查询迭代查询几个名称(a,b和c)?
For a query like this, the easiest thing is to use values . 对于这样的查询,最简单的方法是使用值 。 Eg, 例如,
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 . 我不熟悉R,但是hui在评论中指出R的粘贴函数可以用来连接URI列表以生成值的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.