@Test public void testEvaluate3() { Literal pattern = f.createLiteral("FooBar"); Literal startIndex = f.createLiteral(4); try { lcaseFunc.evaluate(f, pattern, startIndex); fail("illegal number of parameters"); } catch (ValueExprEvaluationException e) { } }
@Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }
LowerCase implements Function { @Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } }
LowerCase implements Function { @Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }  }
LowerCase implements Function { @Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }  @Override String getURI(); @Override Literal evaluate(ValueFactory valueFactory, Value... args); }
LowerCase implements Function { @Override public Literal evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 1) { throw new ValueExprEvaluationException("LCASE requires exactly 1 argument, got " + args.length); } if (args[0] instanceof Literal) { Literal literal = (Literal) args[0]; if (QueryEvaluationUtil.isStringLiteral(literal)) { String lexicalValue = literal.getLabel().toLowerCase(); Optional<String> language = literal.getLanguage(); if (language.isPresent()) { return valueFactory.createLiteral(lexicalValue, language.get()); } else if (XMLSchema.STRING.equals(literal.getDatatype())) { return valueFactory.createLiteral(lexicalValue, XMLSchema.STRING); } else { return valueFactory.createLiteral(lexicalValue); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } } else { throw new ValueExprEvaluationException("unexpected input value for function: " + args[0]); } }  @Override String getURI(); @Override Literal evaluate(ValueFactory valueFactory, Value... args);  }