[ 
https://issues.apache.org/jira/browse/JENA-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300106#comment-16300106
 ] 

ASF GitHub Bot commented on JENA-1452:
--------------------------------------

Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/332#discussion_r158292354
  
    --- Diff: 
jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphUnionRead.java ---
    @@ -82,16 +94,29 @@ protected PrefixMapping createPrefixMapping() {
             if ( graphs == null ) {
                 // This produces unique quads with the same graph node,
                 // hence the triples are distinct. 
    -            Iterator<Quad> qIter = dataset.findNG(Quad.unionGraph, 
m.getSubject(), m.getPredicate(), m.getObject());
    -            Iterator<Triple> tIter = Iter.map(qIter, 
quad->quad.asTriple());
    -            return WrappedIterator.createNoRemove(tIter) ;
    +            return quadsToTriples(dataset, Quad.unionGraph, m);
    +        }
    +        if ( graphs.isEmpty() )
    +            return NullIterator.instance();
    +        if ( graphName != null ) {
    +            if ( ! dataset.containsGraph(graphName) )
    +                // Avoid auto-creation.
    +                return NullIterator.instance();
    +            // Avoid needing distinct.
    +            return dataset.getGraph(graphName).find(m);
             }
             // Only certain graphs.
             IteratorConcat<Triple> iter = new IteratorConcat<>() ;
             forEachGraph((g) -> iter.add(g.find(m))) ;
             return WrappedIterator.createNoRemove(Iter.distinct(iter)) ;
         }
         
    +    private static ExtendedIterator<Triple> quadsToTriples(DatasetGraph 
dsg, Node graphName, Triple m) {
    --- End diff --
    
    Is this different from `dsg.getGraph(graphName).find(m)`?


> Special case GraphUnionRead for one graph.
> ------------------------------------------
>
>                 Key: JENA-1452
>                 URL: https://issues.apache.org/jira/browse/JENA-1452
>             Project: Apache Jena
>          Issue Type: Improvement
>    Affects Versions: Jena 3.6.0
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>            Priority: Minor
>             Fix For: Jena 3.7.0
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to