即使没有错误,也不会使用INSERT更新芝麻存储库 [英] Sesame repository not being updated using INSERT despite no error

查看:55
本文介绍了即使没有错误,也不会使用INSERT更新芝麻存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用dbpedia中的数据更新芝麻存储库.我有以下查询:

I am trying to update a Sesame repository with data from dbpedia. I have the following query:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

INSERT{?s ?p ?o}

WHERE {
 SERVICE <http://dbpedia.org/sparql>{

{:Rotavirus_vaccine ?p ?o.
}
UNION
{
?s ?p :Rotavirus_vaccine.
}
}
}

此查询未显示任何错误不会更新存储库.另一方面,将UNION分为两个单独的查询,然后逐个更新存储库.为什么查询是孤立工作而不是联合工作?单个查询的代码为:

This query doesn't show any error doesn't update the repository. On the other hand, splitting the UNION into two separate queries and then updating the repository one by one works. Why do the queries work in isolation but not in union? The code of an individual query is:

INSERT{:Rotavirus_vaccine ?p ?o}        
WHERE {
SERVICE <http://dbpedia.org/sparql>{
{:Rotavirus_vaccine ?p ?o.
}
}
}

推荐答案

通过对UNION的两个子句使用BIND,我已经能够执行功能查询.代码是:

I've been able to execute a functional query by using BIND for both clauses of the UNION. The code is:

INSERT{?s ?p ?o} 
WHERE 
{ 
SERVICE <dbpedia.org/sparql>
{ 
{:Rotavirus_vaccine ?p ?o. BIND(:Rotavirus_vaccine AS ?s)} 
UNION {?s ?p :Rotavirus_vaccine. BIND(:Rotavirus_vaccine AS ?o) } 
} 
}

这篇关于即使没有错误,也不会使用INSERT更新芝麻存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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