Search in sources :

Example 1 with RDF_Term

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

the class Binding2Thrift method output.

public void output(Binding binding) {
    Iterator<Var> vIter = (vars == null ? null : vars.iterator());
    if (vIter == null)
        vIter = binding.vars();
    // }) ;
    while (vIter.hasNext()) {
        Var v = vIter.next();
        Node n = binding.get(v);
        RDF_Term rt = (n == null) ? TRDF.tUNDEF : ThriftConvert.convert(n, encodeValues);
        row.addToRow(rt);
    }
    try {
        row.write(protocol);
    } catch (TException e) {
        TRDF.exception(e);
    }
    row.clear();
}
Also used : TException(org.apache.thrift.TException) Var(org.apache.jena.sparql.core.Var) Node(org.apache.jena.graph.Node) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 2 with RDF_Term

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

the class STriple 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, triple.getSubject());
    SerializerRDF.write(protocol, tterm, triple.getPredicate());
    SerializerRDF.write(protocol, tterm, triple.getObject());
    TRDF.flush(protocol);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 3 with RDF_Term

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

the class STriple method readObject.

private void readObject(java.io.ObjectInputStream in) throws IOException {
    TProtocol protocol = TRDF.protocol(in);
    RDF_Term tterm = new RDF_Term();
    Node s = SerializerRDF.read(protocol, tterm);
    Node p = SerializerRDF.read(protocol, tterm);
    Node o = SerializerRDF.read(protocol, tterm);
    triple = Triple.create(s, p, o);
}
Also used : TProtocol(org.apache.thrift.protocol.TProtocol) Node(org.apache.jena.graph.Node) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 4 with RDF_Term

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

the class TestThriftTerm method term_value_06.

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

Example 5 with RDF_Term

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

the class TestThriftTerm method term_value_11.

@Test
public void term_value_11() {
    RDF_Term rt = testTermValue("0.005");
    assertTrue(rt.isSetValDecimal());
    assertEquals(5, rt.getValDecimal().getValue());
    assertEquals(3, rt.getValDecimal().getScale());
}
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