[英]Using sameAs in virtuoso sparql between multiple graphs
I am using virtuoso 7.2.1 and i am trying to run a sparql query between 3 graphs. 我正在使用virtuoso 7.2.1,并且试图在3个图之间运行sparql查询。
G1 contains: G1包含:
@prefix : <http://test#> .
:bob :hasAddress :add1 .
G2 contains: G2包含:
@prefix : <http://test#> .
:bob :hasAddress :add2 .
and G3 contains: G3包含:
@prefix : <http://test#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
:add1 owl:sameAs :add2 .
The sparql i'm trying to run in virtuoso is: 我想在virtuoso中运行的sparql是:
DEFINE input:same-as "yes"
Select *
from <http://G1>
from <http://G3>
Where{
<http://test#bob> <http://test#hasAddress> ?z .
}
result: 结果:
<http://test#add1>
expected result: 预期结果:
<http://test#add1>
<http://test#add2>
Note: If i use a single graph (G1,G2,G3 merged to G graph) i get the expected result. 注意:如果我使用单个图 (G1,G2,G3合并到G图),则可以得到预期的结果。 Why this doesnt work with multiple graphs. 为什么这不适用于多个图形。 Thanks. 谢谢。
-----------------------------------EDIT-------------- - - - - - - - - - - - - - - - - - -编辑 - - - - - - -
Respectively this query: 分别此查询:
DEFINE input:same-as "yes"
Select *
from <http://G2>
from <http://G3>
Where{
<http://test#bob> <http://test#hasAddress> ?z .
}
or this query: 或此查询:
DEFINE input:same-as "yes"
Select ?z
from named <http://G2>
from named <http://G3>
Where{
graph ?g {<http://test#bob> <http://test#hasAddress> ?z .}
}
has only this result: 仅具有以下结果:
<http://test#add2>
You're excluding G2 from your original query, and G1 from your second and third queries. 您从原始查询中排除了G2,从第二和第三查询中排除了G1。 sameAs
doesn't add a FROM
clause to your query; sameAs
不会在您的查询中添加FROM
子句; it just says "these two URIs reference the same entity." 它只是说“这两个URI引用相同的实体”。
Try these -- 试试这些-
DEFINE input:same-as "yes"
SELECT *
FROM <http://G1>
FROM <http://G2>
FROM <http://G3>
WHERE
{
<http://test#bob> <http://test#hasAddress> ?z
}
-- and -- -和-
DEFINE input:same-as "yes"
SELECT *
FROM <http://G1>
FROM <http://G2>
FROM <http://G3>
WHERE
{
<http://test#bob> <http://test#hasAddress> ?z
}
-- and -- -和-
DEFINE input:same-as "yes"
SELECT ?z
FROM NAMED <http://G1>
FROM NAMED <http://G2>
FROM NAMED <http://G3>
WHERE
{
GRAPH ?g
{ <http://test#bob> <http://test#hasAddress> ?z }
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.