use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class TestNodeFunctions method testIsLiteral2.
@Test
public void testIsLiteral2() {
NodeValue nv = NodeValue.makeNode(NodeFactory.createURI("http://example/"));
NodeValue r = NodeFunctions.isLiteral(nv);
assertEquals(NodeValue.FALSE, r);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class TestNodeFunctions method testLangMatches7.
@Test
public void testLangMatches7() {
NodeValue nv = NodeValue.makeString("x");
NodeValue pat = NodeValue.makeString("x-y-z");
NodeValue r = NodeFunctions.langMatches(nv, pat);
assertEquals(NodeValue.FALSE, r);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class TestNodeFunctions method testDatatype6.
@Test(expected = ExprTypeException.class)
public void testDatatype6() {
NodeValue nv = NodeValue.makeNode(NodeFactory.createBlankNode());
NodeValue r = NodeFunctions.datatype(nv);
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class FunctionBase method exec.
@Override
public NodeValue exec(Binding binding, ExprList args, String uri, FunctionEnv env) {
if (args == null)
// The contract on the function interface is that this should not happen.
throw new ARQInternalErrorException("FunctionBase: Null args list");
List<NodeValue> evalArgs = new ArrayList<>();
for (Expr e : args) {
NodeValue x = e.eval(binding, env);
evalArgs.add(x);
}
NodeValue nv = exec(evalArgs);
return nv;
}
use of org.apache.jena.sparql.expr.NodeValue in project jena by apache.
the class TestOrdering method test_lang4.
@Test
public void test_lang4() {
NodeValue nv1 = NodeValue.makeNode(NodeFactory.createLiteral("ABC", "en"));
NodeValue nv2 = NodeValue.makeNode(NodeFactory.createLiteral("abc", "en"));
int x = NodeValue.compareAlways(nv1, nv2);
assertTrue("Lang nodes should sort by lexical if tags the same", Expr.CMP_LESS == x);
int y = NodeUtils.compareRDFTerms(nv1.asNode(), nv2.asNode());
assertTrue("Lang nodes should sort by lexical form if lang tags the same", Expr.CMP_LESS == x);
}
Aggregations