query problem

1 view
Skip to first unread message

berzi...@gmail.com

unread,
Mar 13, 2014, 4:52:53 AM3/13/14
to sta...@clarkparsia.com
Hi, 

I have a problem with a query.
With the data I have attached to this issue, I run a query:

select distinct ?table1 ?link ?table2 where { ?n2 a ?value2 .  ?table1 ?link ?table2 . values ?table1 {<http://myvehicledata.com/jack>}. }

and everything is fine, just what I want but when I run this query:

select distinct ?table2 where { ?table2 a ?value2 .  ?table1 ?link ?table2 . values ?table1 {<http://myvehicledata.com/jack>}. }

I get :mishel in there what I dont want and I dont know why she is there.

Could someone help me with this problem?



example.ttl

berzi...@gmail.com

unread,
Mar 13, 2014, 6:31:22 AM3/13/14
to sta...@clarkparsia.com, berzi...@gmail.com
I found a workaround for this thing using sub query: 
PREFIX : <http://myvehicledata.com/>
SELECT ?table2
WHERE {
 {
   SELECT ?table1 ?link ?table2
   WHERE {
      values ?table1 { :jack }  . ?table2 a ?t1 .  ?table1 ?link ?table2 .
   }
 }
}

This seems like a dirty hack, any idea why this works and the previous does not? 

Mike Grove

unread,
Mar 13, 2014, 10:41:10 AM3/13/14
to stardog
I think your confusion is related to the fact these are two rather different queries.  In the first query, you have two BGPs with no shared variables, so you are effectively doing the cross product of the solution sets for those two BGPs.

In the latter query, they share the variable ?table2, which will bring back quite a different set of data than the previous one.

Cheers,

Mike
 



--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Reply all
Reply to author
Forward
0 new messages