Dear Kingsley Idehen,

Thank you very much for your reply. I have tried the solution with
sub-query that you provided me. However, it is giving me following error.
Could you please let me know how to fix it?

Virtuoso 37000 Error SP031: SPARQL compiler: Variable 't' is used in the
query result set but not assigned

Thanks a lot.

Sincerely,
S.M.Shamimul Hasan


On Sun, May 7, 2017 at 12:59 PM, Kingsley Idehen <kide...@openlinksw.com>
wrote:

> On 5/5/17 5:29 PM, S.M.Shamimul Hasan wrote:
> > Hello,
> >
> > I am trying to run the following query on the Virtuoso SPARQL endpoint
> > to calculate the path between nodes. However, it is giving me
> > following error. Could you please let me know how to fix it? BTW the
> > query works fine for the Jena TDB. However, I want to use Virtuoso
> > triplestore because it contains all of my datasets.
> >
> > Query:
> > ---------
> > PREFIX fused:<http://test.edu/vocab/>
> >
> > select ?super ?sub (count(?mid) as ?distance) from
> > <http://test.edu/example/replicate9/> {
> >   ?mid fused:getInfectedBy* ?super.
> >   ?sub fused:getInfectedBy+ ?mid.
> > }
> > group by ?super ?sub
> > order by ?super ?sub
> >
> > Error:
> > --------
> > Virtuoso 37000 Error TR...: Query contains a transitive derived table
> > but neither end of it is bound by equality to other columns or
> parameters.
> >
> > Thanks a lot.
> >
> > Sincerely,
> > S.M.Shamimul Hasan
>
> ## Fails (correctly so) with Transitivity error; Virtuoso 37000 Error
> TR...: Query contains a transitive derived table but neither end of it
> is bound
>
> PREFIX fused:<http://test.edu/vocab/>
>
> SELECT ?super ?sub (count(?mid) as ?distance)
> WHERE {
>           ?mid fused:getInfectedBy* ?super.
>           ?sub fused:getInfectedBy+ ?mid.
>       }
> GROUP BY ?super ?sub
> ORDER BY ?super ?sub
> LIMIT 1
>
>
> ## Workaround using a sub-query
>
> PREFIX fused: <http://test.edu/vocab/>
>
> SELECT SAMPLE(?t) ?super ?sub (count(?mid) as ?distance)
> WHERE {
>         { SELECT distinct ?super
>           WHERE { ?x fused:getInfectedBy ?super }
>         }
>
>        ?mid fused:getInfectedBy* ?super.
>        ?sub fused:getInfectedBy+ ?mid.
>        }
> GROUP BY ?super ?sub
> ORDER BY ?super ?sub
> LIMIT 1
>
>
> You can copy and paste each to the SPARQL endpoint at
> http://linkeddata.uriburner.com/sparql or even
> http://dbpedia.org/sparql. In either case, the second query will return
> an empty solution as solution proof.
>
>
> --
> Regards,
>
> Kingsley Idehen
> Founder & CEO
> OpenLink Software   (Home Page: http://www.openlinksw.com)
>
> Weblogs (Blogs):
> Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
> Blogspot Blog: http://kidehen.blogspot.com
> Medium Blog: https://medium.com/@kidehen
>
> Profile Pages:
> Pinterest: https://www.pinterest.com/kidehen/
> Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
> Twitter: https://twitter.com/kidehen
> Google+: https://plus.google.com/+KingsleyIdehen/about
> LinkedIn: http://www.linkedin.com/in/kidehen
>
> Web Identities (WebID):
> Personal: http://kingsley.idehen.net/dataspace/person/kidehen#this
>         : http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/
> kingsley.ttl#this
>
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to