Search in sources :

Example 6 with TripleEntry

use of org.apache.rya.joinselect.mr.utils.TripleEntry in project incubator-rya by apache.

the class JoinReducerTest method testTwoConstCard.

@Test
public void testTwoConstCard() throws InterruptedException, IOException {
    CompositeType ct1 = new CompositeType("urn:gem#pred" + DELIM + "urn:gem:etype#1234", 1);
    TripleEntry te1 = new TripleEntry("uri:testSubject", "", "subject", "", "predicateobject");
    TripleEntry te2 = new TripleEntry("uri:testSubject", "", "subject", "", "objectpredicate");
    CardinalityType c5 = new CardinalityType(45, "subjectobject", 0);
    CardinalityType c1 = new CardinalityType(25, "subjectobject", 2);
    CardinalityType c2 = new CardinalityType(27, "predicateobject", 5);
    CardinalityType c3 = new CardinalityType(29, "predicateobject", 2);
    CardinalityType c4 = new CardinalityType(31, "subjectpredicate", 1);
    CardinalityType c6 = new CardinalityType(56, "subjectpredicate", 2);
    List<TripleCard> list1 = new ArrayList<TripleCard>();
    list1.add(new TripleCard(c1));
    list1.add(new TripleCard(c2));
    list1.add(new TripleCard(c3));
    list1.add(new TripleCard(c4));
    list1.add(new TripleCard(c5));
    list1.add(new TripleCard(c6));
    list1.add(new TripleCard(te1));
    list1.add(new TripleCard(te2));
    // System.out.println("List is " + list);
    new ReduceDriver<CompositeType, TripleCard, TripleEntry, CardList>().withReducer(new JoinSelectAggregate.JoinReducer()).withInput(ct1, list1).withOutput(te1, new CardList(0, 0, 0, 31, 29, 45)).withOutput(te2, new CardList(0, 0, 0, 31, 29, 45)).runTest();
}
Also used : CardinalityType(org.apache.rya.joinselect.mr.utils.CardinalityType) CardList(org.apache.rya.joinselect.mr.utils.CardList) ArrayList(java.util.ArrayList) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) TripleCard(org.apache.rya.joinselect.mr.utils.TripleCard) JoinSelectAggregate(org.apache.rya.joinselect.mr.JoinSelectAggregate) CompositeType(org.apache.rya.joinselect.mr.utils.CompositeType) Test(org.junit.Test)

Example 7 with TripleEntry

use of org.apache.rya.joinselect.mr.utils.TripleEntry in project incubator-rya by apache.

the class JoinReducerTest method testSingleConstCard.

@Test
public void testSingleConstCard() throws InterruptedException, IOException {
    CompositeType ct = new CompositeType("urn:gem:etype#1234", 1);
    TripleEntry te = new TripleEntry("urn:gem#pred", "urn:gem:etype#4567", "predicate", "object", "subject");
    CardinalityType c5 = new CardinalityType(45, "object", 0);
    CardinalityType c1 = new CardinalityType(25, "subject", 2);
    CardinalityType c2 = new CardinalityType(27, "predicate", 2);
    CardinalityType c3 = new CardinalityType(29, "object", 2);
    CardinalityType c4 = new CardinalityType(31, "predicate", 1);
    List<TripleCard> list = new ArrayList<TripleCard>();
    list.add(new TripleCard(c1));
    list.add(new TripleCard(c2));
    list.add(new TripleCard(c3));
    list.add(new TripleCard(c4));
    list.add(new TripleCard(c5));
    list.add(new TripleCard(te));
    System.out.println("List is " + list);
    new ReduceDriver<CompositeType, TripleCard, TripleEntry, CardList>().withReducer(new JoinSelectAggregate.JoinReducer()).withInput(ct, list).withOutput(te, new CardList(25, 31, 45, 0, 0, 0)).runTest();
}
Also used : CardinalityType(org.apache.rya.joinselect.mr.utils.CardinalityType) CardList(org.apache.rya.joinselect.mr.utils.CardList) ArrayList(java.util.ArrayList) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) TripleCard(org.apache.rya.joinselect.mr.utils.TripleCard) ReduceDriver(org.apache.hadoop.mrunit.mapreduce.ReduceDriver) CompositeType(org.apache.rya.joinselect.mr.utils.CompositeType) Test(org.junit.Test)

Example 8 with TripleEntry

use of org.apache.rya.joinselect.mr.utils.TripleEntry in project incubator-rya by apache.

the class JoinReducerTest method testTwoTripleEntry.

