Search in sources :

Example 1 with Node_Literal

use of org.apache.jena.graph.Node_Literal in project jena by apache.

the class TestFmtUtils method stringLiteral.

@Test
public void stringLiteral() throws Exception {
    Node_Literal nl = (Node_Literal) NodeFactory.createLiteral("abc", "no", new XSDDatatype("string"));
    assertEquals("\"abc\"@no", FmtUtils.stringForLiteral(nl, getContext()));
}
Also used : Node_Literal(org.apache.jena.graph.Node_Literal) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Test(org.junit.Test)

Example 2 with Node_Literal

use of org.apache.jena.graph.Node_Literal in project jena by apache.

the class TestFmtUtils method decimalLiteral.

@Test
public void decimalLiteral() throws Exception {
    Node_Literal nl = (Node_Literal) NodeFactory.createLiteral("2.4", new XSDDatatype("decimal"));
    assertEquals("2.4", FmtUtils.stringForLiteral(nl, getContext()));
}
Also used : Node_Literal(org.apache.jena.graph.Node_Literal) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Test(org.junit.Test)

Example 3 with Node_Literal

use of org.apache.jena.graph.Node_Literal in project jena by apache.

the class TestFmtUtils method integerLiteral.

@Test
public void integerLiteral() throws Exception {
    Node_Literal nl = (Node_Literal) NodeFactory.createLiteral("2", new XSDDatatype("int"));
    assertEquals("\"2\"^^<http://www.w3.org/2001/XMLSchema#int>", FmtUtils.stringForLiteral(nl, getContext()));
}
Also used : Node_Literal(org.apache.jena.graph.Node_Literal) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Test(org.junit.Test)

Example 4 with Node_Literal

use of org.apache.jena.graph.Node_Literal in project jena by apache.

the class TestFmtUtils method booleanLiteral.

@Test
public void booleanLiteral() throws Exception {
    Node_Literal nl = (Node_Literal) NodeFactory.createLiteral("false", new XSDDatatype("boolean"));
    assertEquals("false", FmtUtils.stringForLiteral(nl, getContext()));
}
Also used : Node_Literal(org.apache.jena.graph.Node_Literal) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Test(org.junit.Test)

Example 5 with Node_Literal

use of org.apache.jena.graph.Node_Literal in project jena by apache.

the class TestFmtUtils method doubleLiteral.

@Test
public void doubleLiteral() throws Exception {
    Node_Literal nl = (Node_Literal) NodeFactory.createLiteral("2.1e2", new XSDDatatype("double"));
    assertEquals("2.1e2", FmtUtils.stringForLiteral(nl, getContext()));
}
Also used : Node_Literal(org.apache.jena.graph.Node_Literal) XSDDatatype(org.apache.jena.datatypes.xsd.XSDDatatype) Test(org.junit.Test)

Aggregations

XSDDatatype (org.apache.jena.datatypes.xsd.XSDDatatype)5 Node_Literal (org.apache.jena.graph.Node_Literal)5 Test (org.junit.Test)5