Search in sources :

Example 6 with RuleAtom

use of org.apache.stanbol.rules.base.api.RuleAtom in project stanbol by apache.

the class UnionAtom method prettyPrint.

@Override
public String prettyPrint() {
    StringBuilder stringBuilder = new StringBuilder();
    stringBuilder.append("the union of the set of conjunctive atoms {");
    boolean first = true;
    for (RuleAtom ruleAtom : atomList1) {
        if (!first) {
            stringBuilder.append(" AND ");
        } else {
            first = false;
        }
        stringBuilder.append(ruleAtom.toString());
    }
    stringBuilder.append("} with the set of conjunctive atoms {");
    first = true;
    for (RuleAtom ruleAtom : atomList2) {
        if (!first) {
            stringBuilder.append(" AND ");
        } else {
            first = false;
        }
        stringBuilder.append(ruleAtom.toString());
    }
    stringBuilder.append("}");
    return stringBuilder.toString();
}
Also used : RuleAtom(org.apache.stanbol.rules.base.api.RuleAtom)

Example 7 with RuleAtom

use of org.apache.stanbol.rules.base.api.RuleAtom in project stanbol by apache.

the class UnionAtom method toString.

@Override
public String toString() {
    String scope1 = "";
    for (RuleAtom ruleAtom : atomList1) {
        if (!scope1.isEmpty()) {
            scope1 += " . ";
        }
        scope1 += ruleAtom.toString();
    }
    String scope2 = "";
    for (RuleAtom ruleAtom : atomList2) {
        if (!scope2.isEmpty()) {
            scope2 += " . ";
        }
        scope2 += ruleAtom.toString();
    }
    return "union(" + scope1 + ", " + scope2 + ")";
}
Also used : RuleAtom(org.apache.stanbol.rules.base.api.RuleAtom)

Example 8 with RuleAtom

use of org.apache.stanbol.rules.base.api.RuleAtom in project stanbol by apache.

the class RuleParserImpl method startsWithAtom.

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

Example 9 with RuleAtom

use of org.apache.stanbol.rules.base.api.RuleAtom in project stanbol by apache.

the class RuleParserImpl method datavaluedPropertyAtom.

public final DatavaluedPropertyAtom datavaluedPropertyAtom() throws ParseException {
    IObjectAtom uri1;
    IObjectAtom uri2;
    RuleAtom obj;
    jj_consume_token(VALUES);
    jj_consume_token(LPAR);
    uri1 = iObject();
    jj_consume_token(COMMA);
    uri2 = iObject();
    jj_consume_token(COMMA);
    obj = dObject();
    jj_consume_token(RPAR);
    {
        if (true)
            return new DatavaluedPropertyAtom(uri1, uri2, obj);
    }
    throw new Error("Missing return statement in function");
}
Also used : DatavaluedPropertyAtom(org.apache.stanbol.rules.manager.atoms.DatavaluedPropertyAtom) IObjectAtom(org.apache.stanbol.rules.manager.atoms.IObjectAtom) RuleAtom(org.apache.stanbol.rules.base.api.RuleAtom)

Example 10 with RuleAtom

use of org.apache.stanbol.rules.base.api.RuleAtom in project stanbol by apache.

the class RuleParserImpl method atomList.

public final AtomList atomList() throws ParseException {
    AtomList atomList = new AtomList();
    RuleAtom kReSAtom;
    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case SAME:
        case DIFFERENT:
        case LESSTHAN:
        case GREATERTHAN:
        case IS:
        case NEW_IRI:
        case NEW_LITERAL:
        case STARTS_WITH:
        case ENDS_WITH:
        case LET:
        case HAS:
        case VALUES:
        case NOT:
        case UNION:
        case IS_BLANK:
            kReSAtom = atom();
            atomList = atomListRest();
            atomList.addToHead(kReSAtom);
            {
                if (true)
                    return atomList;
            }
            break;
        default:
            jj_la1[2] = jj_gen;
            {
                if (true)
                    return atomList;
            }
    }
    throw new Error("Missing return statement in function");
}
Also used : AtomList(org.apache.stanbol.rules.base.api.util.AtomList) RuleAtom(org.apache.stanbol.rules.base.api.RuleAtom)

Aggregations

RuleAtom (org.apache.stanbol.rules.base.api.RuleAtom)33 Test (org.junit.Test)11 RuleAtomCallExeption (org.apache.stanbol.rules.base.api.RuleAtomCallExeption)4 AtomList (org.apache.stanbol.rules.base.api.util.AtomList)4 IObjectAtom (org.apache.stanbol.rules.manager.atoms.IObjectAtom)4 ArrayList (java.util.ArrayList)3 UnsupportedTypeForExportException (org.apache.stanbol.rules.base.api.UnsupportedTypeForExportException)3 ClauseEntry (com.hp.hpl.jena.reasoner.rulesys.ClauseEntry)2 HashSet (java.util.HashSet)2 SPARQLObject (org.apache.stanbol.rules.base.api.SPARQLObject)2 StringFunctionAtom (org.apache.stanbol.rules.manager.atoms.StringFunctionAtom)2 OWLDataFactory (org.semanticweb.owlapi.model.OWLDataFactory)2 SWRLAtom (org.semanticweb.owlapi.model.SWRLAtom)2 Node (com.hp.hpl.jena.graph.Node)1 TriplePattern (com.hp.hpl.jena.reasoner.TriplePattern)1 IRI (org.apache.clerezza.commons.rdf.IRI)1 ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)1 Expression (org.apache.clerezza.rdf.core.sparql.query.Expression)1 LiteralExpression (org.apache.clerezza.rdf.core.sparql.query.LiteralExpression)1 ResourceOrVariable (org.apache.clerezza.rdf.core.sparql.query.ResourceOrVariable)1