org.apache.jena.sparql.expr.ExprEvalException Java Examples

The following examples show how to use org.apache.jena.sparql.expr.ExprEvalException. 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: IteratorFunctionBase3.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final List<List<NodeValue>> exec(List<NodeValue> args) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 3) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 3, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    NodeValue v3 = args.get(2);
    return exec(v1, v2, v3);
}
 
Example #2
Source File: IsValidForDatatypeFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
@Override
protected NodeValue exec(Node literalNode, Node datatypeNode, FunctionEnv env) {
	
	if(literalNode == null || !literalNode.isLiteral()) {
		throw new ExprEvalException();
	}
	String lex = literalNode.getLiteralLexicalForm();
	
	if(!datatypeNode.isURI()) {
		throw new ExprEvalException();
	}
	RDFDatatype datatype = TypeMapper.getInstance().getTypeByName(datatypeNode.getURI());
	
	if(datatype == null) {
		return NodeValue.TRUE;
	}
	else {
		boolean valid = datatype.isValid(lex);
		return NodeValue.makeBoolean(valid);
	}
}
 
Example #3
Source File: FUN_Property.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
    if (args == null) {
        throw new ARQInternalErrorException("FunctionBase: Null args list");
    }
    if (args.size() != 2) {
        throw new ExprEvalException("Expecting two argument");
    }
    NodeValue file = args.get(0).eval(binding, env);
    NodeValue propertyNode = args.get(1).eval(binding, env);
    if (!propertyNode.isString()) {
        throw new ExprEvalException("Second argument must be a string. Got " + propertyNode);
    }
    Properties properties;
    try {
        properties = getProperties(file, env);
    } catch (IOException ex) {
        throw new ExprEvalException("IOException while extracting properties document " + file, ex);
    }
    String prop = properties.getProperty(propertyNode.getString());
    if (prop == null) {
        throw new ExprEvalException("Property " + prop + " not found in properties document " + file);
    }
    return new NodeValueString(prop);
}
 
Example #4
Source File: CheckRegexSyntaxFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
@Override
protected NodeValue exec(Node regexNode, FunctionEnv env) {
	if(regexNode == null || !regexNode.isLiteral()) {
		return NodeValue.makeString("Invalid argument to spif:checkRegexSyntax: " + regexNode);
	}
	else {
		String str = regexNode.getLiteralLexicalForm();
		try {
			Pattern.compile(str);
		}
		catch(Exception ex) {
			return NodeValue.makeString(ex.getMessage());
		}
		throw new ExprEvalException(); // OK
	}
}
 
Example #5
Source File: FUN_MixedCase.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(NodeValue node) {
    if (!node.isString()) {
        LOG.debug("The input should be a string. Got " + node);
        throw new ExprEvalException("The input should be a string. Got " + node);
    }
    String string = node.getString();
    StringBuilder converted = new StringBuilder();
    boolean convertNext = false;
    for (char ch : string.toCharArray()) {
        if (Character.isWhitespace(ch)) {
            convertNext = true;
        } else if (!Character.isLetterOrDigit(ch)) {
        } else if (convertNext) {
            converted.append(Character.toUpperCase(ch));
            convertNext = false;
        } else {
            converted.append(ch);
        }
    }
    return new NodeValueString(converted.toString());
}
 
Example #6
Source File: TargetContainsPFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
@Override
public QueryIterator exec(Binding binding, PropFuncArg argSubject,
		Node predicate, PropFuncArg argObject, ExecutionContext execCxt) {

	argSubject = Substitute.substitute(argSubject, binding);
	argObject = Substitute.substitute(argObject, binding);
	
	if(!argObject.getArg().isVariable()) {
		throw new ExprEvalException("Right hand side of tosh:targetContains must be a variable");
	}
	
	Node targetNode = argSubject.getArgList().get(0);
	Node shapesGraphNode = argSubject.getArgList().get(1);
	
	Model currentModel = ModelFactory.createModelForGraph(execCxt.getActiveGraph());
	Dataset dataset = new DatasetWithDifferentDefaultModel(currentModel, DatasetImpl.wrap(execCxt.getDataset()));

	Model model = dataset.getNamedModel(shapesGraphNode.getURI());
	Resource target = (Resource) model.asRDFNode(targetNode);

	Set<Node> focusNodes = new HashSet<Node>();
	SHACLUtil.addNodesInTarget(target, dataset, focusNodes);
	return new QueryIterExtendByVar(binding, (Var) argObject.getArg(), focusNodes.iterator(), execCxt);
}
 
