use of org.apache.stanbol.rules.manager.RuleImpl in project stanbol by apache.
the class RuleParserImpl method prefix.
public final void prefix() throws ParseException {
String nsPrefix;
Object obj;
Rule rule;
nsPrefix = getVariable();
switch((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
case EQUAL:
obj = equality();
String prefixURI = (String) obj;
prefixURI = prefixURI.substring(1, prefixURI.length() - 1);
kb.addPrefix(nsPrefix, prefixURI);
break;
case LQUAD:
obj = rule();
AtomList[] atoms = (AtomList[]) obj;
String ruleStorePrefix = kb.getPrefixURI("rmi2");
ruleStorePrefix = ruleStorePrefix.substring(0, ruleStorePrefix.length());
if (atoms.length == 1) {
AtomList body = atoms[0];
if (body.size() == 1) {
// FIXME it previously managed SPARQL code injection.
}
} else {
rule = new RuleImpl(new IRI(ruleStorePrefix + nsPrefix), nsPrefix, atoms[0], atoms[1]);
kb.addRule(rule);
}
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}