Search in sources :

Example 1 with NodeValueString

use of org.apache.jena.sparql.expr.nodevalue.NodeValueString in project jena by apache.

the class NodeValueRewriterTest method visitNodeValueStringNodeTest.

@Test
public void visitNodeValueStringNodeTest() {
    Node n = NodeFactory.createLiteral("Hello");
    NodeValue nv = new NodeValueString("Hello", n);
    nv.visit(rewriter);
    NodeValue result = rewriter.getResult();
    assertEquals(nv, result);
    assertEquals(nv.getClass(), result.getClass());
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) NodeValueNode(org.apache.jena.sparql.expr.nodevalue.NodeValueNode) Node(org.apache.jena.graph.Node) NodeValueString(org.apache.jena.sparql.expr.nodevalue.NodeValueString) Test(org.junit.Test)

Example 2 with NodeValueString

use of org.apache.jena.sparql.expr.nodevalue.NodeValueString in project jena by apache.

the class NodeValueRewriterTest method visitNodeValueStringTest.

@Test
public void visitNodeValueStringTest() {
    NodeValue nv = new NodeValueString("Hello");
    nv.visit(rewriter);
    NodeValue result = rewriter.getResult();
    assertEquals(nv, result);
    assertEquals(nv.getClass(), result.getClass());
}
Also used : NodeValue(org.apache.jena.sparql.expr.NodeValue) NodeValueString(org.apache.jena.sparql.expr.nodevalue.NodeValueString) Test(org.junit.Test)

Example 3 with NodeValueString

use of org.apache.jena.sparql.expr.nodevalue.NodeValueString in project jena by apache.

the class ExprFactoryTest method asExprTest_string.

@Test
public void asExprTest_string() {
    Expr e = factory.asExpr("foo");
    assertTrue(e instanceof NodeValueString);
    NodeValueString n = (NodeValueString) e;
    assertEquals("foo", n.asString());
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) NodeValueString(org.apache.jena.sparql.expr.nodevalue.NodeValueString) Test(org.junit.Test)

Example 4 with NodeValueString

use of org.apache.jena.sparql.expr.nodevalue.NodeValueString in project jena by apache.

the class ExprFactoryTest method asExprTest_asterisk.

@Test
public void asExprTest_asterisk() {
    Expr e = factory.asExpr("*");
    assertTrue(e instanceof NodeValueString);
    NodeValueString n = (NodeValueString) e;
    assertEquals("*", n.asString());
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) NodeValueString(org.apache.jena.sparql.expr.nodevalue.NodeValueString) Test(org.junit.Test)

Example 5 with NodeValueString

use of org.apache.jena.sparql.expr.nodevalue.NodeValueString in project jena by apache.

the class ExprFactoryTest method asExprTest_URIstring.

@Test
public void asExprTest_URIstring() {
    Expr e = factory.asExpr("http://example.com/foo");
    assertTrue(e instanceof NodeValueString);
    NodeValueString n = (NodeValueString) e;
    assertEquals("\"http://example.com/foo\"", n.asNode().toString());
}
Also used : Expr(org.apache.jena.sparql.expr.Expr) NodeValueString(org.apache.jena.sparql.expr.nodevalue.NodeValueString) Test(org.junit.Test)

Aggregations

NodeValueString (org.apache.jena.sparql.expr.nodevalue.NodeValueString)7 Test (org.junit.Test)6 Expr (org.apache.jena.sparql.expr.Expr)4 ExprList (org.apache.jena.sparql.expr.ExprList)2 ExprVar (org.apache.jena.sparql.expr.ExprVar)2 Arrays (java.util.Arrays)1 Optional (java.util.Optional)1 Random (java.util.Random)1 Function (java.util.function.Function)1 IntStream (java.util.stream.IntStream)1 Node (org.apache.jena.graph.Node)1 Triple (org.apache.jena.graph.Triple)1 ResourceImpl (org.apache.jena.rdf.model.impl.ResourceImpl)1 Op (org.apache.jena.sparql.algebra.Op)1 OpVisitorBase (org.apache.jena.sparql.algebra.OpVisitorBase)1 OpVisitorByTypeBase (org.apache.jena.sparql.algebra.OpVisitorByTypeBase)1 TransformCopy (org.apache.jena.sparql.algebra.TransformCopy)1 Transformer (org.apache.jena.sparql.algebra.Transformer)1 Op2 (org.apache.jena.sparql.algebra.op.Op2)1 OpBGP (org.apache.jena.sparql.algebra.op.OpBGP)1