use of org.apache.rya.api.resolver.triple.TripleRow in project incubator-rya by apache.
the class HashedSpoWholeRowTriplePatternStrategyTest method testSpRange.
public void testSpRange() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(new RyaStatement(uri, uri, uri, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, rangeURI, null, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(uri, rangeURI2, null, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
use of org.apache.rya.api.resolver.triple.TripleRow in project incubator-rya by apache.
the class HashedSpoWholeRowTriplePatternStrategyTest method testSpoCustomType.
public void testSpoCustomType() throws Exception {
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(new RyaStatement(uri, uri, customType1, null));
TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, customType1, null, null);
assertContains(entry.getValue(), tripleRow.getRow());
entry = strategy.defineRange(uri, uri, customType2, null, null);
assertContainsFalse(entry.getValue(), tripleRow.getRow());
}
use of org.apache.rya.api.resolver.triple.TripleRow in project incubator-rya by apache.
the class RyaContextTest method testTripleRowSerialization.
public void testTripleRowSerialization() throws Exception {
RyaURI subj = new RyaURI("urn:test#subj");
RyaURI pred = new RyaURI("urn:test#pred");
RyaType obj = new RyaType("mydata");
RyaStatement statement = new RyaStatement(subj, pred, obj);
RyaTripleContext instance = RyaTripleContext.getInstance(new MockRdfCloudConfiguration());
Map<TABLE_LAYOUT, TripleRow> map = instance.serializeTriple(statement);
TripleRow tripleRow = map.get(TABLE_LAYOUT.SPO);
assertEquals(statement, instance.deserializeTriple(TABLE_LAYOUT.SPO, tripleRow));
}
use of org.apache.rya.api.resolver.triple.TripleRow in project incubator-rya by apache.
the class WholeRowTripleResolverTest method testSerializeOSPCustomType.
public void testSerializeOSPCustomType() throws Exception {
RdfCloudTripleStoreConstants.TABLE_LAYOUT po = RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP;
// no context
RyaURI subj = new RyaURI("urn:test#1234");
RyaURI pred = new RyaURI("urn:test#pred");
RyaURI obj = new RyaURI("urn:test#obj");
RyaURI cntxt = new RyaURI("urn:test#cntxt");
final RyaStatement stmt = new RyaStatement(subj, pred, obj, null, null, null, null, 100l);
final RyaStatement stmtContext = new RyaStatement(subj, pred, obj, cntxt, null, null, null, 100l);
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = tripleResolver.serialize(stmt);
TripleRow tripleRow = serialize.get(po);
RyaStatement deserialize = tripleResolver.deserialize(po, tripleRow);
assertEquals(stmt, deserialize);
// context
serialize = tripleResolver.serialize(stmtContext);
tripleRow = serialize.get(po);
deserialize = tripleResolver.deserialize(po, tripleRow);
assertEquals(stmtContext, deserialize);
}
use of org.apache.rya.api.resolver.triple.TripleRow in project incubator-rya by apache.
the class WholeRowTripleResolverTest method testSerializeOSP.
public void testSerializeOSP() throws Exception {
RdfCloudTripleStoreConstants.TABLE_LAYOUT po = RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP;
// no context
RyaURI subj = new RyaURI("urn:test#1234");
RyaURI pred = new RyaURI("urn:test#pred");
RyaURI obj = new RyaURI("urn:test#obj");
RyaURI cntxt = new RyaURI("urn:test#cntxt");
final RyaStatement stmt = new RyaStatement(subj, pred, obj, null, null, null, null, 100l);
final RyaStatement stmtContext = new RyaStatement(subj, pred, obj, cntxt, null, null, null, 100l);
Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = tripleResolver.serialize(stmt);
TripleRow tripleRow = serialize.get(po);
RyaStatement deserialize = tripleResolver.deserialize(po, tripleRow);
assertEquals(stmt, deserialize);
// context
serialize = tripleResolver.serialize(stmtContext);
tripleRow = serialize.get(po);
deserialize = tripleResolver.deserialize(po, tripleRow);
assertEquals(stmtContext, deserialize);
}
Aggregations