org.apache.jena.sparql.expr.ExprFunctionOp Java Examples
The following examples show how to use
org.apache.jena.sparql.expr.ExprFunctionOp.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExprNormalizer.java From sparql-generate with Apache License 2.0 | 6 votes |
/** * normalizes an expression, substituting every instance of NodeValueNode * whose node is a Node_Extended with the associated expression of that * Node_Extended. * * @param expr expression to normalize * @return */ public Expr normalize(Expr expr) { if (expr instanceof ExprFunction1) { return normalize((ExprFunction1) expr); } else if (expr instanceof ExprFunction2) { return normalize((ExprFunction2) expr); } else if (expr instanceof ExprFunction3) { return normalize((ExprFunction3) expr); } else if (expr instanceof ExprFunctionN) { return normalize((ExprFunctionN) expr); } else if (expr instanceof ExprFunctionOp) { return normalize((ExprFunctionOp) expr); } else if (expr instanceof NodeValueNode) { return normalize((NodeValueNode) expr); } else if (expr instanceof ExprAggregator) { return normalize((ExprAggregator) expr); } return expr; }
Example #2
Source File: ExprNormalizer.java From sparql-generate with Apache License 2.0 | 6 votes |
/** * normalizes an expression, substituting every instance of NodeValueNode * whose node is a Node_Extended with the associated expression of that * Node_Extended. * * @param expr expression to normalize * @return */ public Expr normalize(Expr expr) { if (expr instanceof ExprFunction1) { return normalize((ExprFunction1) expr); } else if (expr instanceof ExprFunction2) { return normalize((ExprFunction2) expr); } else if (expr instanceof ExprFunction3) { return normalize((ExprFunction3) expr); } else if (expr instanceof ExprFunctionN) { return normalize((ExprFunctionN) expr); } else if (expr instanceof ExprFunctionOp) { return normalize((ExprFunctionOp) expr); } else if (expr instanceof NodeValueNode) { return normalize((NodeValueNode) expr); } else if (expr instanceof ExprAggregator) { return normalize((ExprAggregator) expr); } return expr; }
Example #3
Source File: ExprNormalizer.java From sparql-generate with Apache License 2.0 | 5 votes |
private Expr normalize(ExprFunctionOp funcOp) { ExprList args = new ExprList(); for (Expr expr : funcOp.getArgs()) { Expr arg = normalize(expr); args.add(arg); } return funcOp.copy(args, funcOp.getGraphPattern()); }
Example #4
Source File: ExprNormalizer.java From sparql-generate with Apache License 2.0 | 5 votes |
private Expr normalize(ExprFunctionOp funcOp) { ExprList args = new ExprList(); for (Expr expr : funcOp.getArgs()) { Expr arg = normalize(expr); args.add(arg); } return funcOp.copy(args, funcOp.getGraphPattern()); }
Example #5
Source File: SPARQLExtFmtExprSPARQL.java From sparql-generate with Apache License 2.0 | 5 votes |
@Override public void visit(ExprFunctionOp funcOp) { String fn = funcOp.getFunctionPrintName(context); if (funcOp instanceof E_NotExists) { fn = "NOT EXISTS"; } else if (funcOp instanceof E_Exists) { fn = "EXISTS"; } else { throw new ARQInternalErrorException("Unrecognized ExprFunctionOp: " + fn); } SPARQLExtFormatterElement fmtElt = new SPARQLExtFormatterElement(out, context); out.print(fn); out.print(" "); int indent = out.getAbsoluteIndent(); int currentCol = out.getCol(); try { out.setAbsoluteIndent(currentCol); Element el = funcOp.getElement(); if (el == null) { el = OpAsQuery.asQuery(funcOp.getGraphPattern()).getQueryPattern(); } el.visit(fmtElt); } finally { out.setAbsoluteIndent(indent); } }