jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] jena git commit: JENA-920 : Remove TripleMatchFilter and TripleMatchIterator
Date Fri, 24 Apr 2015 18:18:11 GMT
JENA-920 : Remove TripleMatchFilter and TripleMatchIterator


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/024ce838
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/024ce838
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/024ce838

Branch: refs/heads/jena3
Commit: 024ce83881ca0efcf223a7f8f3a387346b901d8c
Parents: d795140
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Apr 24 19:18:01 2015 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Apr 24 19:18:01 2015 +0100

----------------------------------------------------------------------
 .../apache/jena/sparql/graph/GraphDataBag.java  |  9 ++--
 .../main/java/org/apache/jena/graph/Triple.java |  1 +
 .../apache/jena/graph/TripleMatchFilter.java    | 43 --------------------
 .../apache/jena/graph/TripleMatchIterator.java  | 35 ----------------
 4 files changed, 7 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/024ce838/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphDataBag.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphDataBag.java b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphDataBag.java
index bbb1452..ee18ee0 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphDataBag.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/graph/GraphDataBag.java
@@ -18,14 +18,17 @@
 
 package org.apache.jena.sparql.graph;
 
+import java.util.Iterator ;
+
 import org.apache.jena.atlas.data.DataBag ;
 import org.apache.jena.atlas.data.ThresholdPolicy ;
+import org.apache.jena.atlas.iterator.Iter ;
 import org.apache.jena.graph.Capabilities ;
 import org.apache.jena.graph.Triple ;
-import org.apache.jena.graph.TripleMatchIterator ;
 import org.apache.jena.graph.impl.TripleStore ;
 import org.apache.jena.mem.GraphMemBase ;
 import org.apache.jena.util.iterator.ExtendedIterator ;
+import org.apache.jena.util.iterator.WrappedIterator ;
 
 /**
  * A Graph based on top of a DataBag.  This means it has some limitations:
@@ -115,8 +118,8 @@ public abstract class GraphDataBag extends GraphMemBase
     @Override
     protected ExtendedIterator<Triple> graphBaseFind(Triple m)
     {
-        return new TripleMatchIterator(m, db.iterator()) ;
+        Iterator<Triple> iter = Iter.filter(db.iterator(), (t) -> m.matches(t))
;
+        return WrappedIterator.create(iter) ;
     }
-
 }
 

http://git-wip-us.apache.org/repos/asf/jena/blob/024ce838/jena-core/src/main/java/org/apache/jena/graph/Triple.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/graph/Triple.java b/jena-core/src/main/java/org/apache/jena/graph/Triple.java
index 4138f4b..b0f748e 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/Triple.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/Triple.java
@@ -126,6 +126,7 @@ public class Triple
     public boolean sameAs( Node s, Node p, Node o )
         { return subj.equals( s ) && pred.equals( p ) && obj.equals( o );
}
         
+    /** Does this triple, used as a pattern match, the other triple (usually a ground triple)
*/ 
     public boolean matches( Triple other )
         { return other.matchedBy( subj, pred, obj  ); }
         

http://git-wip-us.apache.org/repos/asf/jena/blob/024ce838/jena-core/src/main/java/org/apache/jena/graph/TripleMatchFilter.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/graph/TripleMatchFilter.java b/jena-core/src/main/java/org/apache/jena/graph/TripleMatchFilter.java
deleted file mode 100644
index 7b18de5..0000000
--- a/jena-core/src/main/java/org/apache/jena/graph/TripleMatchFilter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.graph;
-
-import org.apache.jena.util.iterator.Filter ;
-
-/**
-    A class to turn a triple (treated as a pattern) into a Filter.
-    It used to take a TripleMatch but those are obsolete.
-*/
-public class TripleMatchFilter extends Filter<Triple> 
-    {
-    final protected Triple tMatch;
-
-    /** Creates new TripleMatchFilter */
-    public TripleMatchFilter(Triple tMatch) 
-        { this.tMatch = tMatch; }
-
-    /** 
-         The object is wanted.
-         @param t The object to accept or reject.  Must be a Triple
-         @return true if the object is wanted.
-    */
-    @Override
-    public boolean accept( Triple t ) 
-        { return tMatch.matches( t ); }
-    }

http://git-wip-us.apache.org/repos/asf/jena/blob/024ce838/jena-core/src/main/java/org/apache/jena/graph/TripleMatchIterator.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/graph/TripleMatchIterator.java b/jena-core/src/main/java/org/apache/jena/graph/TripleMatchIterator.java
deleted file mode 100644
index 69e2836..0000000
--- a/jena-core/src/main/java/org/apache/jena/graph/TripleMatchIterator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.graph;
-
-import java.util.Iterator;
-
-import org.apache.jena.util.iterator.* ;
-
-/** 
- 	An iterator that selects triples from an underlying iterators of triples
- 	It used to take TripleMatch's, but those are obsolete.
-*/
-public class TripleMatchIterator
-    extends FilterKeepIterator<Triple>
-    implements ExtendedIterator<Triple>
-    {
-    public TripleMatchIterator( Triple m, Iterator<Triple> iter ) 
-        { super( new TripleMatchFilter( m ), iter ); }
-    }


Mime
View raw message