use of org.apache.clerezza.rdf.core.sparql.query.BinaryOperation in project stanbol by apache.
the class SumAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.SumAtom tmp = (org.apache.stanbol.rules.manager.atoms.SumAtom) ruleAtom;
NumericFunctionAtom numericFunctionAtom1 = tmp.getNumericFunctionAtom1();
NumericFunctionAtom numericFunctionAtom2 = tmp.getNumericFunctionAtom2();
ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom1, ConstructQuery.class);
ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom2, ConstructQuery.class);
Expression lhsOperand = (Expression) argument1.getClerezzaObject();
Expression rhsOperand = (Expression) argument2.getClerezzaObject();
BinaryOperation binaryOperation = new BinaryOperation("+", lhsOperand, rhsOperand);
return (T) new ClerezzaSparqlObject(binaryOperation);
}
use of org.apache.clerezza.rdf.core.sparql.query.BinaryOperation in project stanbol by apache.
the class DifferentAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.DifferentAtom tmp = (org.apache.stanbol.rules.manager.atoms.DifferentAtom) ruleAtom;
ExpressionAtom stringFunctionAtom1 = tmp.getStringFunctionAtom1();
ExpressionAtom stringFunctionAtom2 = tmp.getStringFunctionAtom1();
ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(stringFunctionAtom1, ConstructQuery.class);
ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(stringFunctionAtom2, ConstructQuery.class);
Expression lhe = (Expression) argument1.getClerezzaObject();
Expression rhe = (Expression) argument2.getClerezzaObject();
BinaryOperation binaryOperation = new BinaryOperation("!=", lhe, rhe);
return (T) new ClerezzaSparqlObject(binaryOperation);
}
use of org.apache.clerezza.rdf.core.sparql.query.BinaryOperation in project stanbol by apache.
the class DivisionAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.DivisionAtom tmp = (org.apache.stanbol.rules.manager.atoms.DivisionAtom) ruleAtom;
NumericFunctionAtom numericFunctionAtom1 = tmp.getNumericFunctionAtom1();
NumericFunctionAtom numericFunctionAtom2 = tmp.getNumericFunctionAtom2();
ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom1, ConstructQuery.class);
ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(numericFunctionAtom2, ConstructQuery.class);
Expression lhsOperand = (Expression) argument1.getClerezzaObject();
Expression rhsOperand = (Expression) argument2.getClerezzaObject();
BinaryOperation binaryOperation = new BinaryOperation("/", lhsOperand, rhsOperand);
return (T) new ClerezzaSparqlObject(binaryOperation);
}
use of org.apache.clerezza.rdf.core.sparql.query.BinaryOperation in project stanbol by apache.
the class LessThanAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.LessThanAtom tmp = (org.apache.stanbol.rules.manager.atoms.LessThanAtom) ruleAtom;
ExpressionAtom argument1 = tmp.getArgument1();
ExpressionAtom argument2 = tmp.getArgument2();
ClerezzaSparqlObject clerezzaArgument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1, ConstructQuery.class);
ClerezzaSparqlObject clerezzaArgument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2, ConstructQuery.class);
Expression lhe = (Expression) clerezzaArgument1.getClerezzaObject();
Expression rhe = (Expression) clerezzaArgument2.getClerezzaObject();
return (T) new ClerezzaSparqlObject(new BinaryOperation("<", lhe, rhe));
}
use of org.apache.clerezza.rdf.core.sparql.query.BinaryOperation in project stanbol by apache.
the class SameAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException {
org.apache.stanbol.rules.manager.atoms.SameAtom tmp = (org.apache.stanbol.rules.manager.atoms.SameAtom) ruleAtom;
ExpressionAtom argument1 = tmp.getStringFunctionAtom1();
ExpressionAtom argument2 = tmp.getStringFunctionAtom2();
ClerezzaSparqlObject clerezzaArgument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1, ConstructQuery.class);
ClerezzaSparqlObject clerezzaArgument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2, ConstructQuery.class);
Expression lhe = (Expression) clerezzaArgument1.getClerezzaObject();
Expression rhe = (Expression) clerezzaArgument2.getClerezzaObject();
return (T) new ClerezzaSparqlObject(new BinaryOperation("=", lhe, rhe));
}
Aggregations