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

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

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

    https://github.com/apache/jena/pull/212#discussion_r99232613
  
    --- Diff: jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java ---
    @@ -115,55 +117,44 @@ public static void add(Graph graph, Triple[] triples) 
{
         }
             
         public static void add(Graph graph, List<Triple> triples) {
    +        addIteratorWorkerDirect(graph, triples.iterator());
             if ( OldStyle && graph instanceof GraphWithPerform )
    -        {
    -            GraphWithPerform g = (GraphWithPerform)graph ;
    -            for (Triple t : triples)
    -                g.performAdd(t) ;
                 graph.getEventManager().notifyAddList(graph, triples) ;
    -        } else
    -        {
    -            for (Triple t : triples)
    -                graph.add(t) ;
    -        }
         }
             
         public static void add(Graph graph, Iterator<Triple> it) {
    -        // Materialize to avoid ConcurrentModificationException.
    -        List<Triple> s = IteratorCollection.iteratorToList(it) ;
    -        if ( OldStyle && graph instanceof GraphWithPerform )
    -        {
    -            GraphWithPerform g = (GraphWithPerform)graph ;
    -            for (Triple t : s)
    -                g.performAdd(t) ;
    +        if ( OldStyle && graph instanceof GraphWithPerform ) {
    +            // Materialize for the notify.
    +            List<Triple> s = IteratorCollection.iteratorToList(it) ;
    --- End diff --
    
    Note: there is no change in behaviour here - this change are only due to 
addIteratorWorkerDirect/addIteratorWorker.
    
    The notifcation requires a list so making that now the iterating on that is 
guaranteed CCME-free and so call `addIteratorWorkerDirect` with the necessary 
copy.
    
    This preserves event semantics, for better or worse.



> Improve GraphUtil operations by considering relative graph sizes.
> -----------------------------------------------------------------
>
>                 Key: JENA-1284
>                 URL: https://issues.apache.org/jira/browse/JENA-1284
>             Project: Apache Jena
>          Issue Type: Improvement
>            Reporter: Andy Seaborne
>            Assignee: Andy Seaborne
>
> Some of the bulk `GraphUtil` operations, `addInto` and `deleteFrom`, could be 
> improved to loop on the smaller graph and have different algorithms depending 
> on whether source or destination graph is smaller.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to