[
https://issues.apache.org/jira/browse/JENA-1945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17186727#comment-17186727
]
Andy Seaborne commented on JENA-1945:
-------------------------------------
But what to do here? A BGP does not work.
{{SELECT * \{ ?s <http://example/p> ?z . ?z <http://example/q> ?o }}}
is rewritten to:
{noformat}
(distinct
(graph ??_
(bgp
(triple ?s <http://example/p> ?z)
(triple ?z <http://example/q> ?o)
)))
{noformat}
so the BGP does not span named graphs - the two matches will have to be in the
same graph.
There is {{TransformGraphRename(Quad.defaultGraphNodeGenerated,
Quad.unionGraph)}} for quad forms - rewrite the expression renaming the quad
slot to be the union graph.
Another way, for triple/graph form, is to rewrite to add a {{GRAPH
<urn:x-arq:UnionGraph>}} around the query pattern.
{noformat}
(graph <urn:x-arq:UnionGraph>
....
)
{noformat}
{noformat}
SELECT *
WHERE
{ GRAPH <urn:x-arq:UnionGraph>
{ ?s <http://example/p> ?z .
?z <http://example/q> ?o
}
}
{noformat}
around the whole pattern.
> Algebra.unionDefaultGraph: OpPath not handled
> ---------------------------------------------
>
> Key: JENA-1945
> URL: https://issues.apache.org/jira/browse/JENA-1945
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Affects Versions: Jena 3.16.0
> Reporter: Claus Stadler
> Priority: Major
>
>
> {code:java}
> System.out.println(
> Algebra.unionDefaultGraph(
> Algebra.compile(
> QueryFactory.create("SELECT * { ?s <urn:p> ?o }"))));
> /* Yields correct result:
> (distinct
> (graph ??_
> (bgp (triple ?s <urn:p> ?o))))
> */
> System.out.println(
> Algebra.unionDefaultGraph(
> Algebra.compile(
> QueryFactory.create("SELECT * { ?s <urn:p1>/<urn:p2>/<urn:p3> ?o }"))));
> /* Yields incorrect result because wrapping with graph ??_ (and distinct) is
> missing:
> (path ?s (seq (seq <urn:p1> <urn:p2>) <urn:p3>) ?o)
> */
> {code}
>
> It seems
> [TransformUnionQuery.java|https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/sparql/algebra/TransformUnionQuery.java#L34]
> lacks the handling of (at least) OpPath
--
This message was sent by Atlassian Jira
(v8.3.4#803005)