Example #7
Source File: FUN_Markdown.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(NodeValue markdown) {
    if (markdown.getDatatypeURI() != null
            && !markdown.getDatatypeURI().equals(datatypeUri)
            && !markdown.getDatatypeURI().equals("http://www.w3.org/2001/XMLSchema#string")) {
        LOG.debug("The URI of NodeValue1 must be <" + datatypeUri + ">"
                + "or <http://www.w3.org/2001/XMLSchema#string>."
        );
    }
    try {
    	String md = markdown.asNode().getLiteralLexicalForm();
     Parser parser = Parser.builder().build();
     Node document = parser.parse(md);
     HtmlRenderer renderer = HtmlRenderer.builder().build();
     String html = renderer.render(document);
     return new NodeValueString(html);
    } catch (Exception ex) {
        throw new ExprEvalException("FunctionBase: no evaluation", ex);
    }
}
 
Example #8
Source File: ExpandPrefixFunction.java    From tarql with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public NodeValue exec(NodeValue prefix, Context context) {
	if (prefix == null) {
		return null;
	}
	if (!prefix.isString()) {
		throw new ExprEvalException(NAME + ": not a string: " + prefix);
	}
	PrefixMapping prefixes = context.get(PREFIX_MAPPING);
	if (prefixes == null) {
		throw new ExprEvalException(NAME + ": no prefix mapping registered");
	}
	String iri = prefixes.getNsPrefixURI(prefix.asString());
	if (iri == null) {
		throw new ExprEvalException(NAME + ": prefix not defined: " + prefix);
	}
	return NodeValue.makeString(iri);
}
 
Example #9
Source File: FUN_JSONPath.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(NodeValue json, NodeValue jsonpath) {
    if (json.getDatatypeURI() != null
            && !json.getDatatypeURI().equals(datatypeUri)
            && !json.getDatatypeURI().equals("http://www.w3.org/2001/XMLSchema#string")) {
        LOG.debug("The datatype of the first argument should be <" + datatypeUri + ">"
                + " or <http://www.w3.org/2001/XMLSchema#string>. Got "
                + json.getDatatypeURI());
    }
    if (!jsonpath.isString()) {
        LOG.debug("The second argument should be a string. Got " + json);
    }

    try {
        Object value = JsonPath.parse(json.asNode().getLiteralLexicalForm())
                .limit(1).read(jsonpath.getString());
        return nodeForObject(value);
    } catch (Exception ex) {
        if(LOG.isDebugEnabled()) {
            Node compressed = LogUtils.compress(json.asNode());
            LOG.debug("No evaluation of " + compressed + ", " + jsonpath);
        }
        throw new ExprEvalException("No evaluation of " + jsonpath);
    }
}
 
Example #10
Source File: SHACLSPARQLARQFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
@Override
   public NodeValue executeBody(Dataset dataset, Model defaultModel, QuerySolution bindings) {
    try( QueryExecution qexec = createQueryExecution(dataset, defaultModel, bindings) ) {
        if(arqQuery.isAskType()) {
            boolean result = qexec.execAsk();
            return NodeValue.makeBoolean(result);
        }
        else {
            ResultSet rs = qexec.execSelect();
            if(rs.hasNext()) {
                QuerySolution s = rs.nextSolution();
                List<String> resultVars = rs.getResultVars();
                String varName = resultVars.get(0);
                RDFNode resultNode = s.get(varName);
                if(resultNode != null) {
                    return NodeValue.makeNode(resultNode.asNode());
                }
            }
            throw new ExprEvalException("Empty result set for SHACL function");
        }
    }
}
 
Example #11
Source File: SHACLSPARQLARQFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new SHACLSPARQLARQFunction based on a given sh:Function.
 * The shaclFunction must be associated with the Model containing
 * the triples of its definition.
 * @param shaclFunction  the SHACL function
 */
