Search in sources :

Example 1 with FunctionCall

use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.

the class UpperCaseAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.UpperCaseAtom tmp = (org.apache.stanbol.rules.manager.atoms.UpperCaseAtom) ruleAtom;
    StringFunctionAtom argument = tmp.getStringFunctionAtom();
    ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
    List<Expression> argumentExpressions = new ArrayList<Expression>();
    argumentExpressions.add((Expression) argument1.getClerezzaObject());
    FunctionCall functionCall = new FunctionCall(new IRI("<http://www.w3.org/2005/xpath-functions#upper-case>"), argumentExpressions);
    return (T) new ClerezzaSparqlObject(functionCall);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) ArrayList(java.util.ArrayList) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject) FunctionCall(org.apache.clerezza.rdf.core.sparql.query.FunctionCall)

Example 2 with FunctionCall

use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.

the class LengthAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.LengthAtom tmp = (org.apache.stanbol.rules.manager.atoms.LengthAtom) ruleAtom;
    StringFunctionAtom argument = tmp.getStringFunctionAtom();
    ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
    List<Expression> argumentExpressions = new ArrayList<Expression>();
    argumentExpressions.add((Expression) argument1.getClerezzaObject());
    FunctionCall functionCall = new FunctionCall(new IRI("<http://www.w3.org/2005/xpath-functions#string-length>"), argumentExpressions);
    return (T) new ClerezzaSparqlObject(functionCall);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) ArrayList(java.util.ArrayList) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject) FunctionCall(org.apache.clerezza.rdf.core.sparql.query.FunctionCall)

Example 3 with FunctionCall

use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.

the class LowerCaseAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.LowerCaseAtom tmp = (org.apache.stanbol.rules.manager.atoms.LowerCaseAtom) ruleAtom;
    StringFunctionAtom argument = tmp.getStringFunctionAtom();
    ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
    List<Expression> argumentExpressions = new ArrayList<Expression>();
    argumentExpressions.add((Expression) argument1.getClerezzaObject());
    FunctionCall functionCall = new FunctionCall(new IRI("<http://www.w3.org/2005/xpath-functions#lower-case>"), argumentExpressions);
    return (T) new ClerezzaSparqlObject(functionCall);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) ArrayList(java.util.ArrayList) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject) FunctionCall(org.apache.clerezza.rdf.core.sparql.query.FunctionCall)

Example 4 with FunctionCall

use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.

the class EndsWithAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.EndsWithAtom tmp = (org.apache.stanbol.rules.manager.atoms.EndsWithAtom) ruleAtom;
    StringFunctionAtom argument = tmp.getArgument();
    StringFunctionAtom term = tmp.getTerm();
    ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
    ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(term, 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#ends-with>"), argumentExpressions);
    return (T) new ClerezzaSparqlObject(functionCall);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) ArrayList(java.util.ArrayList) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject) FunctionCall(org.apache.clerezza.rdf.core.sparql.query.FunctionCall)

Example 5 with FunctionCall

use of org.apache.clerezza.rdf.core.sparql.query.FunctionCall in project stanbol by apache.

the class StartsWithAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.StartsWithAtom tmp = (org.apache.stanbol.rules.manager.atoms.StartsWithAtom) ruleAtom;
    StringFunctionAtom argument = tmp.getArgument();
    StringFunctionAtom term = tmp.getTerm();
    ClerezzaSparqlObject argument1 = (ClerezzaSparqlObject) adapter.adaptTo(argument, ConstructQuery.class);
    ClerezzaSparqlObject argument2 = (ClerezzaSparqlObject) adapter.adaptTo(term, 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#starts-with>"), argumentExpressions);
    return (T) new ClerezzaSparqlObject(functionCall);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) ArrayList(java.util.ArrayList) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) Expression(org.apache.clerezza.rdf.core.sparql.query.Expression) ClerezzaSparqlObject(org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject) FunctionCall(org.apache.clerezza.rdf.core.sparql.query.FunctionCall)

Aggregations

ArrayList (java.util.ArrayList)7 IRI (org.apache.clerezza.commons.rdf.IRI)7 ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)7 Expression (org.apache.clerezza.rdf.core.sparql.query.Expression)7 FunctionCall (org.apache.clerezza.rdf.core.sparql.query.FunctionCall)7 ClerezzaSparqlObject (org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)7 StringFunctionAtom (org.apache.stanbol.rules.manager.atoms.StringFunctionAtom)7 NumericFunctionAtom (org.apache.stanbol.rules.manager.atoms.NumericFunctionAtom)1