private static NodeId findRDFType(NodeTable nodeTable2) { return nodeTable2.getAllocateNodeId(NodeConst.nodeRDFType) ; }
@Override public NodeId getAllocateNodeId(Node node) { return nodeTable.getAllocateNodeId(node) ; }
@Override public NodeId getAllocateNodeId(Node node) { //info("getAllocateNodeId("+node+") =>") ; NodeId nId = nodeTable.getAllocateNodeId(node) ; info("getAllocateNodeId("+node+") => "+nId) ; return nId ; }
@Override public boolean addRow(Node... nodes) { try { startWrite() ; NodeId n[] = new NodeId[nodes.length] ; for (int i = 0; i < nodes.length; i++) n[i] = nodeTable.getAllocateNodeId(nodes[i]) ; Tuple<NodeId> t = TupleFactory.tuple(n) ; return tupleTable.add(t) ; } finally { finishWrite() ; } }
private NodeId _idForNode(Node node, boolean allocate) { if ( node == Node.ANY ) return NodeId.NodeIdAny ; // Try once outside the synchronized // (Cache access is thread-safe.) NodeId nodeId = cacheLookup(node) ; if ( nodeId != null ) return nodeId ; synchronized (lock) { // Update two caches inside synchronized. // Check stil valid. nodeId = cacheLookup(node) ; if ( nodeId != null ) return nodeId ; if ( allocate ) nodeId = baseTable.getAllocateNodeId(node) ; else nodeId = baseTable.getNodeIdForNode(node) ; // Ensure caches have it. Includes recording "no such node" cacheUpdate(node, nodeId) ; return nodeId ; } }
private void process(Node g, Node s, Node p, Node o) { NodeId sId = nodeTable.getAllocateNodeId(s) ; NodeId pId = nodeTable.getAllocateNodeId(p) ; NodeId oId = nodeTable.getAllocateNodeId(o) ; if ( g != null ) { NodeId gId = nodeTable.getAllocateNodeId(g) ; writerQuads.write(gId.getId()) ; writerQuads.write(sId.getId()) ; writerQuads.write(pId.getId()) ; writerQuads.write(oId.getId()) ; writerQuads.endOfRow() ; if ( stats != null ) stats.record(gId, sId, pId, oId) ; } else { writerTriples.write(sId.getId()) ; writerTriples.write(pId.getId()) ; writerTriples.write(oId.getId()) ; writerTriples.endOfRow() ; if ( stats != null ) stats.record(null, sId, pId, oId) ; } monitor.tick() ; }
protected static void writeBadNode(NodeTable nt, Node badNode) { NodeId id1 = nt.allocOffset() ; try { NodeId nodeId = nt.getAllocateNodeId(badNode) ; fail("Expected exception for bad node: "+badNode) ; } catch (TDBException ex) { } NodeId id2 = nt.allocOffset() ; assertEquals(id1, id2) ; }
protected static void writeBadNode(NodeTable nt, Node badNode) { NodeId id1 = nt.allocOffset() ; try { NodeId nodeId = nt.getAllocateNodeId(badNode) ; fail("Expected exception for bad node: "+badNode) ; } catch (TDBException ex) { } NodeId id2 = nt.allocOffset() ; assertEquals(id1, id2) ; }
protected static void writeNode(NodeTable nt, Node n) { NodeId nodeId = nt.getAllocateNodeId(n) ; assertNotNull(nodeId) ; assertNotEquals(NodeId.NodeDoesNotExist, nodeId) ; assertNotEquals(NodeId.NodeIdAny, nodeId) ; Node n2 = nt.getNodeForNodeId(nodeId) ; assertEquals(n, n2) ; NodeId nodeId2 = nt.getNodeIdForNode(n) ; assertEquals(nodeId, nodeId2) ; }
protected static void writeNode(NodeTable nt, Node n) { NodeId nodeId = nt.getAllocateNodeId(n) ; assertNotNull(nodeId) ; assertNotEquals(NodeId.NodeDoesNotExist, nodeId) ; assertNotEquals(NodeId.NodeIdAny, nodeId) ; Node n2 = nt.getNodeForNodeId(nodeId) ; assertEquals(n, n2) ; NodeId nodeId2 = nt.getNodeIdForNode(n) ; assertEquals(nodeId, nodeId2) ; }