我可以在SPARQL查询中组合本地和远程数据集吗? [英] Can I combine local and remote dataset within SPARQL query?

查看:211
本文介绍了我可以在SPARQL查询中组合本地和远程数据集吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读关于SPARQL和RDF,如果我对这些技术的推断是错误的,请纠正我们。

I've been reading about SPARQL and RDF and please correct me if my reasoning about these technologies is wrong here.

假设我们有一个本地SPARQL数据库LOCAL ..和url到远程RDF文件称为URL_RDF。我可以写一个脚本让我们在PHP中做这样的SPARQL查询吗?

Assuming that we have a local SPARQL database called LOCAL.. and url to remote RDF file called URL_RDF. Can I write a script lets say in PHP which will do a SPARQL query like this ?

伪代码。

SELECT * FROM LOCAL,URL_RDF WHERE LOCAL.id=URL_RDF.id

换句话说,我可以在SPARQL查询中结合源代码(远程文件+本地db)?

In other words can I combine sources within SPARQL query like this (remote file + local db) ?

推荐答案

请使用SPARQL 1.1中的联合功能执行此操作。有关详情,请参阅 http://www.w3.org/TR/sparql11-federated-query ,但是为了给你一个快速的印象,它的样子,你的示例查询将是这样(仍然是伪代码):

You can do this using the federation features in SPARQL 1.1. These are described at http://www.w3.org/TR/sparql11-federated-query, but to give you a quick impression of what it looks like, your example query would be something like this (still in pseudocode):

SELECT * WHERE {
  # the local part of the query
  ?s ?p ?id

  SERVICE <http://url/to/remote/data> {
    # The remote part of the query
    ?x ?y ?id
  }
}

请注意,URL必须指向SPARQL端点,即可以响应SPARQL查询的服务器,而不仅仅是远程RDF文件。

Note that the URL would have to point to a SPARQL endpoint, i.e. a server that can respond to SPARQL queries, and not just a remote RDF file.

这篇关于我可以在SPARQL查询中组合本地和远程数据集吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