Package com.hp.hpl.jena.tdb.base.record

Examples of com.hp.hpl.jena.tdb.base.record.Record


    @Override
    public Record next()
    {
        if ( ! hasNext() )
            throw new NoSuchElementException("RecordBufferIterator") ;
        Record r = slot ;
        slot = null ;
        return r ;
    }
View Full Code Here


   
    /** Insert a tuple - return true if it was really added, false if it was a duplicate */
    @Override
    protected boolean performAdd(Tuple<NodeId> tuple)
    {
        Record r = TupleLib.record(factory, tuple, colMap) ;
        return index.add(r) ;
    }
View Full Code Here

   
    /** Delete a tuple - return true if it was deleted, false if it didn't exist */
    @Override
    protected boolean performDelete(Tuple<NodeId> tuple)
    {
        Record r = TupleLib.record(factory, tuple, colMap) ;
        return index.delete(r) ;
    }
View Full Code Here

        int numSlots = 0 ;
        int leadingIdx = -2;    // Index of last leading pattern NodeId.  Start less than numSlots-1
        boolean leading = true ;
       
        // Records.
        Record minRec = factory.createKeyOnly() ;
        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

        // Print active slots as records.
        for ( int i = 0 ; i < numSlot ; i++ )
        {
            if ( i != 0 )
                str.append(" ") ;
            Record r = _get(i) ;
            str.append(r.toString()) ;
        }
       
//        // Print empty slots
//        for ( int i = numSlot*slotLen ; i < maxSlot*slotLen ; i++ )
//        {
View Full Code Here

    {
        Hash hash = new Hash(nodeHashToId.getRecordFactory().keyLength()) ;
        setHash(hash, node) ;
        byte k[] = hash.getBytes() ;       
        // Key only.
        Record r = nodeHashToId.getRecordFactory().create(k) ;
       
        synchronized (this// Pair to readNodeFromTable.
        {
            // Key and value, or null
            Record r2 = nodeHashToId.find(r) ;
            if ( r2 != null )
            {
                // Found.  Get the NodeId.
                NodeId id = NodeId.create(r2.getValue(), 0) ;
                return id ;
            }

            // Not found.
            if ( ! create )
View Full Code Here

                if ( ! iter.hasNext() )
                    System.out.println("<<Empty>>") ;
               
                for ( ; iter.hasNext() ; )
                {
                    Record r = iter.next();
                    printRecord("", System.out, r, keyUnitLen) ;
                }
            }
           
            // Check.
            Iterator<Record> iterCheck = bpt.iterator() ;
            Record r1 = null ;
            int i = 0 ;
            for ( ; iterCheck.hasNext() ; )
            {
                Record r2 = iterCheck.next();
                i++ ;
               
                if ( r1 != null )
                {
                    if ( ! Record.keyLT(r1, r2) )
View Full Code Here

    }

    @Override
    public boolean contains(Record record)
    {
        Record r = find(record) ;
        if ( r == null )
            return false ;
        if ( ! recordFactory.hasValue() )
            return true ;
        return Bytes.compare(record.getValue(), r.getValue()) == 0 ;
    }
View Full Code Here

    }

    @Override
    public boolean add(Record record)
    {
        Record r = find(record) ;
        if ( r != null && r.equals(record) )
            return false ;
        index.put(wrap(record.getKey()), wrap(record.getValue())) ;
        return true ;
    }
View Full Code Here

            }
            idx = 0 ;
        }

        // Fill one slot.
        Record record = recordFactory.create() ;
       
//        System.out.print("In:  ") ;
        for ( int i = 0 ; i < itemsPerRow ; i++ )
        {
            long x = Hex.getLong(buffer, idx) ;
            idx += 16 ;
            // Separator or end-of-line.
            idx++ ;    
            int j = ( colMap == null ) ? i : colMap.mapSlotIdx(i) ;
            int recordOffset = j*SystemTDB.SizeOfLong ;
            Bytes.setLong(x, record.getKey(), recordOffset) ;
           
//            System.out.printf("%016X ", x) ;
           
        }
//        System.out.println() ;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.base.record.Record

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.