@SuppressWarnings("unchecked") @Override public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException { org.apache.stanbol.rules.manager.atoms.StrAtom tmp = (org.apache.stanbol.rules.manager.atoms.StrAtom) ruleAtom; IObjectAtom uriResource = tmp.getUriResource(); ClerezzaSparqlObject clerezzaSparqlObject = (ClerezzaSparqlObject) adapter.adaptTo(uriResource, ConstructQuery.class); List<Expression> expressions = new ArrayList<Expression>(); expressions.add((Expression) clerezzaSparqlObject.getClerezzaObject()); return (T) new ClerezzaSparqlObject(new BuiltInCall("STR", expressions)); }
private void appendExpression(StringBuffer s, Expression e) { if (e instanceof Variable) { appendVariable(s, (Variable) e); } else if (e instanceof BinaryOperation) { BinaryOperation bo = (BinaryOperation) e; s.append("("); appendExpression(s, bo.getLhsOperand()); s.append(") ").append(bo.getOperatorString()).append(" ("); appendExpression(s, bo.getRhsOperand()); s.append(")"); } else if (e instanceof UnaryOperation) { UnaryOperation uo = (UnaryOperation) e; s.append(uo.getOperatorString()).append(" ("); appendExpression(s, uo.getOperand()); s.append(")"); } else if (e instanceof BuiltInCall) { BuiltInCall b = (BuiltInCall) e; appendCall(s, b.getName(), b.getArguements()); } else if (e instanceof FunctionCall) { FunctionCall f = (FunctionCall) e; appendCall(s, f.getName().getUnicodeString(), f.getArguements()); } else if (e instanceof LiteralExpression) { appendLiteralExpression(s, (LiteralExpression) e); } else if (e instanceof UriRefExpression) { s.append(((UriRefExpression) e).getUriRef().toString()); } }
@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); }
private void appendExpression(StringBuffer s, Expression e) { if (e instanceof Variable) { appendVariable(s, (Variable) e); } else if (e instanceof BinaryOperation) { BinaryOperation bo = (BinaryOperation) e; s.append("("); appendExpression(s, bo.getLhsOperand()); s.append(") ").append(bo.getOperatorString()).append(" ("); appendExpression(s, bo.getRhsOperand()); s.append(")"); } else if (e instanceof UnaryOperation) { UnaryOperation uo = (UnaryOperation) e; s.append(uo.getOperatorString()).append(" ("); appendExpression(s, uo.getOperand()); s.append(")"); } else if (e instanceof BuiltInCall) { BuiltInCall b = (BuiltInCall) e; appendCall(s, b.getName(), b.getArguements()); } else if (e instanceof FunctionCall) { FunctionCall f = (FunctionCall) e; appendCall(s, f.getName().getUnicodeString(), f.getArguements()); } else if (e instanceof LiteralExpression) { appendLiteralExpression(s, (LiteralExpression) e); } else if (e instanceof UriRefExpression) { s.append(((UriRefExpression) e).getUriRef().toString()); } }
@SuppressWarnings("unchecked") @Override public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException { org.apache.stanbol.rules.manager.atoms.IsBlankAtom tmp = (org.apache.stanbol.rules.manager.atoms.IsBlankAtom) ruleAtom; IObjectAtom uriResource = tmp.getUriResource(); ClerezzaSparqlObject argumentCSO = (ClerezzaSparqlObject) adapter.adaptTo(uriResource, ConstructQuery.class); ; Object arg = argumentCSO.getClerezzaObject(); Expression argumentExpression; if (arg instanceof Variable) { argumentExpression = (Variable) arg; } else if (arg instanceof IRI) { argumentExpression = new UriRefExpression((IRI) arg); } else { throw new RuleAtomCallExeption(getClass()); } List<Expression> expressions = new ArrayList<Expression>(); expressions.add(argumentExpression); return (T) new ClerezzaSparqlObject(new BuiltInCall("isBLANK", expressions)); }
@SuppressWarnings("unchecked") @Override public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException { org.apache.stanbol.rules.manager.atoms.LetAtom tmp = (org.apache.stanbol.rules.manager.atoms.LetAtom) ruleAtom; StringFunctionAtom parameterFunctionAtom = tmp.getParameterFunctionAtom(); URIResource variableUriResource = tmp.getVariable(); ClerezzaSparqlObject iriArgument; iriArgument = (ClerezzaSparqlObject) adapter.adaptTo(parameterFunctionAtom, ConstructQuery.class); List<Expression> iriArgumentExpressions = new ArrayList<Expression>(); iriArgumentExpressions.add((Expression) iriArgument.getClerezzaObject()); BuiltInCall iriBuiltInCall = new BuiltInCall("IRI", iriArgumentExpressions); if (variableUriResource instanceof VariableAtom) { String variableName = ((VariableAtom) variableUriResource).getVariableName(); Variable variable = new Variable(variableName); List<Expression> bindArgumentExpressions = new ArrayList<Expression>(); bindArgumentExpressions.add(iriBuiltInCall); bindArgumentExpressions.add(variable); BuiltInCall bindBuiltInCall = new BuiltInCall("BIND", iriArgumentExpressions); return (T) new ClerezzaSparqlObject(bindBuiltInCall); } else { throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass()); } }
@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()); BuiltInCall builtInCall = new BuiltInCall("BOUND", argumentExpressions); UnaryOperation unaryOperation = new UnaryOperation("!", builtInCall); return (T) new ClerezzaSparqlObject(unaryOperation); }
@SuppressWarnings("unchecked") @Override public <T> T adapt(RuleAtom ruleAtom) throws RuleAtomCallExeption, UnavailableRuleObjectException, UnsupportedTypeForExportException { org.apache.stanbol.rules.manager.atoms.NewLiteralAtom tmp = (org.apache.stanbol.rules.manager.atoms.NewLiteralAtom) 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> bindArgumentExpressions = new ArrayList<Expression>(); bindArgumentExpressions.add((Expression) binding.getClerezzaObject()); bindArgumentExpressions.add((Expression) variable.getClerezzaObject()); BuiltInCall bindBuiltInCall = new BuiltInCall("BIND", bindArgumentExpressions); return (T) new ClerezzaSparqlObject(bindBuiltInCall); }
final private BuiltInCall RegexExpression() throws ParseException { List<Expression> args = new ArrayList<Expression>(); Expression e = null; jj_consume_token(REGEX); jj_consume_token(46); e = Expression(); args.add(e); jj_consume_token(47); e = Expression(); args.add(e); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 47: jj_consume_token(47); e = Expression(); args.add(e); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(48); {if (true) return new BuiltInCall("REGEX", args);} throw new Error("Missing return statement in function"); }
final private BuiltInCall RegexExpression() throws ParseException { List<Expression> args = new ArrayList<Expression>(); Expression e = null; jj_consume_token(REGEX); jj_consume_token(46); e = Expression(); args.add(e); jj_consume_token(47); e = Expression(); args.add(e); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 47: jj_consume_token(47); e = Expression(); args.add(e); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(48); {if (true) return new BuiltInCall("REGEX", args);} throw new Error("Missing return statement in function"); }
throw new ParseException(); {if (true) return new BuiltInCall(name, args);} throw new Error("Missing return statement in function");
throw new ParseException(); {if (true) return new BuiltInCall(name, args);} throw new Error("Missing return statement in function");
throw new ParseException(); {if (true) return new BuiltInCall(name, args);} throw new Error("Missing return statement in function");
throw new ParseException(); {if (true) return new BuiltInCall(name, args);} throw new Error("Missing return statement in function");