public SHACLSPARQLARQFunction(SHSPARQLFunction shaclFunction) {
	
	super(shaclFunction);
	
	try {
		queryString = shaclFunction.getSPARQL();
		arqQuery = ARQFactory.get().createQuery(SPARQLSubstitutions.withPrefixes(queryString, shaclFunction));
	}
	catch(Exception ex) {
		throw new IllegalArgumentException("Function " + shaclFunction.getURI() + " does not define a valid body", ex);
	}
	if(!arqQuery.isAskType() && !arqQuery.isSelectType()) {
           throw new ExprEvalException("Body must be ASK or SELECT query");
	}

	addParameters(shaclFunction);
}
 
Example #12
Source File: SHACLSPARQLARQFunction.java    From shacl with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new SHACLSPARQLARQFunction based on a given sh:ConstraintComponent
 * and a given validator (which must be a value of sh:nodeValidator, sh:propertyValidator etc.
 * @param component  the constraint component (defining the sh:parameters)
 * @param askValidator  the sh:SPARQLAskValidator resource
 */
public SHACLSPARQLARQFunction(SHConstraintComponent component, Resource askValidator) {
	
	super(null);
	
	try {
		queryString = JenaUtil.getStringProperty(askValidator, SH.ask);
		arqQuery = ARQFactory.get().createQuery(SPARQLSubstitutions.withPrefixes(queryString, askValidator));
	}
	catch(Exception ex) {
		throw new IllegalArgumentException("Validator " + askValidator + " does not define a valid body", ex);
	}
	if(!arqQuery.isAskType()) {
           throw new ExprEvalException("Body must be ASK query");
	}
	
	paramNames.add("value");
	addParameters(component);
	paramNames.add("shapesGraph");
}
 
Example #13
Source File: SHACLFunctionsCache.java    From shacl with Apache License 2.0 6 votes vote down vote up
public NodeValue execute(SHACLARQFunction function, Dataset dataset, Model defaultModel, QuerySolution bindings, Node[] args) {
	Key key = new Key(function.getSHACLFunction().getURI(), args);
	Result result = cache.get(key);
	if(result == null) {
		result = new Result();
		try {
			result.nodeValue = function.executeBody(dataset, defaultModel, bindings);
		}
		catch(ExprEvalException ex) {
			result.ex = ex;
		}
		cache.put(key, result);
	}
	if(result.ex != null) {
		throw new ExprEvalException(result.ex.getMessage());
	}
	else {
		return result.nodeValue;
	}
}
 
Example #14
Source File: JenaUtil.java    From shacl with Apache License 2.0 6 votes vote down vote up
private static Node invokeFunction(Resource function, ExprList args, Dataset dataset) {

		if (dataset == null) {
	        dataset = ARQFactory.get().getDataset(ModelFactory.createDefaultModel());
	    }
		
		E_Function expr = new E_Function(function.getURI(), args);
		DatasetGraph dsg = dataset.asDatasetGraph();
		Context cxt = ARQ.getContext().copy();
		cxt.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime());
		FunctionEnv env = new ExecutionContext(cxt, dsg.getDefaultGraph(), dsg, null);
		try {
			NodeValue r = expr.eval(BindingRoot.create(), env);
			if(r != null) {
				return r.asNode();
			}
		}
		catch(ExprEvalException ex) {
		}
		return null;
	}
 
Example #15
Source File: ST_Format.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
public NodeValue exec(List<NodeValue> args, FunctionEnv env) {
    if (args.size() < 1) {
        LOG.debug("Expecting at least one arguments.");
        throw new ExprEvalException("Expecting at least one arguments.");
    }
    final NodeValue format = args.get(0);
    if (!format.isIRI() && !format.isString() && !format.asNode().isLiteral()) {
        LOG.debug("First argument must be a URI or a String.");
        throw new ExprEvalException("First argument must be a URI or a String.");
    }

    Object[] params = new String[args.size() - 1];
    for (int i = 0; i < args.size() - 1; i++) {
        params[i] = args.get(i + 1).asUnquotedString();
    }
    try {
        String output = String.format(getString(format, env), params);
        return new NodeValueString(output);
    } catch (IllegalFormatException ex) {
        throw new ExprEvalException("Exception while executing st:format(" + args + ")");
    }
}
 
