SPARQL is based on pattern matching, so path traversal is not its strong point.
You might want to try a different language like Gremlin. On Fri, 12 Feb 2021 at 15.05, Mikael Pesonen <mikael.peso...@lingsoft.fi> wrote: > > Sorry meant of course to find connections between known nodes, here x and > y: > > ASK { > <x> ((<>|!<>)|^(<>|!<>))* <y> > } > > > On 12/02/2021 15.30, Mikael Pesonen wrote: > > > > Hi, > > is there a more efficient way to find out if two entities are > > connected? This > > > > ASK { > > ?s ((<>|!<>)|^(<>|!<>))* ?o > > } > > > > > > works for short, couple of relations long, paths but becomes too slow > > quickly. Maybe something like the list:member method for RDF lists? > > > > BR > > Mikael > >