Search in sources :

Example 36 with RDF_Term

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

the class NodeTableTRDF method writeNodeToTable.

@Override
protected NodeId writeNodeToTable(Node node) {
    RDF_Term term = ThriftConvert.convert(node, true);
    try {
        long x = diskFile.length();
        // Paired : [*]
        NodeId nid = NodeIdFactory.createPtr(x);
        term.write(protocol);
        // transport.flush();
        return nid;
    } catch (TransactionException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new TDBException("NodeTableThrift/Write", ex);
    }
}
Also used : TransactionException(org.apache.jena.dboe.transaction.txn.TransactionException) TDBException(org.apache.jena.tdb2.TDBException) NodeId(org.apache.jena.tdb2.store.NodeId) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term) RiotThriftException(org.apache.jena.riot.thrift.RiotThriftException) TDBException(org.apache.jena.tdb2.TDBException) TException(org.apache.thrift.TException) TransactionException(org.apache.jena.dboe.transaction.txn.TransactionException)

Example 37 with RDF_Term

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

the class NodeTableTRDF method readNodeFromTable.

@Override
protected Node readNodeFromTable(NodeId id) {
    try {
        // Paired : [*]
        long x = id.getPtrLocation();
        transport.readPosition(x);
        RDF_Term term = new RDF_Term();
        term.read(protocol);
        Node n = ThriftConvert.convert(term);
        return n;
    } catch (TException ex) {
        throw new TDBException("NodeTableTRDF/Read", ex);
    } catch (RiotThriftException ex) {
        Log.error(this, "Bad encoding: NodeId = " + id);
        throw ex;
    }
}
Also used : TException(org.apache.thrift.TException) RiotThriftException(org.apache.jena.riot.thrift.RiotThriftException) Node(org.apache.jena.graph.Node) TDBException(org.apache.jena.tdb2.TDBException) RDF_Term(org.apache.jena.riot.thrift.wire.RDF_Term)

Example 38 with RDF_Term

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

the class tdbdumpnodes method readOne.

private static Node readOne(TProtocol protocol) throws TException {
    RDF_Term term = new RDF_Term();
    term.read(protocol);
    Node n = ThriftConvert.convert(term);
    return n;
}
Also used : Node(org.apache.jena.graph.Node) 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