Example #16
Source File: ITER_DefaultGraphNamespaces.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public List<List<NodeValue>> exec(List<NodeValue> args) {
    if (!args.isEmpty()) {
        LOG.debug("Expecting zero arguments.");
        throw new ExprEvalException("Expecting zero arguments.");
    }
    
    Dataset dataset = ContextUtils.getDataset(getContext());
    
    List<List<NodeValue>> output = new ArrayList<>();
    for (Map.Entry<String, String> prefix : dataset.getDefaultModel().getNsPrefixMap().entrySet()) {
        List<NodeValue> ns = new ArrayList<>();
        ns.add(new NodeValueString(prefix.getKey()));
        ns.add(new NodeValueString(prefix.getValue()));
        output.add(ns);
    }
    return output;
}
 
Example #17
Source File: ITER_Call_Select.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public void exec(
        final List<NodeValue> args,
        final Consumer<List<List<NodeValue>>> collectionListNodeValue) {
    if (args.isEmpty()) {
        LOG.debug("There should be at least one IRI parameter.");
        throw new ExprEvalException("There should be at least one IRI parameter.");
    }
    if (!args.get(0).isIRI()) {
        LOG.debug("The first parameter must be a IRI.");
        throw new ExprEvalException("The first parameter must be a IRI.");
    }
    String queryName = args.get(0).asNode().getURI();

    final List<List<Node>> callParameters = new ArrayList<>();
    callParameters.add(EvalUtils.eval(args.subList(1, args.size())));

    final Context context = ContextUtils.fork(getContext()).setSelectOutput((result) -> {
        List<List<NodeValue>> list = getListNodeValues(result);
        collectionListNodeValue.accept(list);
    }).fork();
    final QueryExecutor queryExecutor = ContextUtils.getQueryExecutor(context);
    queryExecutor.execSelectFromName(queryName, callParameters, context);
}
 
Example #18
Source File: ST_Decr.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
    if (args == null) {
        throw new ARQInternalErrorException("FunctionBase: Null args list");
    }
    if (args.size() != 0) {
        throw new ExprEvalException("Expecting zero argument");
    }
    IndentedWriter writer = ContextUtils.getTemplateOutput(env.getContext());
    if(writer != null) {
    	writer.decIndent();
    } else {
    	LOG.warn("calling st:decr() outside TEMPLATE context.");
    }
    return EMPTY_NODE;
}
 
Example #19
Source File: IteratorStreamFunctionBase3.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void exec(List<NodeValue> args, Consumer<List<List<NodeValue>>> nodeValuesStream) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 3) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 3, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    NodeValue v3 = args.get(2);
    exec(v1, v2, v3, nodeValuesStream);
}
 
Example #20
Source File: IteratorFunctionBase2.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final List<List<NodeValue>> exec(List<NodeValue> args) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 2) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 2, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    return exec(v1, v2);
}
 
Example #21
Source File: IteratorFunctionBase4.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final List<List<NodeValue>> exec(List<NodeValue> args) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 4) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 4, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    NodeValue v3 = args.get(2);
    NodeValue v4 = args.get(3);
    return exec(v1, v2, v3, v4);
}
 
Example #22
Source File: FUN_CamelCase.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(NodeValue node) {
    if (!node.isString()) {
        LOG.debug("The input should be a string. Got " + node);
        throw new ExprEvalException("The input should be a string. Got " + node);
    }
    String string = node.getString();
    StringBuilder converted = new StringBuilder();
    boolean convertNext = true;
    for (char ch : string.toCharArray()) {
        if (Character.isWhitespace(ch)) {
            convertNext = true;
        } else if (!Character.isLetterOrDigit(ch)) {
        } else if (convertNext) {
            converted.append(Character.toUpperCase(ch));
            convertNext = false;
        } else {
            converted.append(ch);
        }
    }
    return new NodeValueString(converted.toString());
}
 
Example #23
Source File: IteratorFunctionBase5.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final List<List<NodeValue>> exec(List<NodeValue> args) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 5) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 5, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    NodeValue v3 = args.get(2);
    NodeValue v4 = args.get(3);
    NodeValue v5 = args.get(4);
    return exec(v1, v2, v3, v4, v5);
}
 
