Search in sources :

Example 16 with RDF_Term

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

the class TestThriftTerm method term_value_04.

@Test
public void term_value_04() {
    RDF_Term rt = testTermValue("'123'^^xsd:int");
    assertTrue(rt.isSetValInteger());
    assertEquals(123, rt.getValInteger());
}
Also used : RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Example 17 with RDF_Term

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

the class TestThriftTerm method term_literal_04.

@Test
public void term_literal_04() {
    RDF_Term rt = testTerm("'foo'^^<http://dataype/>");
    assertTrue(rt.getLiteral().isSetDatatype());
    assertFalse(rt.getLiteral().isSetDtPrefix());
    assertEquals(rt.getLiteral().getDatatype(), "http://dataype/");
}
Also used : RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) Test(org.junit.Test)

Example 18 with RDF_Term

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

the class Thift2Binding method moveToNext.

@Override
protected Binding moveToNext() {
    b.reset();
    try {
        row.read(protocol);
    } catch (TTransportException e) {
        return null;
    } catch (TException e) {
        TRDF.exception(e);
    }
    if (row.getRowSize() != vars.size())
        throw new RiotThriftException(String.format("Vars %d : Row length : %d", vars.size(), row.getRowSize()));
    for (int i = 0; i < vars.size(); i++) {
        // Old school
        Var v = vars.get(i);
        RDF_Term rt = row.getRow().get(i);
        if (rt.isSetUndefined())
            continue;
        Node n = ThriftConvert.convert(rt);
        b.add(v, n);
    }
    row.clear();
    return b.build();
}
Also used : TException(org.apache.thrift.TException) Var(org.apache.jena.sparql.core.Var) Node(org.apache.jena.graph.Node) TTransportException(org.apache.thrift.transport.TTransportException) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 19 with RDF_Term

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

the class SNode method writeObject.

private void writeObject(java.io.ObjectOutputStream out) throws IOException {
    TProtocol protocol = TRDF.protocol(out);
    RDF_Term tterm = new RDF_Term();
    SerializerRDF.write(protocol, tterm, node);
    TRDF.flush(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 20 with RDF_Term

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

the class SNode method readObject.

private void readObject(java.io.ObjectInputStream in) throws IOException {
    TProtocol protocol = TRDF.protocol(in);
    RDF_Term tterm = new RDF_Term();
    node = SerializerRDF.read(protocol, tterm);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

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