在SPARQL中从列表中搜索多个查询

在SPARQL中从列表中搜索多个查询,sparql,linked-data,Sparql,Linked Data,我想使用英国土地注册数据库查找一组300个地址的销售数据。数据库允许SPARQL查询,但我对SPARQL完全陌生,不知道如何一次进行多个查询(例如,在一个SPARQL查询中搜索300个地址) 找一个地址 所以我有两个问题: 1) 如何在一个查询中搜索多个地址 2) 是否有一种连接数据库地址列表的方法来自动执行查询 非常感谢您的帮助和指导。在示例查询中,WHERE子句中的前五个三重模式将结果与特定结果联系起来。删除这些地址或用#注释掉,您将获得所选SPARQL端点已知的所有地址的列表: prefi

我想使用英国土地注册数据库查找一组300个地址的销售数据。数据库允许SPARQL查询,但我对SPARQL完全陌生,不知道如何一次进行多个查询(例如,在一个SPARQL查询中搜索300个地址)

找一个地址

所以我有两个问题:

1) 如何在一个查询中搜索多个地址

2) 是否有一种连接数据库地址列表的方法来自动执行查询


非常感谢您的帮助和指导。

在示例查询中,
WHERE
子句中的前五个三重模式将结果与特定结果联系起来。删除这些地址或用
#
注释掉,您将获得所选SPARQL端点已知的所有地址的列表:

prefix ...

SELECT  ?item ?ppd_propertyAddress ?ppd_hasTransaction ?ppd_pricePaid ? ppd_transactionCategory ?ppd_transactionDate ?ppd_transactionId ?ppd_estateType    ?ppd_newBuild ?ppd_propertyAddressCounty ?ppd_propertyAddressDistrict ?ppd_propertyAddressLocality ?ppd_propertyAddressPaon ?ppd_propertyAddressPostcode ?ppd_propertyAddressSaon ?ppd_propertyAddressStreet ?ppd_propertyAddressTown ?ppd_propertyType ?ppd_recordStatus
WHERE
{ #?ppd_propertyAddress text:query _:b0 .
  #_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "paon: ( 12 )  AND street: ( PATTINSON AND DRIVE )" .
  #_:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b1 .
  #_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> 3000000 .
  #_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
  ?item ppd:propertyAddress ?ppd_propertyAddress .
  ?item ppd:hasTransaction ?ppd_hasTransaction .
  ?item ppd:pricePaid ?ppd_pricePaid .
  ?item ppd:transactionCategory ?ppd_transactionCategory .
  ?item ppd:transactionDate ?ppd_transactionDate .
  ?item ppd:transactionId ?ppd_transactionId
  OPTIONAL
  { ?item ppd:estateType ?ppd_estateType }
  OPTIONAL
  { ?item ppd:newBuild ?ppd_newBuild }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:county ?ppd_propertyAddressCounty }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:district ?ppd_propertyAddressDistrict }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:locality ?ppd_propertyAddressLocality }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:paon ?ppd_propertyAddressPaon }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:postcode ?ppd_propertyAddressPostcode }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:saon ?ppd_propertyAddressSaon }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:street ?ppd_propertyAddressStreet }
  OPTIONAL
  { ?ppd_propertyAddress lrcommon:town ?ppd_propertyAddressTown }
  OPTIONAL
  { ?item ppd:propertyType ?ppd_propertyType }
  OPTIONAL
  { ?item ppd:recordStatus ?ppd_recordStatus }
}
LIMIT   100

请注意,
VALUES
?addr
绑定到列表中
VALUES
子句中大括号之间的每个字符串
?addr
然后在三重模式中代替原始查询中的地址使用。

我不明白您所说的“WHERE子句中的前五个三重模式”是指哪几行。你能提供一个他们被注释掉的例子吗?查看
表达式的实现也非常有用。为了清楚起见,我想提交一个查询,返回300个地址的结果,这是我目前在CSV中找到的。添加到答案中。对于
我提供了一个包含示例的链接。我无法在不中断的情况下实现您的代码,并且我不知道如何适当地实现
表达式,查询两个单独的地址。
SELECT *
WHERE {
   VALUES ?addr {"address1" "paon: ( 12 )  AND street: ( PATTINSON AND DRIVE )" ...}
   ?ppd_propertyAddress text:query _:b0 .
   _:b0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> ?addr .
   ?item ppd:propertyAddress ?ppd_propertyAddress .

   ...
}