Hi Hugh,

Virtuoso7,December release
Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.0.1-dev.3207-pthreads as of Dec  3 2013
Compiled for Linux (x86_64-unknown-linux-gnu)

I'm trying to use a transitivity in sparql to get related entities from an
anchor subject.  I've run into several issues that appear to be bugs.

Given test data as below:
sparql
insert into graph <DistinctTransitiveTest>
{
<S1> <P1> <S2> .
<S1> <P2> <S3> .
<S3> <P2> <S4> .
<S1> <Ptext> "111"^^xsd:string .
<S2> <Ptext> "222"^^xsd:string .
<S3> <Ptext> "333"^^xsd:string .
<S4> <Ptext> "444"^^xsd:string .
<S1> a <http://example.com/FirstClass> .
<S2> a <http://example.com/SecondClass> .
<S3> a <http://example.com/ThirdClass> .
<S4> a <http://example.com/FourthClass> .
}
------------------------------------
My base query is:
sparql
select distinct ?G ?S ?P ?O
where { GRAPH ?G {FILTER ( ?G in (<DistinctTransitiveTest>))
 {
{ select distinct ?anchor {
?anchor a ?class .
FILTER ( ?anchor in (<S1>))
} LIMIT 1 OFFSET 0
}

?anchor ?anchorPred ?S
    OPTION ( TRANSITIVE,
    t_min (0),
    t_max (1),
    t_in (?anchor),
    t_out (?S),
    t_no_cycles,
    t_distinct ) .
?S ?P ?O .
}}}
-----------------------------
This generates results as:
G
ANY S
ANY P
ANY O
ANY   DistinctTransitiveTest  S2
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://example.com/SecondClass  DistinctTransitiveTest  S3
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://example.com/ThirdClass  DistinctTransitiveTest  S2  P2
http://example.com/SecondClass   DistinctTransitiveTest  S2  Ptext  222
 DistinctTransitiveTest  S3  Ptext  333  DistinctTransitiveTest  S3
P2  S4 No. of rows in result: 6
But where did the below binding come from?  It's not in my data in any
form.  That's problem one.
> DistinctTransitiveTest  S2  P2  http://example.com/SecondClass

Problem two is when I want to filter by the anchorPredicate.
Adding "FILTER ( ?anchorPred in ((<P1>),<P2>))" directly after the
transitive clause causes zero bindings even though all of S2 and S3
entities ought to bind.  Returning ?anchorPred in the select shows me that
it appears to be a real variable that can be filtered on.



Problem three is when I try to filter by the class of S2/S3 (removing the
anchorPred filter as that has already failed me).  Adding  "?S a ?class .
FILTER ( ?class in (<http://example.com/SecondClass>)) " directly after the
transitive clause I get a single binding for ?S ?P ?O.  The rest of S2
fails to bind.
> DistinctTransitiveTest  S2
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://example.com/SecondClass
However, if I then expand the ?class filter to be "filter ( ?class in (<
http://example.com/SecondClass>, <http://example.com/ThirdClass>))", I get
all the results I expect, all of both S2 and S3.

I'm a bit confused by these results which is unfortunate as it seems quite
a powerful feature if I could get it to work consistently.

-- 
Quentin | Clear Blue Water Pty Ltd
quent...@clearbluewater.com.au
------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to