[
https://issues.apache.org/jira/browse/JENA-1064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15005554#comment-15005554
]
Andy Seaborne commented on JENA-1064:
-------------------------------------
That is not repeatable - it may yield different results for another call with
the same arguments even in the absence of updates affecting it's results. This
is because it returns quads as it encounters them. So the graph field is
whatever was found first.
Either the graph field must be fixed as {{Quad.unionGraph}} or this should
return triples. As triples are created anyway, for the {{distinct()}}, that
might as well be the core operation so:
{noformat}
public Iterator<Triple> findInUnionGraph(Node s, Node p , Node o) {
return findUnionGraphTriples(s,p,o).iterator() ;
}
public Iterator<Quad> findQuadsInUnionGraph(Node s, Node p , Node o) {
return findUnionGraphTriples(s,p,o).map(t -> new Quad(Quad.unionGraph,
t)).iterator() ;
}
private Stream<Triple> findUnionGraphTriples(Node s, Node p , Node o) {
return
Iter.asStream(findInAnyNamedGraphs(s,p,o)).map(Quad::asTriple).distinct() ;
}
{noformat}
As [~ajs6f] has remarked previously, elsewhere, this could go in
{{DatasetGraph}} (except until Java9 we can't have private default methods).
> Add DatasetGraphBaseFind.findInUnionGraph
> -----------------------------------------
>
> Key: JENA-1064
> URL: https://issues.apache.org/jira/browse/JENA-1064
> Project: Apache Jena
> Issue Type: Improvement
> Components: ARQ
> Reporter: Andy Seaborne
> Assignee: Andy Seaborne
>
> Add operation {{DatasetGraphBaseFind.findInUnionGraph}} so that
> implementations can be told explicitly when a union graph access is being
> done. This maybe the computed default graph or an explicit name of
> {{Quad.unionGraph}} i.e. {{<urn:x-arq:UnionGraph>}}. By the time it gets to
> this level, it is with a graph node name.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)