use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.
the class SubstringAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.SubstringAtom tmp = (org.apache.stanbol.rules.manager.atoms.SubstringAtom) ruleAtom;
StringFunctionAtom argument = tmp.getStringFunctionAtom();
NumericFunctionAtom start = tmp.getStart();
NumericFunctionAtom length = tmp.getLength();
ClerezzaSparqlObject clerezzaArgument = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
ClerezzaSparqlObject clerezzaStart = (ClerezzaSparqlObject) adapter.adaptTo(start, ConstructQuery.class);
ClerezzaSparqlObject clerezzaLength = (ClerezzaSparqlObject) adapter.adaptTo(length, ConstructQuery.class);
List<Expression> argumentExpressions = new ArrayList<Expression>();
argumentExpressions.add((Expression) clerezzaArgument.getClerezzaObject());
argumentExpressions.add((Expression) clerezzaStart.getClerezzaObject());
argumentExpressions.add((Expression) clerezzaLength.getClerezzaObject());
FunctionCall functionCall = new FunctionCall(new IRI("<http://www.w3.org/2005/xpath-functions#substring>"), argumentExpressions);
return (T) new ClerezzaSparqlObject(functionCall);
}
use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.
the class ConcatAtom method adapt.
@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
org.apache.stanbol.rules.manager.atoms.ConcatAtom tmp = (org.apache.stanbol.rules.manager.atoms.ConcatAtom) ruleAtom;
StringFunctionAtom argument1Atom = tmp.getArgument1();
StringFunctionAtom argument2Atom = tmp.getArgument2();
ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument1Atom, ConstructQuery.class);
ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(argument2Atom, ConstructQuery.class);
List<Expression> argumentExpressions = new ArrayList<Expression>();
argumentExpressions.add((Expression) argument1.getClerezzaObject());
argumentExpressions.add((Expression) argument2.getClerezzaObject());
FunctionCall functionCall = new FunctionCall(new IRI("<http://www.w3.org/2005/xpath-functions#concat>"), argumentExpressions);
return (T) new ClerezzaSparqlObject(functionCall);
}
Aggregations