diff --exclude=.svn --exclude=.classpath --exclude=.project --exclude=target -ruN evaluation/pom.xml evaluation-set-injection/pom.xml --- evaluation/pom.xml 2008-11-25 14:35:52.000000000 +0100 +++ evaluation-set-injection/pom.xml 2008-11-25 13:53:13.000000000 +0100 @@ -9,7 +9,7 @@ sesame-queryalgebra-evaluation - 2.2.1 + 2.2.1-set-injection OpenRDF Sesame: Query algebra - evaluation Evaluation strategy API and implementations for the query algebra model. @@ -18,6 +18,7 @@ org.openrdf.sesame sesame-queryalgebra-model + 2.2.1-set-injection org.openrdf.sesame diff --exclude=.svn --exclude=.classpath --exclude=.project --exclude=target -ruN evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStatistics.java evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStatistics.java --- evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStatistics.java 2008-08-26 14:39:39.000000000 +0200 +++ evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStatistics.java 2008-09-01 14:35:06.000000000 +0200 @@ -18,6 +18,7 @@ import org.openrdf.query.algebra.TupleExpr; import org.openrdf.query.algebra.UnaryTupleOperator; import org.openrdf.query.algebra.Var; +import org.openrdf.query.algebra.evaluation.util.ExternalSet; import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; /** @@ -66,7 +67,14 @@ } @Override - public void meet(StatementPattern sp) { + public void meet(org.openrdf.query.algebra.Set node) + { + cardinality = node.cardinality(); + } + + @Override + public void meet(StatementPattern sp) + { cardinality = getCardinality(sp); } @@ -126,4 +134,4 @@ throw new IllegalArgumentException("Unhandled node type: " + node.getClass()); } } -} \ Kein Zeilenumbruch am Dateiende. +} diff --exclude=.svn --exclude=.classpath --exclude=.project --exclude=target -ruN evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStrategyImpl.java evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStrategyImpl.java --- evaluation/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStrategyImpl.java 2008-11-25 14:35:51.000000000 +0100 +++ evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/impl/EvaluationStrategyImpl.java 2008-11-25 13:52:53.000000000 +0100 @@ -109,6 +109,7 @@ import org.openrdf.query.algebra.evaluation.iterator.MultiProjectionIterator; import org.openrdf.query.algebra.evaluation.iterator.OrderIterator; import org.openrdf.query.algebra.evaluation.iterator.ProjectionIterator; +import org.openrdf.query.algebra.evaluation.util.ExternalSet; import org.openrdf.query.algebra.evaluation.util.OrderComparator; import org.openrdf.query.algebra.evaluation.util.QueryEvaluationUtil; import org.openrdf.query.algebra.evaluation.util.ValueComparator; @@ -161,6 +162,9 @@ else if (expr instanceof BinaryTupleOperator) { return evaluate((BinaryTupleOperator)expr, bindings); } + else if (expr instanceof ExternalSet) { + return evaluate((ExternalSet)expr, bindings); + } else if (expr instanceof SingletonSet) { return evaluate((SingletonSet)expr, bindings); } @@ -605,6 +609,13 @@ return new MinusIteration(leftArg, rightArg); } + public CloseableIteration evaluate(ExternalSet externalSet, + BindingSet bindings) + throws QueryEvaluationException + { + return externalSet.newIterator(bindings); + } + public CloseableIteration evaluate(SingletonSet singletonSet, BindingSet bindings) throws QueryEvaluationException diff --exclude=.svn --exclude=.classpath --exclude=.project --exclude=target -ruN evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/ExternalSet.java evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/util/ExternalSet.java --- evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/ExternalSet.java 1970-01-01 01:00:00.000000000 +0100 +++ evaluation-set-injection/src/main/java/org/openrdf/query/algebra/evaluation/util/ExternalSet.java 2008-09-01 14:35:06.000000000 +0200 @@ -0,0 +1,21 @@ +/* + * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006. + * + * Licensed under the Aduna BSD-style license. + */ +package org.openrdf.query.algebra.evaluation.util; + +import info.aduna.iteration.CloseableIteration; + +import org.openrdf.query.BindingSet; +import org.openrdf.query.QueryEvaluationException; +import org.openrdf.query.algebra.Set; + + +/** + * A tuple expression that contains exactly one solution with zero bindings. + */ +public abstract class ExternalSet extends Set { + public abstract int cardinality(java.util.Set boundVars); + public abstract CloseableIteration newIterator(BindingSet bindings) throws QueryEvaluationException; +}