Package com.hp.hpl.jena.tdb.store

Examples of com.hp.hpl.jena.tdb.store.NodeId


        Transform<Record, Pair<NodeId, Node>> transform = new Transform<Record, Pair<NodeId, Node>>() {
            @Override
            public Pair<NodeId, Node> convert(Record item)
            {
                NodeId id = NodeId.create(item.getValue(), 0) ;
                Node n = NodeLib.fetchDecode(id.getId(), getObjects()) ;
                return new Pair<NodeId, Node>(id, n) ;
            }};
        return Iter.map(iter, transform) ;
    }
View Full Code Here


       
        Transform<Pair<Long, ByteBuffer>, Pair<NodeId, Node>> transform = new Transform<Pair<Long, ByteBuffer>, Pair<NodeId, Node>>() {
            @Override
            public Pair<NodeId, Node> convert(Pair<Long, ByteBuffer> item)
            {
                NodeId id = NodeId.create(item.car().longValue()) ;
                ByteBuffer bb = item.cdr();
                Node n = NodeLib.decode(bb) ;
                return new Pair<NodeId, Node>(id, n) ;
            }
        };
View Full Code Here

            return NodeId.NodeIdAny ;
       
        synchronized (lock)
        {
            // Check caches.
            NodeId nodeId = cacheLookup(node) ;
            if ( nodeId != null )
                return nodeId ;

            if ( allocate )
                nodeId = baseTable.getAllocateNodeId(node) ;
View Full Code Here

       
        for ( ; iter1.hasNext() ; )
        {
            Node n = iter1.next() ;
           
            NodeId nId = node2id_Cache.get(n) ;
            if ( !id2node_Cache.containsKey(nId) )
                throw new TDBException("Inconsistent: "+n+" => "+nId) ;
            if ( notPresent.contains(n) )
                throw new TDBException("Inconsistent: "+n+" in notPresent cache (1)") ;
        }
        Iterator<NodeId> iter2 = Iter.toList(id2node_Cache.keys()).iterator() ;
        for ( ; iter2.hasNext() ; )
        {
            NodeId nId = iter2.next() ;
            Node n =  id2node_Cache.get(nId) ;
            if ( !node2id_Cache.containsKey(n) )
                throw new TDBException("Inconsistent: "+nId+" => "+n) ;
            if ( notPresent.contains(n) )
                throw new TDBException("Inconsistent: "+n+" in notPresent cache (2)") ;
View Full Code Here

        Record maxRec = factory.createKeyOnly() ;
       
        // Set the prefixes.
        for ( int i = 0 ; i < pattern.size() ; i++ )
        {
            NodeId X = pattern.get(i) ;
            if ( NodeId.isAny(X) )
            {
                X = null ;
                // No longer seting leading key slots.
                leading = false ;
                continue ;
            }

            numSlots++ ;
            if ( leading )
            {
                leadingIdx = i ;
                Bytes.setLong(X.getId(), minRec.getKey(), i*SizeOfNodeId) ;
                Bytes.setLong(X.getId(), maxRec.getKey(), i*SizeOfNodeId) ;
            }
        }
       
        // Is it a simple existence test?
        if ( numSlots == pattern.size() )
        {
            if ( index.contains(minRec) )
                return new SingletonIterator<Tuple<NodeId>>(pattern)
            else
                return new NullIterator<Tuple<NodeId>>() ;
        }
       
        Iterator<Record> iter = null ;
       
        if ( leadingIdx < 0 )
        {
            if ( ! fullScanAllowed )
                return null ;
            //System.out.println("Full scan") ;
            // Full scan necessary
            iter = index.iterator() ;
        }
        else
        {
            // Adjust the maxRec.
            NodeId X = pattern.get(leadingIdx) ;
            // Set the max Record to the leading NodeIds, +1.
            // Example, SP? inclusive to S(P+1)? exclusive where ? is zero.
            Bytes.setLong(X.getId()+1, maxRec.getKey(), leadingIdx*SizeOfNodeId) ;
            iter = index.iterator(minRec, maxRec) ;
        }
       
        Iterator<Tuple<NodeId>> tuples = Iter.map(iter, transformToTuple) ;
       
View Full Code Here

            public boolean accept(Tuple<NodeId> item)
            {
                // Check on pattern and item (both in natural order)
                for ( int i = 0 ; i < tupleLength ; i++ )
                {
                    NodeId n = pattern.get(i) ;
                    // The pattern must be null/Any or match the tuple being tested.
                    if ( ! NodeId.isAny(n) )
                        if ( ! item.get(i).equals(n) )
                            return false ;
                }
View Full Code Here

        for ( int i = 0 ; i < patternTuple.size() ; i++ )
        {
            Node n = patternTuple.get(i) ;
            // Substitution and turning into NodeIds
            // Variables unsubstituted are null NodeIds
            NodeId nId = idFor(nodeTable, input, n) ;
            if ( NodeId.isDoesNotExist(nId) )
                new NullIterator<BindingNodeId>() ;
            ids[i] = nId ;
            if ( nId == null )
                var[i] = asVar(n) ;
View Full Code Here

        Iterator<Pair<NodeId, Node>> iter = nodeTable.all() ;
        for ( ; iter.hasNext() ; )
        {
            Pair<NodeId, Node> pair = iter.next() ;
            NodeId nid = pair.car() ;
            Node n = pair.cdr();
            String x = NodeFmtLib.str(n) ;
            System.out.printf("%016X %s\n", nid.getId(), x) ;
        }
        dumpedNodeTables.add(nodeTable) ;
    }
View Full Code Here

    {
        int N = r.getKey().length/SizeOfLong ;
        NodeId[] nodeIds = new NodeId[N] ;
        for ( int i = 0 ; i < N ; i++ )
        {
            NodeId id = NodeId.create(r.getKey(), i*SizeOfLong) ;
            int j = i ;
            if ( cMap != null )
                j = cMap.fetchSlotIdx(i) ;
            nodeIds[j] = id ;
        }
View Full Code Here

    /** Create a filter to exclude the graph http://example/g2 */
    private static Filter<Tuple<NodeId>> createFilter(Dataset ds)
    {
        // Filtering operates at a very low level:
        // Need to know the internal identifier for the graph name.
        final NodeId target = TDBInternal.getNodeId(ds, NodeFactory.createURI(graphToHide)) ;

        System.out.println("Hide graph: "+graphToHide+" --> "+target) ;
       
        // Filter for accept/reject as quad as being visible.
        // Return true for "accept", false for "reject"
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.store.NodeId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.