Example #24
Source File: IteratorStreamFunctionBase2.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void exec(List<NodeValue> args, Consumer<List<List<NodeValue>>> nodeValuesStream) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 2) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 2, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    exec(v1, v2, nodeValuesStream);
}
 
Example #25
Source File: FUN_Markdown.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(NodeValue markdown) {
    if (markdown.getDatatypeURI() != null
            && !markdown.getDatatypeURI().equals(datatypeUri)
            && !markdown.getDatatypeURI().equals("http://www.w3.org/2001/XMLSchema#string")) {
        LOG.debug("The URI of NodeValue1 must be <" + datatypeUri + ">"
                + "or <http://www.w3.org/2001/XMLSchema#string>."
        );
    }
    try {
    	String md = markdown.asNode().getLiteralLexicalForm();
     Parser parser = Parser.builder().build();
     Node document = parser.parse(md);
     HtmlRenderer renderer = HtmlRenderer.builder().build();
     String html = renderer.render(document);
     return new NodeValueString(html);
    } catch (Exception ex) {
        throw new ExprEvalException("FunctionBase: no evaluation", ex);
    }
}
 
Example #26
Source File: IteratorStreamFunctionBase5.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public final void exec(List<NodeValue> args, Consumer<List<List<NodeValue>>> nodeValuesStream) {
    if (args == null) {
        throw new ARQInternalErrorException(this.getClass().getName()
                + ": Null args list");
    }
    if (args.size() != 5) {
        throw new ExprEvalException(this.getClass().getName()
                + ": Wrong number of arguments: Wanted 5, got "
                + args.size());
    }
    NodeValue v1 = args.get(0);
    NodeValue v2 = args.get(1);
    NodeValue v3 = args.get(2);
    NodeValue v4 = args.get(3);
    NodeValue v5 = args.get(4);
    exec(v1, v2, v3, v4, v5, nodeValuesStream);
}
 
Example #27
Source File: BindPlan.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
protected final Binding exec(Binding binding, Context context) {
    LOG.debug("Start " + this);
    context.set(ARQConstants.sysCurrentTime, NodeFactoryExtra.nowAsDateTime());
    final FunctionEnv env = new FunctionEnvBase(context);
    try {
        final NodeValue n = expr.eval(binding, env);
        if (LOG.isTraceEnabled()) {
            LOG.trace("New binding " + var + " = " + LogUtils.compress(n.asNode()));
        }
        return BindingFactory.binding(binding, var, n.asNode());
    } catch(ExprEvalException ex) {
        LOG.trace("No evaluation for " + this + " " + ex.getMessage());
        return binding;
    }
}
 
Example #28
Source File: IteratorStreamFunctionBase.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public final void exec(
        final Binding binding,
        final ExprList args,
        final FunctionEnv env,
        final Consumer<List<List<NodeValue>>> collectionListNodeValue) {

    this.env = env;
    if (args == null) {
        throw new ARQInternalErrorException("IteratorFunctionBase:"
                + " Null args list");
    }

    List<NodeValue> evalArgs = new ArrayList<>();
    for (Expr e : args) {
        try {
            NodeValue x = e.eval(binding, env);
            evalArgs.add(x);
        } catch (ExprEvalException ex) {
            LOG.trace("Cannot evaluate node " + e + ": " + ex.getMessage());
            evalArgs.add(null);
        }
    }
    exec(evalArgs, collectionListNodeValue);
}
 
Example #29
Source File: ST_Incr.java    From sparql-generate with Apache License 2.0 6 votes vote down vote up
@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
    if (args == null) {
        throw new ARQInternalErrorException("FunctionBase: Null args list");
    }
    if (args.size() != 0) {
        throw new ExprEvalException("Expecting zero argument");
    }
    IndentedWriter writer = ContextUtils.getTemplateOutput(env.getContext());
    if(writer != null) {
    	writer.incIndent();
    } else {
    	LOG.warn("calling st:incr() outside TEMPLATE context.");
    }
    return EMPTY_NODE;
}
 
Example #30
Source File: ExpandPrefixedNameTest.java    From tarql with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Test
public void testUndefinedPrefix() {
	try {
		eval("tarql:expandPrefixedName('dc')");
		fail();
	} catch (ExprEvalException ex) {}
}