|
From: <tho...@us...> - 2014-03-15 10:53:50
|
Revision: 7979
http://sourceforge.net/p/bigdata/code/7979
Author: thompsonbry
Date: 2014-03-15 10:53:47 +0000 (Sat, 15 Mar 2014)
Log Message:
-----------
Extracted an IBindingExtractor interface from the IGASProgram interface.
Modified Paths:
--------------
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IGASProgram.java
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java
branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java
Added Paths:
-----------
branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java
Added: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java (rev 0)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IBindingExtractor.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -0,0 +1,80 @@
+/**
+ Copyright (C) SYSTAP, LLC 2006-2012. All rights reserved.
+
+ Licensed 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 com.bigdata.rdf.graph;
+
+import java.util.List;
+
+import org.openrdf.model.Value;
+import org.openrdf.model.ValueFactory;
+
+/**
+ * This interface makes it possible to extract bindings for variables from an
+ * {@link IGASProgram}.
+ *
+ * @param <VS>
+ * The generic type for the per-vertex state. This is scoped to the
+ * computation of the {@link IGASProgram}.
+ * @param <ES>
+ * The generic type for the per-edge state. This is scoped to the
+ * computation of the {@link IGASProgram}.
+ * @param <ST>
+ * The generic type for the SUM. This is often directly related to
+ * the generic type for the per-edge state, but that is not always
+ * true. The SUM type is scoped to the GATHER + SUM operation (NOT
+ * the computation).
+ *
+ * @author <a href="mailto:tho...@us...">Bryan Thompson</a>
+ */
+public interface IBindingExtractor<VS, ES, ST> {
+
+ /**
+ * An interface that may be used to extract variable bindings for the
+ * vertices visited by the algorithm.
+ *
+ * @author <a href="mailto:tho...@us...">Bryan
+ * Thompson</a>
+ */
+ public interface IBinder<VS, ES, ST> {
+
+ /**
+ * The ordinal index of the variable that is bound by this
+ * {@link IBinder}. By convention, index ZERO is the vertex. Indices
+ * greater than ZERO are typically aspects of the state of the vertex.
+ */
+ int getIndex();
+
+ /**
+ * @param vf
+ * The {@link ValueFactory} used to create the return
+ * {@link Value}.
+ * @param u
+ * The vertex.
+ *
+ * @return The {@link Value} for that ordinal variable or
+ * <code>null</code> if there is no binding for that ordinal
+ * variable.
+ */
+ Value bind(ValueFactory vf, final IGASState<VS, ES, ST> state, Value u);
+
+ }
+
+ /**
+ * Return a list of interfaces that may be used to extract variable bindings
+ * for the vertices visited by the algorithm.
+ */
+ List<IBinder<VS, ES, ST>> getBinderList();
+
+}
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IGASProgram.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IGASProgram.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/IGASProgram.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -15,11 +15,8 @@
*/
package com.bigdata.rdf.graph;
-import java.util.List;
-
import org.openrdf.model.Statement;
import org.openrdf.model.Value;
-import org.openrdf.model.ValueFactory;
/**
* Abstract interface for GAS programs.
@@ -43,7 +40,8 @@
* an API that is aimed at vectored (for GPU) execution with 2D
* partitioning (for out-of-core, multi-node).
*/
-public interface IGASProgram<VS, ES, ST> extends IGASOptions<VS, ES, ST> {
+public interface IGASProgram<VS, ES, ST> extends IGASOptions<VS, ES, ST>,
+ IBindingExtractor<VS, ES, ST> {
/**
* One time initialization before the {@link IGASProgram} is executed.
@@ -205,41 +203,4 @@
*/
boolean nextRound(IGASContext<VS, ES, ST> ctx);
- /**
- * Return a list of interfaces that may be used to extract variable bindings
- * for the vertices visited by the algorithm.
- */
- List<IBinder<VS, ES, ST>> getBinderList();
-
- /**
- * An interface that may be used to extract variable bindings for the
- * vertices visited by the algorithm.
- *
- * @author <a href="mailto:tho...@us...">Bryan
- * Thompson</a>
- */
- public interface IBinder<VS, ES, ST> {
-
- /**
- * The ordinal index of the variable that is bound by this
- * {@link IBinder}. By convention, index ZERO is the vertex. Indices
- * greater than ZERO are typically aspects of the state of the vertex.
- */
- int getIndex();
-
- /**
- * @param vf
- * The {@link ValueFactory} used to create the return
- * {@link Value}.
- * @param u
- * The vertex.
- *
- * @return The {@link Value} for that ordinal variable or
- * <code>null</code> if there is no binding for that ordinal
- * variable.
- */
- Value bind(ValueFactory vf, final IGASState<VS, ES, ST> state, Value u);
-
- }
-
}
\ No newline at end of file
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/BFS.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -30,6 +30,7 @@
import com.bigdata.rdf.graph.EdgesEnum;
import com.bigdata.rdf.graph.Factory;
import com.bigdata.rdf.graph.FrontierEnum;
+import com.bigdata.rdf.graph.IBindingExtractor;
import com.bigdata.rdf.graph.IGASContext;
import com.bigdata.rdf.graph.IGASScheduler;
import com.bigdata.rdf.graph.IGASState;
@@ -277,11 +278,11 @@
* </dl>
*/
@Override
- public List<IBinder<BFS.VS, BFS.ES, Void>> getBinderList() {
+ public List<IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>> getBinderList() {
- final List<IBinder<BFS.VS, BFS.ES, Void>> tmp = super.getBinderList();
+ final List<IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>> tmp = super.getBinderList();
- tmp.add(new IBinder<BFS.VS, BFS.ES, Void>() {
+ tmp.add(new IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>() {
@Override
public int getIndex() {
@@ -297,7 +298,7 @@
}
});
- tmp.add(new IBinder<BFS.VS, BFS.ES, Void>() {
+ tmp.add(new IBindingExtractor.IBinder<BFS.VS, BFS.ES, Void>() {
@Override
public int getIndex() {
@@ -318,7 +319,7 @@
}
/**
- * Additional {@link IBinder}s exposed by {@link BFS}.
+ * Additional {@link IBindingExtractor.IBinder}s exposed by {@link BFS}.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
*/
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/CC.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -30,6 +30,7 @@
import com.bigdata.rdf.graph.EdgesEnum;
import com.bigdata.rdf.graph.Factory;
import com.bigdata.rdf.graph.FrontierEnum;
+import com.bigdata.rdf.graph.IBindingExtractor;
import com.bigdata.rdf.graph.IGASScheduler;
import com.bigdata.rdf.graph.IGASState;
import com.bigdata.rdf.graph.IReducer;
@@ -313,11 +314,11 @@
* </dl>
*/
@Override
- public List<IBinder<CC.VS, CC.ES, Value>> getBinderList() {
+ public List<IBindingExtractor.IBinder<CC.VS, CC.ES, Value>> getBinderList() {
- final List<IBinder<CC.VS, CC.ES, Value>> tmp = super.getBinderList();
+ final List<IBindingExtractor.IBinder<CC.VS, CC.ES, Value>> tmp = super.getBinderList();
- tmp.add(new IBinder<CC.VS, CC.ES, Value>() {
+ tmp.add(new IBindingExtractor.IBinder<CC.VS, CC.ES, Value>() {
@Override
public int getIndex() {
@@ -338,7 +339,7 @@
}
/**
- * Additional {@link IBinder}s exposed by {@link CC}.
+ * Additional {@link IBindingExtractor.IBinder}s exposed by {@link CC}.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
*/
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/PR.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -28,11 +28,12 @@
import com.bigdata.rdf.graph.EdgesEnum;
import com.bigdata.rdf.graph.Factory;
import com.bigdata.rdf.graph.FrontierEnum;
+import com.bigdata.rdf.graph.IBindingExtractor;
+import com.bigdata.rdf.graph.IBindingExtractor.IBinder;
import com.bigdata.rdf.graph.IGASContext;
import com.bigdata.rdf.graph.IGASScheduler;
import com.bigdata.rdf.graph.IGASState;
import com.bigdata.rdf.graph.IReducer;
-import com.bigdata.rdf.graph.IGASProgram.IBinder;
import com.bigdata.rdf.graph.analytics.CC.Bindings;
import com.bigdata.rdf.graph.impl.BaseGASProgram;
@@ -348,11 +349,11 @@
* </dl>
*/
@Override
- public List<IBinder<PR.VS, PR.ES, Double>> getBinderList() {
+ public List<IBindingExtractor.IBinder<PR.VS, PR.ES, Double>> getBinderList() {
- final List<IBinder<PR.VS, PR.ES, Double>> tmp = super.getBinderList();
+ final List<IBindingExtractor.IBinder<PR.VS, PR.ES, Double>> tmp = super.getBinderList();
- tmp.add(new IBinder<PR.VS, PR.ES, Double>() {
+ tmp.add(new IBindingExtractor.IBinder<PR.VS, PR.ES, Double>() {
@Override
public int getIndex() {
@@ -373,7 +374,7 @@
}
/**
- * Additional {@link IBinder}s exposed by {@link PR}.
+ * Additional {@link IBindingExtractor.IBinder}s exposed by {@link PR}.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
*/
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/analytics/SSSP.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -25,6 +25,7 @@
import com.bigdata.rdf.graph.EdgesEnum;
import com.bigdata.rdf.graph.Factory;
import com.bigdata.rdf.graph.FrontierEnum;
+import com.bigdata.rdf.graph.IBindingExtractor;
import com.bigdata.rdf.graph.IGASContext;
import com.bigdata.rdf.graph.IGASScheduler;
import com.bigdata.rdf.graph.IGASState;
@@ -445,12 +446,12 @@
* </dl>
*/
@Override
- public List<IBinder<SSSP.VS, SSSP.ES, Integer>> getBinderList() {
+ public List<IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>> getBinderList() {
- final List<IBinder<SSSP.VS, SSSP.ES, Integer>> tmp = super
+ final List<IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>> tmp = super
.getBinderList();
- tmp.add(new IBinder<SSSP.VS, SSSP.ES, Integer>() {
+ tmp.add(new IBindingExtractor.IBinder<SSSP.VS, SSSP.ES, Integer>() {
@Override
public int getIndex() {
@@ -472,7 +473,7 @@
}
/**
- * Additional {@link IBinder}s exposed by {@link SSSP}.
+ * Additional {@link IBindingExtractor.IBinder}s exposed by {@link SSSP}.
*
* @author <a href="mailto:tho...@us...">Bryan Thompson</a>
*/
Modified: branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java
===================================================================
--- branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-gas/src/java/com/bigdata/rdf/graph/impl/BaseGASProgram.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -29,6 +29,7 @@
import com.bigdata.rdf.graph.EdgesEnum;
import com.bigdata.rdf.graph.Factory;
import com.bigdata.rdf.graph.FrontierEnum;
+import com.bigdata.rdf.graph.IBindingExtractor;
import com.bigdata.rdf.graph.IGASContext;
import com.bigdata.rdf.graph.IGASProgram;
import com.bigdata.rdf.graph.IGASState;
@@ -231,11 +232,11 @@
* </dl>
*/
@Override
- public List<IBinder<VS, ES, ST>> getBinderList() {
+ public List<IBindingExtractor.IBinder<VS, ES, ST>> getBinderList() {
- final List<IBinder<VS, ES, ST>> tmp = new LinkedList<IBinder<VS, ES, ST>>();
+ final List<IBindingExtractor.IBinder<VS, ES, ST>> tmp = new LinkedList<IBindingExtractor.IBinder<VS, ES, ST>>();
- tmp.add(new IBinder<VS, ES, ST>() {
+ tmp.add(new IBindingExtractor.IBinder<VS, ES, ST>() {
@Override
public int getIndex() {
@@ -259,7 +260,7 @@
}
/**
- * Interface declares symbolic constants for the {@link IBinder}s reported
+ * Interface declares symbolic constants for the {@link IBindingExtractor.IBinder}s reported
* by {@link BaseGASProgram#getBinderList()}.
*
* @author <a href="mailto:tho...@us...">Bryan
Modified: branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java
===================================================================
--- branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java 2014-03-15 01:32:44 UTC (rev 7978)
+++ branches/RDR/bigdata-rdf/src/java/com/bigdata/rdf/graph/impl/bd/GASService.java 2014-03-15 10:53:47 UTC (rev 7979)
@@ -44,10 +44,11 @@
import com.bigdata.bop.IVariable;
import com.bigdata.bop.bindingSet.ListBindingSet;
import com.bigdata.journal.IIndexManager;
+import com.bigdata.rdf.graph.IBindingExtractor;
+import com.bigdata.rdf.graph.IBindingExtractor.IBinder;
import com.bigdata.rdf.graph.IGASContext;
import com.bigdata.rdf.graph.IGASEngine;
import com.bigdata.rdf.graph.IGASProgram;
-import com.bigdata.rdf.graph.IGASProgram.IBinder;
import com.bigdata.rdf.graph.IGASScheduler;
import com.bigdata.rdf.graph.IGASSchedulerImpl;
import com.bigdata.rdf.graph.IGASState;
@@ -870,7 +871,7 @@
/**
* The list of objects used to extract the variable bindings.
*/
- private final List<IBinder<VS, ES, ST>> binderList;
+ private final List<IBindingExtractor.IBinder<VS, ES, ST>> binderList;
/**
* The collected solutions.
@@ -907,7 +908,7 @@
final IBindingSet bs = new ListBindingSet();
- for (IBinder<VS, ES, ST> b : binderList) {
+ for (IBindingExtractor.IBinder<VS, ES, ST> b : binderList) {
// The variable for this binder.
final IVariable<?> var = outVars[b.getIndex()];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|