@Test
public void testTwoTripleEntry() throws InterruptedException, IOException {
    CompositeType ct = new CompositeType("urn:gem:etype#1234", 1);
    TripleEntry te1 = new TripleEntry("urn:gem#pred", "urn:gem:etype#4567", "predicate", "object", "subject");
    TripleEntry te2 = new TripleEntry("urn:gem#8910", "urn:gem:etype#4567", "subject", "predicate", "object");
    CardinalityType c5 = new CardinalityType(45, "object", 0);
    CardinalityType c1 = new CardinalityType(25, "subject", 2);
    CardinalityType c2 = new CardinalityType(27, "predicate", 2);
    CardinalityType c3 = new CardinalityType(29, "object", 2);
    CardinalityType c4 = new CardinalityType(31, "predicate", 1);
    List<TripleCard> list = new ArrayList<TripleCard>();
    list.add(new TripleCard(c1));
    list.add(new TripleCard(c2));
    list.add(new TripleCard(c3));
    list.add(new TripleCard(c4));
    list.add(new TripleCard(c5));
    list.add(new TripleCard(te1));
    list.add(new TripleCard(te2));
    System.out.println("List is " + list);
    new ReduceDriver<CompositeType, TripleCard, TripleEntry, CardList>().withReducer(new JoinSelectAggregate.JoinReducer()).withInput(ct, list).withOutput(te1, new CardList(25, 31, 45, 0, 0, 0)).withOutput(te2, new CardList(25, 31, 45, 0, 0, 0)).runTest();
}
Also used : CardinalityType(org.apache.rya.joinselect.mr.utils.CardinalityType) CardList(org.apache.rya.joinselect.mr.utils.CardList) ArrayList(java.util.ArrayList) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) TripleCard(org.apache.rya.joinselect.mr.utils.TripleCard) JoinSelectAggregate(org.apache.rya.joinselect.mr.JoinSelectAggregate) CompositeType(org.apache.rya.joinselect.mr.utils.CompositeType) Test(org.junit.Test)

Example 9 with TripleEntry

use of org.apache.rya.joinselect.mr.utils.TripleEntry in project incubator-rya by apache.

the class JoinSelectStatisticsSumTest method testPartialTripleEntry.

@Test
public void testPartialTripleEntry() throws InterruptedException, IOException {
    TripleEntry te1 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text(""), new Text("subject"), new Text(""), new Text("object"));
    CardList cl = new CardList(34, 52, 63, 0, 0, 0);
    new MapDriver<TripleEntry, CardList, TripleEntry, CardList>().withMapper(new JoinSelectStatisticsSum.CardinalityIdentityMapper()).withInput(te1, cl).withOutput(te1, cl).runTest();
}
Also used : CardList(org.apache.rya.joinselect.mr.utils.CardList) MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Example 10 with TripleEntry

use of org.apache.rya.joinselect.mr.utils.TripleEntry in project incubator-rya by apache.

the class JoinSelectStatisticsSumTest method testFullTripleEntry.

@Test
public void testFullTripleEntry() throws InterruptedException, IOException {
    TripleEntry te1 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text("urn:gem#pred"), new Text("subject"), new Text("predicate"), new Text("object"));
    CardList cl = new CardList(34, 52, 63, 0, 0, 0);
    TripleEntry te2 = new TripleEntry(new Text("urn:gem:etype#1234"), new Text(""), new Text("subject"), new Text(""), new Text("object"));
    TripleEntry te3 = new TripleEntry(new Text("urn:gem#pred"), new Text(""), new Text("predicate"), new Text(""), new Text("object"));
    new MapDriver<TripleEntry, CardList, TripleEntry, CardList>().withMapper(new JoinSelectStatisticsSum.CardinalityIdentityMapper()).withInput(te1, cl).withOutput(te2, cl).withOutput(te3, cl).withOutput(te1, cl).runTest();
}
Also used : CardList(org.apache.rya.joinselect.mr.utils.CardList) MapDriver(org.apache.hadoop.mrunit.mapreduce.MapDriver) TripleEntry(org.apache.rya.joinselect.mr.utils.TripleEntry) Text(org.apache.hadoop.io.Text) Test(org.junit.Test)

Aggregations

TripleEntry (org.apache.rya.joinselect.mr.utils.TripleEntry)10 Test (org.junit.Test)10 CardList (org.apache.rya.joinselect.mr.utils.CardList)9 ArrayList (java.util.ArrayList)7 Text (org.apache.hadoop.io.Text)7 Value (org.apache.accumulo.core.data.Value)5 ReduceDriver (org.apache.hadoop.mrunit.mapreduce.ReduceDriver)5 Mutation (org.apache.accumulo.core.data.Mutation)4 CompositeType (org.apache.rya.joinselect.mr.utils.CompositeType)4 TripleCard (org.apache.rya.joinselect.mr.utils.TripleCard)4 MapDriver (org.apache.hadoop.mrunit.mapreduce.MapDriver)3 CardinalityType (org.apache.rya.joinselect.mr.utils.CardinalityType)3 JoinSelectAggregate (org.apache.rya.joinselect.mr.JoinSelectAggregate)2 Key (org.apache.accumulo.core.data.Key)1 IntWritable (org.apache.hadoop.io.IntWritable)1 TABLE_LAYOUT (org.apache.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT)1 RyaStatement (org.apache.rya.api.domain.RyaStatement)1 RyaType (org.apache.rya.api.domain.RyaType)1 RyaURI (org.apache.rya.api.domain.RyaURI)1 TripleRow (org.apache.rya.api.resolver.triple.TripleRow)1