use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.
the class FileCopyToolMapper method addMetadataKeys.
@Override
protected void addMetadataKeys(final Context context) throws IOException {
try {
if (runTime != null) {
log.info("Writing copy tool run time metadata to child table: " + runTime);
final RyaStatement ryaStatement = AccumuloRyaUtils.createCopyToolRunTimeRyaStatement(runTime);
writeRyaStatement(ryaStatement, context);
}
if (startTime != null) {
log.info("Writing copy split time metadata to child table: " + startTime);
final RyaStatement ryaStatement = AccumuloRyaUtils.createCopyToolSplitTimeRyaStatement(startTime);
writeRyaStatement(ryaStatement, context);
}
if (timeOffset != null) {
log.info("Writing copy tool time offset metadata to child table: " + timeOffset);
final RyaStatement ryaStatement = AccumuloRyaUtils.createTimeOffsetRyaStatement(timeOffset);
writeRyaStatement(ryaStatement, context);
}
} catch (TripleRowResolverException | IOException | InterruptedException e) {
throw new IOException("Failed to write metadata key", e);
}
}
use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.
the class InsertTriples method insert.
/**
* Insert a batch of triples into Fluo.
*
* @param fluo - A connection to the Fluo table that will be updated. (not null)
* @param triples - The triples to insert. (not null)
* @param visibility - The visibility/permissions required to view the triples once stored.
* Note: The same visibility will be applied to each triple.(not null)
*/
public void insert(final FluoClient fluo, final Collection<RyaStatement> triples, final Optional<String> visibility) {
checkNotNull(fluo);
checkNotNull(triples);
checkNotNull(visibility);
try (Transaction tx = fluo.newTransaction()) {
for (final RyaStatement triple : triples) {
try {
tx.set(spoFormat(triple), FluoQueryColumns.TRIPLES, Bytes.of(visibility.or("")));
} catch (final TripleRowResolverException e) {
log.error("Could not convert a Triple into the SPO format: " + triple);
}
}
tx.commit();
}
}
use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.
the class IncUpdateDAO method deserializeTriple.
/**
* Deserializes a triple stored in the Fluo table.
* @param row - serialized triple
* @return - triple deserialized as a RyaStatement
*/
public static RyaStatement deserializeTriple(final Bytes row) {
checkNotNull(row);
final byte[] rowArray = removeTriplePrefixAndConvertToByteArray(row);
RyaStatement rs = null;
try {
rs = tr.deserialize(TABLE_LAYOUT.SPO, new TripleRow(rowArray, new byte[0], new byte[0]));
} catch (final TripleRowResolverException e) {
e.printStackTrace();
}
return rs;
}
use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.
the class RyaStatementKeyValueIterator method next.
@Override
public RyaStatement next() throws RyaDAOException {
if (!hasNext()) {
return null;
}
try {
Map.Entry<Key, Value> next = dataIterator.next();
Key key = next.getKey();
RyaStatement statement = context.deserializeTriple(tableLayout, new TripleRow(key.getRowData().toArray(), key.getColumnFamilyData().toArray(), key.getColumnQualifierData().toArray(), key.getTimestamp(), key.getColumnVisibilityData().toArray(), next.getValue().get()));
if (next.getValue() != null) {
statement.setValue(next.getValue().get());
}
maxResults--;
return statement;
} catch (TripleRowResolverException e) {
throw new RyaDAOException(e);
}
}
use of org.apache.rya.api.resolver.triple.TripleRowResolverException in project incubator-rya by apache.
the class RyaStatementBindingSetKeyValueIterator method next.
@Override
public Map.Entry<RyaStatement, BindingSet> next() throws RyaDAOException {
if (!hasNext() || isClosed()) {
throw new NoSuchElementException();
}
try {
while (true) {
if (bsIter != null && bsIter.hasNext()) {
maxResults--;
return new RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, BindingSet>(statement, bsIter.next());
}
if (dataIterator.hasNext()) {
Map.Entry<Key, Value> next = dataIterator.next();
Key key = next.getKey();
statement = ryaContext.deserializeTriple(tableLayout, new TripleRow(key.getRowData().toArray(), key.getColumnFamilyData().toArray(), key.getColumnQualifierData().toArray(), key.getTimestamp(), key.getColumnVisibilityData().toArray(), next.getValue().get()));
if (next.getValue() != null) {
statement.setValue(next.getValue().get());
}
Collection<BindingSet> bindingSets = rangeMap.containsKey(key);
if (!bindingSets.isEmpty()) {
bsIter = bindingSets.iterator();
}
} else {
break;
}
}
return null;
} catch (TripleRowResolverException e) {
throw new RyaDAOException(e);
}
}
Aggregations