Search in sources :

Example 26 with RDF_Term

use of org.apache.jena.riot.thrift.wire.RDF_Term in project jena by apache.

the class TestThriftTerm method term_literal_03.

@Test
public void term_literal_03() {
    RDF_Term rt = testTerm("123");
    assertFalse(rt.getLiteral().isSetDatatype());
    assertTrue(rt.getLiteral().isSetDtPrefix());
    assertEquals(rt.getLiteral().getDtPrefix().getPrefix(), "xsd");
    assertEquals(rt.getLiteral().getDtPrefix().getLocalName(), "integer");
}
Also used : RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Example 27 with RDF_Term

use of org.apache.jena.riot.thrift.wire.RDF_Term in project jena by apache.

the class TestThriftTerm method rdfterm_02.

@Test
public void rdfterm_02() {
    RDF_Term rt = TRDF.tUNDEF;
    Node n = ThriftConvert.convert(rt);
    assertNull(n);
}
Also used : Node(org.apache.jena.graph.Node) RDF_BNode(org.apache.jena.riot.thrift.wire.RDF_BNode) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Example 28 with RDF_Term

use of org.apache.jena.riot.thrift.wire.RDF_Term in project jena by apache.

the class TestThriftTerm method testTermBytes.

private void testTermBytes(Node node) {
    RDF_Term rt = ThriftConvert.convert(node, false);
    byte[] b = ThriftConvert.termToBytes(rt);
    RDF_Term rt2 = ThriftConvert.termFromBytes(b);
    Node node2 = ThriftConvert.convert(rt2);
    assertEquals(node, node2);
}
Also used : Node(org.apache.jena.graph.Node) RDF_BNode(org.apache.jena.riot.thrift.wire.RDF_BNode) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 29 with RDF_Term

use of org.apache.jena.riot.thrift.wire.RDF_Term in project jena by apache.

the class TestThriftTerm method term_value_13.

@Test
public void term_value_13() {
    RDF_Term rt = testTermValue("50.05");
    assertTrue(rt.isSetValDecimal());
    assertEquals(5005, rt.getValDecimal().getValue());
    assertEquals(2, rt.getValDecimal().getScale());
}
Also used : RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Example 30 with RDF_Term

use of org.apache.jena.riot.thrift.wire.RDF_Term in project jena by apache.

the class TestThriftTerm method term_uri_02.

@Test
public void term_uri_02() {
    RDF_Term rt = testTerm("<http://example/>");
    assertTrue(rt.isSetPrefixName());
    assertEquals(rt.getPrefixName().prefix, "");
    assertEquals(rt.getPrefixName().localName, "");
}
Also used : RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Aggregations

RDF_Term (org.apache.jena.riot.thrift.wire.RDF_Term)38 Test (org.junit.Test)25 Node (org.apache.jena.graph.Node)12 RDF_BNode (org.apache.jena.riot.thrift.wire.RDF_BNode)6 TProtocol (org.apache.thrift.protocol.TProtocol)6 TException (org.apache.thrift.TException)4 RiotThriftException (org.apache.jena.riot.thrift.RiotThriftException)2 Var (org.apache.jena.sparql.core.Var)2 TDBException (org.apache.jena.tdb2.TDBException)2 TransactionException (org.apache.jena.dboe.transaction.txn.TransactionException)1 RDF_IRI (org.apache.jena.riot.thrift.wire.RDF_IRI)1 RDF_Literal (org.apache.jena.riot.thrift.wire.RDF_Literal)1 NodeId (org.apache.jena.tdb2.store.NodeId)1 TTransportException (org.apache.thrift.transport.TTransportException)1