final String qualifer = stmt.getQualifer(); final byte[] qualBytes = qualifer == null ? EMPTY_BYTES : qualifer.getBytes(StandardCharsets.UTF_8); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
final String qualifer = stmt.getQualifer(); final byte[] qualBytes = qualifer == null ? EMPTY_BYTES : qualifer.getBytes(StandardCharsets.UTF_8); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
write(dataOutput, columnQualifier); write(dataOutput, ryaStatement.getColumnVisibility()); write(dataOutput, ryaStatement.getValue()); Long timestamp = ryaStatement.getTimestamp(); boolean b = timestamp != null;
write(dataOutput, columnQualifier); write(dataOutput, ryaStatement.getColumnVisibility()); write(dataOutput, ryaStatement.getValue()); Long timestamp = ryaStatement.getTimestamp(); boolean b = timestamp != null;
private static List<TripleRow> serializeStatement(final RyaStatement stmt) throws RyaTypeResolverException { final RyaURI subject = stmt.getSubject(); final RyaURI predicate = stmt.getPredicate(); final RyaType object = stmt.getObject(); final RyaURI context = stmt.getContext(); final Long timestamp = stmt.getTimestamp(); final byte[] columnVisibility = stmt.getColumnVisibility(); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8); final byte[] subjBytes = subject.getData().getBytes(StandardCharsets.UTF_8); final byte[] predBytes = predicate.getData().getBytes(StandardCharsets.UTF_8); final byte[][] objBytes = RyaContext.getInstance().serializeType(object); return Lists.newArrayList(new TripleRow(subjBytes, predBytes, Bytes.concat(cf, DELIM_BYTES, OBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES, objBytes[0], objBytes[1]), timestamp, columnVisibility, value), new TripleRow(objBytes[0], predBytes, Bytes.concat(cf, DELIM_BYTES, SUBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES, subjBytes, objBytes[1]), timestamp, columnVisibility, value)); }
private static List<TripleRow> serializeStatement(final RyaStatement stmt) throws RyaTypeResolverException { final RyaIRI subject = stmt.getSubject(); final RyaIRI predicate = stmt.getPredicate(); final RyaType object = stmt.getObject(); final RyaIRI context = stmt.getContext(); final Long timestamp = stmt.getTimestamp(); final byte[] columnVisibility = stmt.getColumnVisibility(); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8); final byte[] subjBytes = subject.getData().getBytes(StandardCharsets.UTF_8); final byte[] predBytes = predicate.getData().getBytes(StandardCharsets.UTF_8); final byte[][] objBytes = RyaContext.getInstance().serializeType(object); return Lists.newArrayList(new TripleRow(subjBytes, predBytes, Bytes.concat(cf, DELIM_BYTES, OBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES, objBytes[0], objBytes[1]), timestamp, columnVisibility, value), new TripleRow(objBytes[0], predBytes, Bytes.concat(cf, DELIM_BYTES, SUBJECT.getBytes(StandardCharsets.UTF_8), DELIM_BYTES, subjBytes, objBytes[1]), timestamp, columnVisibility, value)); }
final String qualifer = stmt.getQualifer(); final byte[] qualBytes = qualifer == null ? EMPTY_BYTES : qualifer.getBytes(StandardCharsets.UTF_8); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
final String qualifer = stmt.getQualifer(); final byte[] qualBytes = qualifer == null ? EMPTY_BYTES : qualifer.getBytes(StandardCharsets.UTF_8); final byte[] value = stmt.getValue(); assert subject != null && predicate != null && object != null; final byte[] cf = (context == null) ? EMPTY_BYTES : context.getData().getBytes(StandardCharsets.UTF_8);
private static RyaStatement updateRyaStatementColumnVisibility(final RyaStatement ryaStatement, final ColumnVisibility newCv) { final RyaStatement newCvRyaStatement = new RyaStatement(ryaStatement.getSubject(), ryaStatement.getPredicate(), ryaStatement.getObject(), ryaStatement.getContext(), ryaStatement.getQualifer(), newCv.getExpression(), ryaStatement.getValue(), ryaStatement.getTimestamp()); return newCvRyaStatement; }
/** * Comparison method for natural ordering. Compares based on the logical * triple (the s/p/o/context information in the underlying RyaStatement) * and then by the metadata contained in the RyaStatement if the triples are * the same. * @return Zero if both RyaStatementWritables contain equivalent statements * or both have null statements; otherwise, an integer whose sign * corresponds to a consistent ordering. */ @Override public int compareTo(RyaStatementWritable other) { CompareToBuilder builder = new CompareToBuilder(); RyaStatement rsThis = this.getRyaStatement(); RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract builder.append(rsThis == null, rsOther == null); if (rsThis != null && rsOther != null) { builder.append(rsThis.getSubject(), rsOther.getSubject()); builder.append(rsThis.getPredicate(), rsOther.getPredicate()); builder.append(rsThis.getObject(), rsOther.getObject()); builder.append(rsThis.getContext(), rsOther.getContext()); builder.append(rsThis.getQualifer(), rsOther.getQualifer()); builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility()); builder.append(rsThis.getValue(), rsOther.getValue()); builder.append(rsThis.getTimestamp(), rsOther.getTimestamp()); } return builder.toComparison(); }
/** * Comparison method for natural ordering. Compares based on the logical * triple (the s/p/o/context information in the underlying RyaStatement) * and then by the metadata contained in the RyaStatement if the triples are * the same. * @return Zero if both RyaStatementWritables contain equivalent statements * or both have null statements; otherwise, an integer whose sign * corresponds to a consistent ordering. */ @Override public int compareTo(RyaStatementWritable other) { CompareToBuilder builder = new CompareToBuilder(); RyaStatement rsThis = this.getRyaStatement(); RyaStatement rsOther = other.getRyaStatement(); // should throw NPE if other is null, as per Comparable contract builder.append(rsThis == null, rsOther == null); if (rsThis != null && rsOther != null) { builder.append(rsThis.getSubject(), rsOther.getSubject()); builder.append(rsThis.getPredicate(), rsOther.getPredicate()); builder.append(rsThis.getObject(), rsOther.getObject()); builder.append(rsThis.getContext(), rsOther.getContext()); builder.append(rsThis.getQualifer(), rsOther.getQualifer()); builder.append(rsThis.getColumnVisibility(), rsOther.getColumnVisibility()); builder.append(rsThis.getValue(), rsOther.getValue()); builder.append(rsThis.getTimestamp(), rsOther.getTimestamp()); } return builder.toComparison(); }