Search in sources :

Example 31 with StringFunctionAtom

use of org.apache.stanbol.rules.manager.atoms.StringFunctionAtom in project stanbol by apache.

the class NewIRIAtom method adapt.

@SuppressWarnings("unchecked")
@Override
public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException {
    org.apache.stanbol.rules.manager.atoms.NewIRIAtom tmp = (org.apache.stanbol.rules.manager.atoms.NewIRIAtom) ruleAtom;
    StringFunctionAtom bindingAtom = tmp.getBinding();
    IObjectAtom variableAtom = tmp.getNewNodeVariable();
    ClerezzaSparqlObject binding = (ClerezzaSparqlObject) adapter.adaptTo(bindingAtom, ConstructQuery.class);
    ClerezzaSparqlObject variable = (ClerezzaSparqlObject) adapter.adaptTo(variableAtom, ConstructQuery.class);
    List<Expression> iriArgumentExpressions = new ArrayList<Expression>();
    iriArgumentExpressions.add((Expression) binding.getClerezzaObject());
    BuiltInCall iriBuiltInCall = new BuiltInCall("IRI", iriArgumentExpressions);
    List<Expression> bindArgumentExpressions = new ArrayList<Expression>();
    bindArgumentExpressions.add(iriBuiltInCall);
    bindArgumentExpressions.add((Expression) variable.getClerezzaObject());
    BuiltInCall bindBuiltInCall = new BuiltInCall("BIND", bindArgumentExpressions);
    return (T) new ClerezzaSparqlObject(bindBuiltInCall);
}
Also used : ArrayList(java.util.ArrayList) BuiltInCall(org.apache.clerezza.rdf.core.sparql.query.BuiltInCall) IObjectAtom(org.apache.stanbol.rules.manager.atoms.IObjectAtom) 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)

Example 32 with StringFunctionAtom

use of org.apache.stanbol.rules.manager.atoms.StringFunctionAtom in project stanbol by apache.

the class RuleParserImpl method createLabelAtom.

public final StringFunctionAtom createLabelAtom() throws ParseException {
    StringFunctionAtom stringFunctionAtom;
    jj_consume_token(CREATE_LABEL);
    jj_consume_token(LPAR);
    stringFunctionAtom = stringFunctionAtom();
    jj_consume_token(RPAR);
    {
        if (true)
            return new CreateLabelAtom(stringFunctionAtom);
    }
    throw new Error("Missing return statement in function");
}
Also used : StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) CreateLabelAtom(org.apache.stanbol.rules.manager.atoms.CreateLabelAtom)

Example 33 with StringFunctionAtom

use of org.apache.stanbol.rules.manager.atoms.StringFunctionAtom in project stanbol by apache.

the class RuleParserImpl method newLiteralAtom.

public final NewLiteralAtom newLiteralAtom() throws ParseException {
    IObjectAtom arg1;
    StringFunctionAtom arg2;
    jj_consume_token(NEW_LITERAL);
    jj_consume_token(LPAR);
    arg1 = iObject();
    jj_consume_token(COMMA);
    arg2 = stringFunctionAtom();
    jj_consume_token(RPAR);
    {
        if (true)
            return new NewLiteralAtom(arg1, arg2);
    }
    throw new Error("Missing return statement in function");
}
Also used : StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) NewLiteralAtom(org.apache.stanbol.rules.manager.atoms.NewLiteralAtom) IObjectAtom(org.apache.stanbol.rules.manager.atoms.IObjectAtom)

Example 34 with StringFunctionAtom

use of org.apache.stanbol.rules.manager.atoms.StringFunctionAtom in project stanbol by apache.

the class RuleParserImpl method concatAtom.

public final ConcatAtom concatAtom() throws ParseException {
    StringFunctionAtom arg1;
    StringFunctionAtom arg2;
    jj_consume_token(CONCAT);
    jj_consume_token(LPAR);
    arg1 = stringFunctionAtom();
    jj_consume_token(COMMA);
    arg2 = stringFunctionAtom();
    jj_consume_token(RPAR);
    {
        if (true)
            return new ConcatAtom(arg1, arg2);
    }
    throw new Error("Missing return statement in function");
}
Also used : StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) ConcatAtom(org.apache.stanbol.rules.manager.atoms.ConcatAtom)

Example 35 with StringFunctionAtom

use of org.apache.stanbol.rules.manager.atoms.StringFunctionAtom in project stanbol by apache.

the class RuleParserImpl method endsWithAtom.

public final ComparisonAtom endsWithAtom() throws ParseException {
    RuleAtom ruleAtom;
    StringFunctionAtom arg;
    StringFunctionAtom stringFunctionAtom;
    jj_consume_token(ENDS_WITH);
    jj_consume_token(LPAR);
    arg = stringFunctionAtom();
    jj_consume_token(COMMA);
    stringFunctionAtom = stringFunctionAtom();
    jj_consume_token(RPAR);
    {
        if (true)
            return new EndsWithAtom(arg, stringFunctionAtom);
    }
    throw new Error("Missing return statement in function");
}
Also used : StringFunctionAtom(org.apache.stanbol.rules.manager.atoms.StringFunctionAtom) EndsWithAtom(org.apache.stanbol.rules.manager.atoms.EndsWithAtom) RuleAtom(org.apache.stanbol.rules.base.api.RuleAtom)

Aggregations

StringFunctionAtom (org.apache.stanbol.rules.manager.atoms.StringFunctionAtom)38 ArrayList (java.util.ArrayList)15 Expression (org.apache.clerezza.rdf.core.sparql.query.Expression)11 ClerezzaSparqlObject (org.apache.stanbol.rules.adapters.clerezza.ClerezzaSparqlObject)11 ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)10 SPARQLObject (org.apache.stanbol.rules.base.api.SPARQLObject)10 RuleAtomCallExeption (org.apache.stanbol.rules.base.api.RuleAtomCallExeption)9 SPARQLFunction (org.apache.stanbol.rules.adapters.sparql.SPARQLFunction)8 IRI (org.apache.clerezza.commons.rdf.IRI)7 FunctionCall (org.apache.clerezza.rdf.core.sparql.query.FunctionCall)7 IObjectAtom (org.apache.stanbol.rules.manager.atoms.IObjectAtom)6 BuiltInCall (org.apache.clerezza.rdf.core.sparql.query.BuiltInCall)4 UnavailableRuleObjectException (org.apache.stanbol.rules.base.api.UnavailableRuleObjectException)4 UnsupportedTypeForExportException (org.apache.stanbol.rules.base.api.UnsupportedTypeForExportException)4 NumericFunctionAtom (org.apache.stanbol.rules.manager.atoms.NumericFunctionAtom)4 ArgumentSWRLAtom (org.apache.stanbol.rules.adapters.swrl.ArgumentSWRLAtom)3 HigherOrderSWRLAtom (org.apache.stanbol.rules.adapters.swrl.HigherOrderSWRLAtom)3 OWLDataFactory (org.semanticweb.owlapi.model.OWLDataFactory)3 SWRLArgument (org.semanticweb.owlapi.model.SWRLArgument)3 SWRLAtom (org.semanticweb.owlapi.model.SWRLAtom)3