-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Issue #164: extended query eval strategy
- Loading branch information
Showing
28 changed files
with
2,452 additions
and
2,077 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...main/java/org/eclipse/rdf4j/query/algebra/evaluation/impl/ExtendedEvaluationStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2016 Eclipse RDF4J contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*/ | ||
package org.eclipse.rdf4j.query.algebra.evaluation.impl; | ||
|
||
import org.eclipse.rdf4j.model.Value; | ||
import org.eclipse.rdf4j.model.impl.BooleanLiteral; | ||
import org.eclipse.rdf4j.query.BindingSet; | ||
import org.eclipse.rdf4j.query.Dataset; | ||
import org.eclipse.rdf4j.query.QueryEvaluationException; | ||
import org.eclipse.rdf4j.query.algebra.Compare; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.TripleSource; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.ValueExprEvaluationException; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.federation.FederatedServiceResolver; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.util.QueryEvaluationUtil; | ||
|
||
/** | ||
* SPARQL 1.1 extended query evaluation strategy. This strategy adds the use of virtual properties, as well as | ||
* extended comparison operators to the minimally-conforming {@link StrictEvaluationStrategy}. | ||
* | ||
* @author Jeen Broekstra | ||
*/ | ||
public class ExtendedEvaluationStrategy extends TupleFunctionEvaluationStrategy { | ||
|
||
public ExtendedEvaluationStrategy(TripleSource tripleSource, Dataset dataset, | ||
FederatedServiceResolver serviceResolver) | ||
{ | ||
super(tripleSource, dataset, serviceResolver); | ||
} | ||
|
||
@Override | ||
public Value evaluate(Compare node, BindingSet bindings) | ||
throws ValueExprEvaluationException, QueryEvaluationException | ||
{ | ||
Value leftVal = evaluate(node.getLeftArg(), bindings); | ||
Value rightVal = evaluate(node.getRightArg(), bindings); | ||
|
||
// return result of non-strict comparison. | ||
return BooleanLiteral.valueOf( | ||
QueryEvaluationUtil.compare(leftVal, rightVal, node.getOperator(), false)); | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...va/org/eclipse/rdf4j/query/algebra/evaluation/impl/ExtendedEvaluationStrategyFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016 Eclipse RDF4J contributors. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Distribution License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*******************************************************************************/ | ||
package org.eclipse.rdf4j.query.algebra.evaluation.impl; | ||
|
||
import org.eclipse.rdf4j.query.Dataset; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.EvaluationStrategy; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.EvaluationStrategyFactory; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.TripleSource; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.federation.FederatedServiceResolver; | ||
import org.eclipse.rdf4j.query.algebra.evaluation.federation.FederatedServiceResolverClient; | ||
|
||
public class ExtendedEvaluationStrategyFactory | ||
implements EvaluationStrategyFactory, FederatedServiceResolverClient | ||
{ | ||
|
||
private FederatedServiceResolver serviceResolver; | ||
|
||
public ExtendedEvaluationStrategyFactory() { | ||
} | ||
|
||
public ExtendedEvaluationStrategyFactory(FederatedServiceResolver resolver) { | ||
this.serviceResolver = resolver; | ||
} | ||
|
||
@Override | ||
public void setFederatedServiceResolver(FederatedServiceResolver resolver) { | ||
this.serviceResolver = resolver; | ||
} | ||
|
||
public FederatedServiceResolver getFederatedServiceResolver() { | ||
return serviceResolver; | ||
} | ||
|
||
@Override | ||
public EvaluationStrategy createEvaluationStrategy(Dataset dataset, TripleSource tripleSource) { | ||
return new ExtendedEvaluationStrategy(tripleSource, dataset, serviceResolver); | ||
} | ||
} |
Oops, something went wrong.