[Mulgara-svn] r683 - branches/mgr-61-sparql/src/jar branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver trunk/src/jar/query/java/org/mulgara/query trunk/src/jar/resolver/java/org/mulgara/resolver trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene trunk/src/jar/resolver-nodetype/java/org/mulgara/resolver/nodetype trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational trunk/src/jar/resolver-spi/java/org/mulgara/content trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi trunk/src/jar/resolver-store/java/org/mulgara/resolver/store trunk/src/jar/resolver-test/java/org/mulgara/resolver/test trunk/src/jar/resolver-url/java/org/mulgara/resolver/url trunk/src/jar/resolver-view/java/org/mulgara/resolver/view trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd trunk/src/jar/tuples/java/org/mulgara/store/tuples
pag at mulgara.org
pag at mulgara.org
Mon Mar 17 20:25:40 UTC 2008
Author: pag
Date: 2008-03-17 13:25:39 -0700 (Mon, 17 Mar 2008)
New Revision: 683
Added:
branches/mgr-61-sparql/src/jar/sparql/
Modified:
branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
trunk/src/jar/query/java/org/mulgara/query/AbstractConstraintExpression.java
trunk/src/jar/query/java/org/mulgara/query/Constraint.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintExpression.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintHaving.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintImpl.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintIs.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintNegation.java
trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java
trunk/src/jar/query/java/org/mulgara/query/GivenConstraint.java
trunk/src/jar/query/java/org/mulgara/query/LocalNode.java
trunk/src/jar/query/java/org/mulgara/query/SingleTransitiveConstraint.java
trunk/src/jar/query/java/org/mulgara/query/TransitiveConstraint.java
trunk/src/jar/query/java/org/mulgara/query/WalkConstraint.java
trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java
trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java
trunk/src/jar/resolver-nodetype/java/org/mulgara/resolver/nodetype/NodeTypeResolver.java
trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/PrefixResolver.java
trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/TuplesWrapperResolution.java
trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraint.java
trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java
trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalTransformer.java
trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformer.java
trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformerUnitTest.java
trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreDuplicateResolution.java
trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreInverseResolution.java
trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolution.java
trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraint.java
trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java
trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java
trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraint.java
trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java
trunk/src/jar/resolver/java/org/mulgara/resolver/CacheResolver.java
trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java
trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java
trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java
trunk/src/jar/tuples/java/org/mulgara/store/tuples/ConstrainedNegationTuples.java
Log:
Initial checkin of filter code. Currently compiling
Modified: branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java
===================================================================
--- branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java 2008-03-17 20:21:35 UTC (rev 682)
+++ branches/mgr-61-sparql/src/jar/resolver/java/org/mulgara/resolver/DefaultConstraintHandlers.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -182,7 +182,7 @@
new NVPair(ConstraintImpl.class, new ConstraintResolutionHandler() {
public Tuples resolve(QueryEvaluationContext context, ModelExpression modelExpr, ConstraintExpression constraintExpr) throws Exception {
ConstraintElement constraintElem =
- ((ConstraintImpl) constraintExpr).getModel();
+ ((ConstraintImpl) constraintExpr).getGraph();
assert constraintElem != null;
if (constraintElem.equals(Variable.FROM)) {
return ConstraintOperations.resolveModelExpression(context, modelExpr, (Constraint)constraintExpr);
Modified: trunk/src/jar/query/java/org/mulgara/query/AbstractConstraintExpression.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/AbstractConstraintExpression.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/AbstractConstraintExpression.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -29,6 +29,8 @@
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
/**
* An expression whose leaves are {@link Constraint}s.
*
@@ -59,14 +61,13 @@
*/
static final long serialVersionUID = -8835851673635062642L;
- /**
- * A set of all variables the compose the constraint.
- */
+ /** A set of all variables the compose the constraint. */
protected Set<Variable> variables = null;
- /**
- * The operands.
- */
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
+ /** The operands. */
protected ArrayList<ConstraintExpression> elements;
public boolean equals(Object o) {
@@ -79,4 +80,20 @@
return false;
}
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
}
Modified: trunk/src/jar/query/java/org/mulgara/query/Constraint.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/Constraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/Constraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -38,12 +38,6 @@
* @author <a href="http://staff.pisoftware.com/david">David Makepeace</a>
* @author <a href="http://staff.pisoftware.com/pag">Paul Gearon</a>
*
- * @version $Revision: 1.8 $
- *
- * @modified $Date: 2005/01/05 04:58:20 $ by $Author: newmana $
- *
- * @maintenanceAuthor $Author: newmana $
- *
* @copyright ©2001-2004
* <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
*
@@ -61,23 +55,21 @@
/**
* Get a constraint element by index.
- *
* @param index The constraint element to retrieve, from 0 to 3.
* @return The constraint element referred to by index.
*/
public ConstraintElement getElement(int index);
/**
- * Get the model element of this constraint.
+ * Get the graph element of this constraint.
*/
- public ConstraintElement getModel();
+ public ConstraintElement getGraph();
/**
* Returns true if there is are repeating constraint elements.
- *
* For example, <code>$s $p $s</code>.
- *
* @return true if there is are repeating constraint elements
*/
public boolean isRepeating();
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintExpression.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintExpression.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintExpression.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -31,6 +31,8 @@
import java.io.Serializable;
+import org.mulgara.query.filter.Filter;
+
/**
* An expression whose leaves are {@link Constraint}s.
*
@@ -66,4 +68,17 @@
* @return A set containing all variable constraints.
*/
public Set<Variable> getVariables();
+
+ /**
+ * Sets a filter on this constraint.
+ * @param filter A filter to reduce the resolution of this constraint.
+ */
+ public void setFilter(Filter filter);
+
+ /**
+ * Retrieve filter for this constraint.
+ * @return The filter that is used for this constraint.
+ */
+ public Filter getFilter();
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintFalse.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -29,6 +29,8 @@
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
/**
* A constraint expression with zero rows.
*
@@ -142,4 +144,20 @@
public String toString() {
return "no";
}
+
+ /**
+ * Sets the filter for this constraint. Since this constraint returns nothing, then this is irrelevant.
+ * @param filter Ignored.
+ */
+ public void setFilter(Filter filter) {
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return Filter.NULL;
+ }
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintHaving.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintHaving.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintHaving.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -103,7 +103,7 @@
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
return element[3];
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintImpl.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintImpl.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintImpl.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -159,7 +159,7 @@
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
return element[3];
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintIs.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintIs.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintIs.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -148,7 +148,7 @@
element = null;
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
return element[3];
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintNegation.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintNegation.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintNegation.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -31,6 +31,8 @@
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
// Third party packages
// import org.apache.log4j.Logger;
@@ -68,11 +70,12 @@
*/
private static final long serialVersionUID = 9147228997817064907L;
- /**
- * The negated expression.
- */
+ /** The negated expression. */
private Constraint constraint;
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
//
// Constructor
//
@@ -111,8 +114,8 @@
return constraint.getElement(index);
}
- public ConstraintElement getModel() {
- return constraint.getModel();
+ public ConstraintElement getGraph() {
+ return constraint.getGraph();
}
@@ -182,4 +185,21 @@
return returnValue;
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/ConstraintTrue.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -29,6 +29,8 @@
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
/**
* A constraint expression with zero columns and one row.
*
@@ -140,4 +142,20 @@
public String toString() {
return "yes";
}
+
+ /**
+ * Sets the filter for this constraint. Since this constraint returns nothing, then this is irrelevant.
+ * @param filter Ignored.
+ */
+ public void setFilter(Filter filter) {
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return Filter.NULL;
+ }
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/GivenConstraint.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/GivenConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/GivenConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -27,24 +27,16 @@
package org.mulgara.query;
-import java.util.Set;
+import org.mulgara.query.filter.Filter;
+
/**
* An abstract class to be used by implementations of GIVEN clauses.
*
* @created 2004-08-03
- *
* @author Andrew Newman
- *
- * @version $Revision: 1.9 $
- *
- * @modified $Date: 2005/05/29 08:32:40 $ by $Author: raboczi $
- *
- * @maintenanceAuthor $Author: raboczi $
- *
* @copyright ©2004
* <a href="http://www.pisoftware.com/">Plugged In Software Pty Ltd</a>
- *
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
public abstract class GivenConstraint implements Constraint {
@@ -56,4 +48,24 @@
* deleted.
*/
static final long serialVersionUID = 965560040170826878L;
+
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
+
}
Modified: trunk/src/jar/query/java/org/mulgara/query/LocalNode.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/LocalNode.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/LocalNode.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -49,7 +49,7 @@
*
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class LocalNode implements Comparable, Value {
+public class LocalNode implements Comparable<LocalNode>, Value {
/**
* The <var>value</var> property.
@@ -101,22 +101,13 @@
/**
* Nodes compare based on their node number.
*
- * @param object the object to compare against.
+ * @param ln the object to compare against.
* @return RETURNED VALUE TO DO
* @throws IllegalArgumentException if the object is not the correct type.
*/
- public int compareTo(Object object) throws IllegalArgumentException {
-
- if (object instanceof LocalNode) {
-
- long ov = ( (LocalNode) object).getValue();
-
- return (ov == value) ? 0 : ( (ov < value) ? ( -1) : 1);
- }
- else {
-
- throw new IllegalArgumentException("Can't compare to " + object);
- }
+ public int compareTo(LocalNode ln) throws IllegalArgumentException {
+ long ov = ln.getValue();
+ return (ov == value) ? 0 : ( (ov < value) ? ( -1) : 1);
}
//
Modified: trunk/src/jar/query/java/org/mulgara/query/SingleTransitiveConstraint.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/SingleTransitiveConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/SingleTransitiveConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -32,6 +32,8 @@
// Java 2 standard packages
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
// Third party packages
// import org.apache.log4j.Logger;
@@ -71,14 +73,13 @@
// /** Logger. */
// private final static Logger logger = Logger.getLogger(Constraint.class);
- /**
- * The constraint containing the transitive predicate.
- */
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
+ /** The constraint containing the transitive predicate. */
private final Constraint transConstraint;
- /**
- * The anchor to be applied if this anchor is to be used for a chain.
- */
+ /** The anchor to be applied if this anchor is to be used for a chain. */
private final boolean anchored;
/**
@@ -188,8 +189,8 @@
return transConstraint.getElement(index);
}
- public ConstraintElement getModel() {
- return transConstraint.getModel();
+ public ConstraintElement getGraph() {
+ return transConstraint.getGraph();
}
/**
@@ -208,4 +209,20 @@
}
return buffer.toString();
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
}
Modified: trunk/src/jar/query/java/org/mulgara/query/TransitiveConstraint.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/TransitiveConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/TransitiveConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -32,6 +32,8 @@
// Java 2 standard packages
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
// Third party packages
// import org.apache.log4j.Logger;
@@ -71,16 +73,15 @@
// /** Logger. */
// private final static Logger logger = Logger.getLogger(Constraint.class);
- /**
- * The constraint containing the anchored transitive predicate.
- */
+ /** The constraint containing the anchored transitive predicate. */
private final Constraint anchoredConstraint;
- /**
- * The constraint containing the unanchored transitive predicate.
- */
+ /** The constraint containing the unanchored transitive predicate. */
private final Constraint unanchoredConstraint;
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
/**
* Constructor.
*
@@ -189,8 +190,8 @@
return unanchoredConstraint.getElement(index);
}
- public ConstraintElement getModel() {
- return unanchoredConstraint.getModel();
+ public ConstraintElement getGraph() {
+ return unanchoredConstraint.getGraph();
}
/**
@@ -208,4 +209,20 @@
buffer.append("]");
return buffer.toString();
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
}
Modified: trunk/src/jar/query/java/org/mulgara/query/WalkConstraint.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/WalkConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/query/java/org/mulgara/query/WalkConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -32,6 +32,8 @@
// Java 2 standard packages
import java.util.*;
+import org.mulgara.query.filter.Filter;
+
// Third party packages
// import org.apache.log4j.Logger;
@@ -70,16 +72,15 @@
// /** Logger. */
// private final static Logger logger = Logger.getLogger(Constraint.class);
- /**
- * The constraint containing the anchored constraint.
- */
+ /** The constraint containing the anchored constraint. */
private final Constraint anchoredConstraint;
- /**
- * The constraint containing the unanchored constraint.
- */
+ /** The constraint containing the unanchored constraint. */
private final Constraint unanchoredConstraint;
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
/**
* Constructor.
*
@@ -162,8 +163,8 @@
return unanchoredConstraint.getElement(index);
}
- public ConstraintElement getModel() {
- return unanchoredConstraint.getModel();
+ public ConstraintElement getGraph() {
+ return unanchoredConstraint.getGraph();
}
/**
@@ -221,4 +222,20 @@
buffer.append("]");
return buffer.toString();
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
}
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/CacheResolver.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/CacheResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/CacheResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -140,14 +140,14 @@
if (constraint == null) {
throw new IllegalArgumentException("Null \"constraint\" parameter");
}
- if (!(constraint.getModel() instanceof LocalNode)) {
+ if (!(constraint.getGraph() instanceof LocalNode)) {
throw new QueryException(
"Unable to resolve constraint with unbound model: " + constraint
);
}
- assert constraint.getModel() instanceof LocalNode;
+ assert constraint.getGraph() instanceof LocalNode;
- LocalNode modelLocalNode = (LocalNode)constraint.getModel();
+ LocalNode modelLocalNode = (LocalNode)constraint.getGraph();
// Obtain the resolver against the cached version
Resolver temporaryResolver;
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ConstraintOperations.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -268,7 +268,7 @@
return ConstraintFactory.newConstraint(replace(bindings, constraint.getElement(0)),
replace(bindings, constraint.getElement(1)),
replace(bindings, constraint.getElement(2)),
- replace(bindings, constraint.getModel()));
+ replace(bindings, constraint.getGraph()));
}
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DatabaseOperationContext.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -619,7 +619,7 @@
throw new IllegalArgumentException("Null \"constraint\" parameter");
}
- ConstraintElement modelElem = constraint.getModel();
+ ConstraintElement modelElem = constraint.getGraph();
if (modelElem instanceof Variable) {
return resolveVariableModel(constraint);
} else if (modelElem instanceof LocalNode) {
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/DirectTransitiveFunction.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -166,7 +166,7 @@
variable,
predConstraint.getElement(1),
tmpVariable,
- predConstraint.getModel());
+ predConstraint.getGraph());
} else {
// forward anchor [anchor predicate $x]
value = new Long(session.lookup((Node)predConstraint.getElement(0)));
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/LocalQueryResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -178,14 +178,14 @@
*/
public Tuples resolve(ModelResource modelResource, Constraint constraint) throws QueryException
{
- assert modelResource != null || !constraint.getModel().equals(Variable.FROM);
+ assert modelResource != null || !constraint.getGraph().equals(Variable.FROM);
assert constraint != null;
// Delegate constraint resolution back to the database session
try {
Constraint localized = ConstraintOperations.localize(this, constraint);
- if (localized.getModel().equals(Variable.FROM)) {
+ if (localized.getGraph().equals(Variable.FROM)) {
localized = ConstraintOperations.rewriteConstraintModel(
localize(new URIReferenceImpl(modelResource.getURI())), localized);
}
Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/WalkFunction.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -192,7 +192,7 @@
// build the constraint with the temporary variable name
openConstraint = new ConstraintImpl(anchoredConstraintVariable,
anchoredConstraint.getElement(1), tmpVariable,
- anchoredConstraint.getModel());
+ anchoredConstraint.getGraph());
// set up the final result built from the second constraint
inferredResult = new LiteralTuples(new Variable[] {
(Variable) predConstraint.getUnanchoredConstraint().getElement(2),
@@ -214,7 +214,7 @@
// build the constraint with the temporary variable name
openConstraint = new ConstraintImpl(tmpVariable,
anchoredConstraint.getElement(1), anchoredConstraintVariable,
- anchoredConstraint.getModel());
+ anchoredConstraint.getGraph());
// set up the final result built from the second constraint
inferredResult = new LiteralTuples(new Variable[] {
Modified: trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java
===================================================================
--- trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-filesystem/java/org/mulgara/resolver/filesystem/FileSystemResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -338,7 +338,7 @@
}
// Obtain the model of the constraint
- ConstraintElement modelElem = constraint.getModel();
+ ConstraintElement modelElem = constraint.getGraph();
// Verify our model node is a local node
if (!(modelElem instanceof LocalNode)) {
Modified: trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java
===================================================================
--- trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-lucene/java/org/mulgara/resolver/lucene/LuceneResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -321,7 +321,7 @@
logger.debug("Resolve " + constraint);
}
- ConstraintElement modelElement = constraint.getModel();
+ ConstraintElement modelElement = constraint.getGraph();
if (modelElement instanceof Variable) {
logger.warn("Ignoring solutions for " + constraint);
return new EmptyResolution(constraint, false);
Modified: trunk/src/jar/resolver-nodetype/java/org/mulgara/resolver/nodetype/NodeTypeResolver.java
===================================================================
--- trunk/src/jar/resolver-nodetype/java/org/mulgara/resolver/nodetype/NodeTypeResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-nodetype/java/org/mulgara/resolver/nodetype/NodeTypeResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -30,24 +30,18 @@
package org.mulgara.resolver.nodetype;
// Java 2 standard packages
-import java.io.*;
import java.net.*;
import java.util.*;
import javax.transaction.xa.XAResource;
// Third party packages
import org.apache.log4j.Logger;
-import org.jrdf.graph.*;
// Locally written packages
import org.mulgara.query.*;
-import org.mulgara.resolver.*;
import org.mulgara.resolver.spi.*;
-import org.mulgara.server.Session;
-import org.mulgara.server.SessionFactory;
import org.mulgara.store.stringpool.SPObject;
import org.mulgara.store.stringpool.StringPoolException;
-import org.mulgara.store.tuples.LiteralTuples;
import org.mulgara.store.tuples.Tuples;
import org.mulgara.store.tuples.TuplesOperations;
@@ -71,15 +65,9 @@
/** The session that this resolver is associated with. */
private final ResolverSession resolverSession;
- /** A map of servers to sessions. This acts as a cache, and also so we may close the sessions. */
- private Map sessions;
-
/** The URI of the type describing node type models. */
private URI modelTypeURI;
- /** The node for the type describing node type models. */
- private long modelType;
-
/** The preallocated local node representing the rdf:type property. */
private long rdfType;
@@ -125,11 +113,9 @@
// Initialize fields
this.resolverSession = resolverSession;
this.modelTypeURI = modelTypeURI;
- this.modelType = modelType;
this.rdfType = rdfType;
this.rdfsLiteral = rdfsLiteral;
this.mulgaraUriReference = mulgaraUriReference;
- sessions = new Hashtable();
}
//
@@ -220,7 +206,7 @@
if (constraint == null) {
throw new IllegalArgumentException("Null \"constraint\" parameter");
}
- if (!(constraint.getModel() instanceof LocalNode)) {
+ if (!(constraint.getGraph() instanceof LocalNode)) {
logger.warn("Ignoring solutions for non-local model " + constraint);
return new EmptyResolution(constraint, false);
}
@@ -259,9 +245,6 @@
Tuples tuples;
if (node instanceof Variable) {
- // extract the variable from the constraint
- Variable variable = (Variable)node;
-
// select the type being extracted from the string pool
if (type == rdfsLiteral) {
// literals currently fall into 2 categories: typed and untyped
Modified: trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/PrefixResolver.java
===================================================================
--- trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/PrefixResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/PrefixResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -13,9 +13,7 @@
package org.mulgara.resolver.prefix;
// Java 2 standard packages
-import java.io.*;
import java.net.*;
-import java.util.*;
import javax.transaction.xa.XAResource;
// Third party packages
@@ -24,16 +22,12 @@
// Locally written packages
import org.mulgara.query.*;
-import org.mulgara.resolver.*;
import org.mulgara.resolver.spi.*;
-import org.mulgara.server.Session;
-import org.mulgara.server.SessionFactory;
import org.mulgara.store.stringpool.SPObject;
import org.mulgara.store.stringpool.SPObjectFactory;
import org.mulgara.store.stringpool.SPURI;
import org.mulgara.store.stringpool.StringPoolException;
import org.mulgara.store.stringpool.xa.SPObjectFactoryImpl;
-import org.mulgara.store.tuples.LiteralTuples;
import org.mulgara.store.tuples.Tuples;
import org.mulgara.store.tuples.TuplesOperations;
@@ -55,9 +49,6 @@
/** The session that this resolver is associated with. */
private final ResolverSession resolverSession;
- /** A map of servers to sessions. This acts as a cache, and also so we may close the sessions. */
- private Map sessions;
-
/** The URI of the type describing node type models. */
private URI modelTypeURI;
@@ -96,7 +87,6 @@
this.resolverSession = resolverSession;
this.modelTypeURI = modelTypeURI;
this.mulgaraPrefix = mulgaraPrefix;
- sessions = new Hashtable();
}
//
@@ -188,7 +178,7 @@
throw new IllegalArgumentException("Null \"constraint\" parameter");
}
- if (!(constraint.getModel() instanceof LocalNode)) {
+ if (!(constraint.getGraph() instanceof LocalNode)) {
logger.warn("Ignoring solutions for " + constraint);
return new EmptyResolution(constraint, false);
}
@@ -241,8 +231,7 @@
Tuples tuples;
if (node instanceof Variable) {
- // extract the variable from the constraint
- Variable variable = (Variable)node;
+ // Bind a query on a range in the String pool to the variable
// convert the prefix into a string pool object
SPObjectFactory spoFact = SPObjectFactoryImpl.getInstance();
Modified: trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/TuplesWrapperResolution.java
===================================================================
--- trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/TuplesWrapperResolution.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-prefix/java/org/mulgara/resolver/prefix/TuplesWrapperResolution.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -20,7 +20,6 @@
// Locally written packages
import org.mulgara.query.*;
-import org.mulgara.resolver.*;
import org.mulgara.resolver.spi.*;
import org.mulgara.store.tuples.Annotation;
import org.mulgara.store.tuples.RowComparator;
@@ -43,8 +42,8 @@
*
* This is named after the class.
*/
- private static final Logger logger =
- Logger.getLogger(TuplesWrapperResolution.class.getName());
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(TuplesWrapperResolution.class.getName());
/** The constraint. */
private final Constraint constraint;
@@ -254,7 +253,7 @@
* Be aware that the tuples returned from this method are not cloned, and should
* be considered immutable.
*/
- public List getOperands() {
+ public List<Tuples> getOperands() {
return tuples.getOperands();
}
@@ -351,7 +350,7 @@
/**
* Copied from AbstractTuples
*/
- public Annotation getAnnotation(Class annotationClass) throws TuplesException {
+ public Annotation getAnnotation(Class<?> annotationClass) throws TuplesException {
return null;
}
}
Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraint.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -61,6 +61,7 @@
import org.mulgara.query.ConstraintImpl;
import org.mulgara.query.Value;
import org.mulgara.query.Variable;
+import org.mulgara.query.filter.Filter;
import org.mulgara.query.rdf.URIReferenceImpl;
import org.mulgara.resolver.spi.QueryEvaluationContext;
@@ -105,6 +106,8 @@
private Set<Variable> variables;
private static final URIReference rdftype;
+
+ private Filter filter = Filter.NULL;
static {
try {
@@ -163,8 +166,8 @@
public void preliminaries(Constraint constraint) {
if (model == null) {
- model = constraint.getModel();
- } else if (!model.equals(constraint.getModel())) {
+ model = constraint.getGraph();
+ } else if (!model.equals(constraint.getGraph())) {
throw new IllegalStateException("Can't combine relational constraints against different models");
}
@@ -180,7 +183,7 @@
return list != null ? list : new ArrayList<Constraint>();
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
return model;
}
@@ -246,4 +249,12 @@
public String toString() {
return "RC{" + variables + "} | " + rdfTypeConstraints + " # " + predConstraints;
}
+
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
}
Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -246,7 +246,7 @@
}
// Obtain the model of the constraint
- ConstraintElement modelElem = constraint.getModel();
+ ConstraintElement modelElem = constraint.getGraph();
// Verify our model node is a local node
if (!(modelElem instanceof LocalNode)) {
Modified: trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalTransformer.java
===================================================================
--- trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalTransformer.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-relational/java/org/mulgara/resolver/relational/RelationalTransformer.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -100,7 +100,7 @@
public ConstraintExpression transformMatch(SymbolicTransformationContext context, ConstraintImpl c) throws SymbolicTransformationException {
try {
- ConstraintElement ce = c.getModel();
+ ConstraintElement ce = c.getGraph();
if (ce instanceof URIReference) {
URIReference cu = (URIReference)ce;
URI constraintModelType = context.mapToModelTypeURI(cu.getURI());
@@ -125,10 +125,10 @@
ConstraintExpression arg = (ConstraintExpression)args.next();
if (arg instanceof RelationalConstraint) {
RelationalConstraint rc = (RelationalConstraint)arg;
- List rcArgs = (List)relationalArgs.get(rc.getModel());
+ List rcArgs = (List)relationalArgs.get(rc.getGraph());
if (rcArgs == null) {
rcArgs = new ArrayList();
- relationalArgs.put(rc.getModel(), rcArgs);
+ relationalArgs.put(rc.getGraph(), rcArgs);
}
rcArgs.add(rc);
} else {
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/content/ContentResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -209,7 +209,7 @@
if (constraint == null) {
throw new IllegalArgumentException("constraint null");
}
- else if (!(constraint.getModel() instanceof LocalNode)) {
+ else if (!(constraint.getGraph() instanceof LocalNode)) {
throw new QueryException("Constraint model can't be variable");
}
@@ -217,7 +217,7 @@
URIReference modelURIReference;
long modelNode;
try {
- modelNode = ((LocalNode) constraint.getModel()).getValue();
+ modelNode = ((LocalNode) constraint.getGraph()).getValue();
Node node = resolverSession.globalize(modelNode);
if (!(node instanceof URIReference)) {
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformer.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformer.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformer.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -225,7 +225,7 @@
private void accumulateConstraint(ConstraintImpl arg) throws SymbolicTransformationException {
try {
- ConstraintElement model = arg.getModel();
+ ConstraintElement model = arg.getGraph();
if (model instanceof URIReference) {
URIReference cu = (URIReference)model;
URI constraintModelType = context.mapToModelTypeURI(cu.getURI());
Modified: trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformerUnitTest.java
===================================================================
--- trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformerUnitTest.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-spi/java/org/mulgara/resolver/spi/ConjunctiveTransformerUnitTest.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -60,6 +60,7 @@
import org.mulgara.query.ConstraintOperation;
import org.mulgara.query.QueryException;
import org.mulgara.query.Variable;
+import org.mulgara.query.filter.Filter;
import org.mulgara.query.rdf.URIReferenceImpl;
import org.mulgara.util.NVPair;
@@ -625,5 +626,12 @@
public String toString() {
return "[TC:" + id + "]";
}
+
+ public void setFilter(Filter filter) {
+ }
+
+ public Filter getFilter() {
+ return Filter.NULL;
+ }
}
}
Modified: trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreDuplicateResolution.java
===================================================================
--- trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreDuplicateResolution.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreDuplicateResolution.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -183,7 +183,7 @@
long subject = toGraphTuplesIndex(constraint.getElement(0));
long predicate = toGraphTuplesIndex(constraint.getElement(1));
long object = toGraphTuplesIndex(constraint.getElement(2));
- long meta = toGraphTuplesIndex(constraint.getModel());
+ long meta = toGraphTuplesIndex(constraint.getGraph());
// Return the tuples using the s, p, o hints.
baseTuples = store.findTuples(subject, predicate, object, meta);
Modified: trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreInverseResolution.java
===================================================================
--- trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreInverseResolution.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreInverseResolution.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -172,7 +172,7 @@
subject = toGraphTuplesIndex(constraint.getElement(0));
predicate = toGraphTuplesIndex(constraint.getElement(1));
object = toGraphTuplesIndex(constraint.getElement(2));
- metanode = toGraphTuplesIndex(constraint.getModel());
+ metanode = toGraphTuplesIndex(constraint.getGraph());
allFixedConstraints = (subject != NodePool.NONE) &&
(predicate != NodePool.NONE) && (object != NodePool.NONE);
Modified: trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolution.java
===================================================================
--- trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolution.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-store/java/org/mulgara/resolver/store/StatementStoreResolution.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -147,7 +147,7 @@
toGraphTuplesIndex(constraint.getElement(0)) < 0 ||
toGraphTuplesIndex(constraint.getElement(1)) < 0 ||
toGraphTuplesIndex(constraint.getElement(2)) < 0 ||
- toGraphTuplesIndex(constraint.getModel()) < 0;
+ toGraphTuplesIndex(constraint.getGraph()) < 0;
baseDefinition = calculateBaseDefinition(constraint);
fixedLength = calculatePrefixLength(baseDefinition);
@@ -162,7 +162,7 @@
Tuples countTuples = store.findTuples(toGraphTuplesIndex(constraint.getElement(0)),
toGraphTuplesIndex(constraint.getElement(1)),
toGraphTuplesIndex(constraint.getElement(2)),
- toGraphTuplesIndex(constraint.getModel()));
+ toGraphTuplesIndex(constraint.getGraph()));
long rowCount = countTuples.getRowCount();
countTuples.close();
@@ -180,7 +180,7 @@
countTuples = store.findTuples(toGraphTuplesIndex(constraint.getElement(0)),
toGraphTuplesIndex(constraint.getElement(1)),
toGraphTuplesIndex(constraint.getElement(2)),
- toGraphTuplesIndex(constraint.getModel()));
+ toGraphTuplesIndex(constraint.getGraph()));
int rowCount = 0;
countTuples.beforeFirst();
while (countTuples.next()) {
@@ -222,7 +222,7 @@
constraint.getElement(0) instanceof LocalNode,
constraint.getElement(1) instanceof LocalNode,
constraint.getElement(2) instanceof LocalNode,
- constraint.getModel() instanceof LocalNode
+ constraint.getGraph() instanceof LocalNode
};
}
Modified: trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraint.java
===================================================================
--- trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-test/java/org/mulgara/resolver/test/TestConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -39,6 +39,7 @@
package org.mulgara.resolver.test;
// Java packages
+import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
@@ -49,6 +50,7 @@
import org.mulgara.query.Constraint;
import org.mulgara.query.ConstraintElement;
import org.mulgara.query.Variable;
+import org.mulgara.query.filter.Filter;
import org.mulgara.query.rdf.LiteralImpl;
@@ -63,14 +65,12 @@
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class TestConstraint implements Constraint {
+public class TestConstraint implements Constraint, Serializable {
// /** Logger */
// private static Logger logger = Logger.getLogger(TestConstraint.class);
- /**
- * Fixme, generate proper version UID
- */
- static final long serialVersionUID = 0000000000000000001L;
+ /** ID for serializing */
+ private static final long serialVersionUID = -171274827754305623L;
private Variable var1;
private Variable var2;
@@ -132,7 +132,7 @@
return vars;
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
throw new IllegalStateException("TestConstraint is of fixed extent, no model available");
}
@@ -159,4 +159,11 @@
testSelection.equals(rhs.testSelection) &&
testParam.equals(rhs.testParam);
}
+
+ public Filter getFilter() {
+ return Filter.NULL;
+ }
+
+ public void setFilter(Filter filter) {
+ }
}
Modified: trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java
===================================================================
--- trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-url/java/org/mulgara/resolver/url/URLResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -295,7 +295,7 @@
if (constraint == null) {
throw new IllegalArgumentException("constraint null");
}
- else if (!(constraint.getModel() instanceof LocalNode)) {
+ else if (!(constraint.getGraph() instanceof LocalNode)) {
throw new QueryException("Constraint model can't be variable");
}
Modified: trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java
===================================================================
--- trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-view/java/org/mulgara/resolver/view/ViewResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -245,7 +245,7 @@
if (logger.isDebugEnabled()) {
logger.debug("Resolve " + constraint);
}
- ConstraintElement modelElem = constraint.getModel();
+ ConstraintElement modelElem = constraint.getGraph();
if (!(modelElem instanceof LocalNode)) {
logger.warn("Ignoring solutions for " + constraint);
return new EmptyResolution(constraint, false);
Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraint.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraint.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalConstraint.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -49,6 +49,7 @@
import org.mulgara.query.Constraint;
import org.mulgara.query.ConstraintElement;
import org.mulgara.query.Variable;
+import org.mulgara.query.filter.Filter;
import org.mulgara.query.rdf.URIReferenceImpl;
import org.jrdf.graph.URIReference;
@@ -110,7 +111,10 @@
*/
private final URIReference model;
- /**
+ /** The filter to use on resolutions */
+ protected Filter filter = Filter.NULL;
+
+ /**
* Sole constructor.
*
* @param variable the variable to constrain, never <code>null</code>
@@ -161,7 +165,7 @@
}
- public ConstraintElement getModel() {
+ public ConstraintElement getGraph() {
return new URIReferenceImpl(model.getURI());
}
@@ -327,4 +331,21 @@
buffer.append("]");
return buffer.toString();
}
+
+ /**
+ * Adds a filter to this constraint.
+ * @param filter The filter for this constraint.
+ */
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ /**
+ * Gets the filter for this constraint.
+ * @return Always null.
+ */
+ public Filter getFilter() {
+ return filter;
+ }
+
}
Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -268,7 +268,7 @@
// Confirm model is of type XSDModel.
try {
- ConstraintElement modelElement = constraintImpl.getModel();
+ ConstraintElement modelElement = constraintImpl.getGraph();
if (!(modelElement instanceof URIReference)) {
logger.debug("model not URIReference; cannot participate in transform returning null");
return null;
@@ -331,7 +331,7 @@
variable,
boundedBelow ? bound : null,
boundedBelow ? null : bound,
- (URIReference)constraintImpl.getModel()
+ (URIReference)constraintImpl.getGraph()
);
}
}
Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/XSDResolver.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -208,7 +208,7 @@
logger.debug("!! Resolving " + constraint);
}
- if (constraint.getModel() instanceof Variable) {
+ if (constraint.getGraph() instanceof Variable) {
logger.warn("Ignoring solutions for " + constraint);
return new EmptyResolution(constraint, false);
}
@@ -224,7 +224,7 @@
(LocalNode) oppositePropertyMap.get(
constraint.getElement(1)),
constraint.getElement(0),
- constraint.getModel());
+ constraint.getGraph());
}
long property = ((LocalNode) constraint.getElement(1)).getValue();
Modified: trunk/src/jar/tuples/java/org/mulgara/store/tuples/ConstrainedNegationTuples.java
===================================================================
--- trunk/src/jar/tuples/java/org/mulgara/store/tuples/ConstrainedNegationTuples.java 2008-03-17 20:21:35 UTC (rev 682)
+++ trunk/src/jar/tuples/java/org/mulgara/store/tuples/ConstrainedNegationTuples.java 2008-03-17 20:25:39 UTC (rev 683)
@@ -201,7 +201,7 @@
subject = toGraphTuplesIndex(constraint.getElement(0));
predicate = toGraphTuplesIndex(constraint.getElement(1));
object = toGraphTuplesIndex(constraint.getElement(2));
- metanode = toGraphTuplesIndex(constraint.getModel());
+ metanode = toGraphTuplesIndex(constraint.getGraph());
allFixedConstraints = (subject != NodePool.NONE) &&
(predicate != NodePool.NONE) && (object != NodePool.NONE);
More information about the Mulgara-svn
mailing list