Search in sources :

Example 21 with TupleIndex

use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.

the class AbstractTestTupleIndex method TupleIndexRecordPOS_2.

@Test
public void TupleIndexRecordPOS_2() {
    TupleIndex index = createIndex("POS");
    add(index, n1, n2, n3);
    Tuple<NodeId> tuple2 = TupleFactory.tuple(null, n2, null);
    Iterator<Tuple<NodeId>> iter = index.find(tuple2);
    assertTrue("Can't find tuple", iter.hasNext());
    iter.next();
    assertFalse(iter.hasNext());
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 22 with TupleIndex

use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.

the class AbstractTestTupleIndex method TupleIndexRecordFindNot_6.

@Test
public void TupleIndexRecordFindNot_6() {
    TupleIndex index = createIndex("SPO");
    add(index, n1, n2, n3);
    add(index, n4, n5, n6);
    Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, null, n6);
    Iterator<Tuple<NodeId>> iter = index.find(tuple2);
    assertFalse(iter.hasNext());
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 23 with TupleIndex

use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.

the class AbstractTestTupleIndex method TupleIndexRecordSPO_2.

@Test
public void TupleIndexRecordSPO_2() {
    TupleIndex index = createIndex("SPO");
    add(index, n1, n2, n3);
    Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n2, null);
    Iterator<Tuple<NodeId>> iter = index.find(tuple2);
    assertTrue(iter.hasNext());
    iter.next();
    assertFalse(iter.hasNext());
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 24 with TupleIndex

use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.

the class AbstractTestTupleIndex method TupleIndexRecordFindNot_4.

@Test
public void TupleIndexRecordFindNot_4() {
    TupleIndex index = createIndex("SPO");
    add(index, n1, n2, n3);
    add(index, n1, n5, n6);
    Tuple<NodeId> tuple2 = TupleFactory.tuple(n4, n5, n6);
    Iterator<Tuple<NodeId>> iter = index.find(tuple2);
    assertFalse(iter.hasNext());
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 25 with TupleIndex

use of org.apache.jena.tdb.store.tupletable.TupleIndex in project jena by apache.

the class AbstractTestTupleIndex method TupleIndexRecordSPO_6.

@Test
public void TupleIndexRecordSPO_6() {
    TupleIndex index = createIndex("SPO");
    add(index, n1, n2, n3);
    add(index, n1, n2, n4);
    Tuple<NodeId> tuple2 = TupleFactory.tuple(n1, n2, NodeId.NodeIdAny);
    Iterator<Tuple<NodeId>> iter = index.find(tuple2);
    Set<Tuple<NodeId>> x = Iter.toSet(iter);
    assertEquals(2, x.size());
    assertTrue(x.contains(TupleFactory.tuple(n1, n2, n3)));
    assertTrue(x.contains(TupleFactory.tuple(n1, n2, n4)));
}
Also used : NodeId(org.apache.jena.tdb.store.NodeId) TupleIndex(org.apache.jena.tdb.store.tupletable.TupleIndex) Tuple(org.apache.jena.atlas.lib.tuple.Tuple) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

TupleIndex (org.apache.jena.tdb.store.tupletable.TupleIndex)28 NodeId (org.apache.jena.tdb.store.NodeId)20 Tuple (org.apache.jena.atlas.lib.tuple.Tuple)19 BaseTest (org.apache.jena.atlas.junit.BaseTest)18 Test (org.junit.Test)18 Location (org.apache.jena.tdb.base.file.Location)3 Timer (org.apache.jena.atlas.lib.Timer)2 RangeIndex (org.apache.jena.tdb.index.RangeIndex)2 ColumnMap (org.apache.jena.tdb.lib.ColumnMap)2 TupleIndexRecord (org.apache.jena.tdb.store.tupletable.TupleIndexRecord)2 Iterator (java.util.Iterator)1 Set (java.util.Set)1 Semaphore (java.util.concurrent.Semaphore)1 FileSet (org.apache.jena.tdb.base.file.FileSet)1 Record (org.apache.jena.tdb.base.record.Record)1 RecordFactory (org.apache.jena.tdb.base.record.RecordFactory)1 BPlusTree (org.apache.jena.tdb.index.bplustree.BPlusTree)1 NodeTable (org.apache.jena.tdb.store.nodetable.NodeTable)1 NodeTupleTable (org.apache.jena.tdb.store.nodetupletable.NodeTupleTable)1 NodeTupleTableConcrete (org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete)1