Search in sources :

Example 26 with Expression

use of org.apache.clerezza.rdf.core.sparql.query.Expression 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));
}
Also used : BinaryOperation(org.apache.clerezza.rdf.core.sparql.query.BinaryOperation) ExpressionAtom(org.apache.stanbol.rules.manager.atoms.ExpressionAtom) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)

Aggregations

Expression (org.apache.clerezza.rdf.core.sparql.query.Expression)26 ClerezzaSparqlObject (org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)25 ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)22 ArrayList (java.util.ArrayList)14 StringFunctionAtom (org.apache.stanbol.rules.manager.atoms.StringFunctionAtom)11 BinaryOperation (org.apache.clerezza.rdf.core.sparql.query.BinaryOperation)10 IRI (org.apache.clerezza.commons.rdf.IRI)8 FunctionCall (org.apache.clerezza.rdf.core.sparql.query.FunctionCall)7 BuiltInCall (org.apache.clerezza.rdf.core.sparql.query.BuiltInCall)6 ExpressionAtom (org.apache.stanbol.rules.manager.atoms.ExpressionAtom)6 NumericFunctionAtom (org.apache.stanbol.rules.manager.atoms.NumericFunctionAtom)5 Variable (org.apache.clerezza.rdf.core.sparql.query.Variable)4 IObjectAtom (org.apache.stanbol.rules.manager.atoms.IObjectAtom)4 LiteralExpression (org.apache.clerezza.rdf.core.sparql.query.LiteralExpression)2 RuleAtomCallExeption (org.apache.stanbol.rules.base.api.RuleAtomCallExeption)2 HashSet (java.util.HashSet)1 PlainLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl)1 TriplePattern (org.apache.clerezza.rdf.core.sparql.query.TriplePattern)1 UnaryOperation (org.apache.clerezza.rdf.core.sparql.query.UnaryOperation)1 UriRefExpression (org.apache.clerezza.rdf.core.sparql.query.UriRefExpression)1