Reputation: 23
I am using virtuoso 7.2.1 and i am trying to run a sparql query between 3 graphs.
G1 contains:
@prefix : <http://test#> .
:bob :hasAddress :add1 .
G2 contains:
@prefix : <http://test#> .
:bob :hasAddress :add2 .
and G3 contains:
@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:
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. 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>
Upvotes: 2
Views: 574
Reputation: 9444
You're excluding G2 from your original query, and G1 from your second and third queries. sameAs
doesn't add a FROM
clause to your query; it just says "these two URIs reference the same entity."
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 }
}
Upvotes: 1