Search in sources :

Example 1 with RuleBlankNode

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

the class RuleParserImpl method variable.

public final IObjectAtom variable() throws ParseException {
    Token t;
    String var;
    switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case NOTEX:
            jj_consume_token(NOTEX);
            jj_consume_token(LPAR);
            t = jj_consume_token(VARIABLE);
            jj_consume_token(RPAR);
            var = t.image;
            var = kb.getPrefixURI("var") + var.substring(1);
            try {
                {
                    if (true)
                        return new VariableAtom(new URI(var), true);
                }
            } catch (URISyntaxException e) {
                e.printStackTrace();
                {
                    if (true)
                        return null;
                }
            }
            break;
        case VARIABLE:
            t = jj_consume_token(VARIABLE);
            var = t.image;
            var = kb.getPrefixURI("var") + var.substring(1);
            try {
                {
                    if (true)
                        return new VariableAtom(new URI(var), false);
                }
            } catch (URISyntaxException e) {
                e.printStackTrace();
                {
                    if (true)
                        return null;
                }
            }
            break;
        case BNODE:
            t = jj_consume_token(BNODE);
            var = t.image;
            {
                if (true)
                    return new RuleBlankNode(var);
            }
            break;
        default:
            jj_la1[15] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}
Also used : RuleBlankNode(org.apache.stanbol.rules.manager.atoms.RuleBlankNode) NumericVariableAtom(org.apache.stanbol.rules.manager.atoms.NumericVariableAtom) StringVariableAtom(org.apache.stanbol.rules.manager.atoms.StringVariableAtom) VariableAtom(org.apache.stanbol.rules.manager.atoms.VariableAtom) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 NumericVariableAtom (org.apache.stanbol.rules.manager.atoms.NumericVariableAtom)1 RuleBlankNode (org.apache.stanbol.rules.manager.atoms.RuleBlankNode)1 StringVariableAtom (org.apache.stanbol.rules.manager.atoms.StringVariableAtom)1 VariableAtom (org.apache.stanbol.rules.manager.atoms.VariableAtom)1