It would be useful to be able to pass ?x and ?y from a PATHS results. I beleive we had a discussion about this several week ago, but I reduce the scope as I understand the complexity of passing the result back to a select. However if you reduce the scope to ?x, ?y and ?p at each hop for simple path, it become much simpler, and so far, all the use case I would want to use ?x ?y in a select meet this condition. I am not saying complex path and other variable would be useful, but this would really go a great way while keeping the implementation relatively simpler.
For example
Select ?s ?p ?o
{
PATHS START ?s=ex:1 END ?o=ex VIA ?p
}
or
Select ?s ?p ?o
{
PATHS START ?s=ex:1 END ?o=ex VIA ex1:ReadsFrom #?p would be set to this
}
you could even add syntax sugar like this (just thinking out of box)
Yes, we agree it'd be very useful and this is on the roadmap. However there's no target date for it yet.
The basic difficulty is that the SPARQL evaluation semantics is defined around the notion of "solution" which is a mapping from variable names to RDF terms, i.e. a set of bindings or a tuple. All SPARQL operators consume and produce sequences of solutions. Any operator which adheres to this model can be incorporated (relatively) easily and used as a subquery.
Path queries, on the other hand, generate paths as single logical units. A path isn't a solution and breaking it up into individual solutions (edges) makes it difficult to define basic algebraic operations (like joins). Incorporating paths in the SPARQL algebra in a clean way requires an extended notion of solution, about which we previously blogged.
This is however not an easy change as it'd affect most parts of the query engine and have uncertain performance implications. We plan to get it done some time after Stardog 7.0 is out and we have a bit more time.