private static String composeRelationTypeIndexName(RelationType type, String name) { return String.valueOf(type.getLongId())+RELATION_INDEX_SEPARATOR+name; }
private static long[] checkSignature(List<RelationType> sig) { Preconditions.checkArgument(sig.size() == (Sets.newHashSet(sig)).size(), "Signature and sort key cannot contain duplicate types"); long[] signature = new long[sig.size()]; for (int i = 0; i < sig.size(); i++) { RelationType et = sig.get(i); Preconditions.checkNotNull(et); Preconditions.checkArgument(!et.isEdgeLabel() || ((EdgeLabel) et).isUnidirected(), "Label must be unidirectional: %s", et.getName()); Preconditions.checkArgument(!et.isPropertyKey() || !((PropertyKey) et).getDataType().equals(Object.class), "Signature and sort keys must have a proper declared datatype: %s", et.getName()); signature[i] = et.getLongId(); } return signature; }
@Override public <O> O getPropertyDirect(RelationType type) { return getPropertyMap().get(type.getLongId()); }
@Override public <O> O getPropertyDirect(RelationType type) { return getPropertyMap().get(type.getLongId()); }
static final RelationIdentifier get(InternalRelation r) { if (r.hasId()) { return new RelationIdentifier(r.getVertex(0).getLongId(), r.getType().getLongId(), r.getLongId(),(r.isEdge()?r.getVertex(1).getLongId():0)); } else return null; }
private void writeInline(DataOutput out, RelationType type, Object value, InlineType inlineType) { assert !(type.isPropertyKey() && !inlineType.writeEdgeType()) || !AttributeUtil.hasGenericDataType((PropertyKey) type); if (inlineType.writeEdgeType()) { IDHandler.writeInlineEdgeType(out, type.getLongId()); } if (type.isPropertyKey()) { writePropertyValue(out,(PropertyKey)type,value, inlineType); } else { assert type.isEdgeLabel() && ((EdgeLabel) type).isUnidirected(); long id = (value==null?0:((InternalVertex) value).getLongId()); if (inlineType.writeByteOrdered()) LongSerializer.INSTANCE.writeByteOrder(out,id); else VariableLong.writePositive(out,id); } }
Object pvalue = readInline(in, type, InlineType.NORMAL); assert pvalue != null; properties.put(type.getLongId(), pvalue);
assert t.getLongId() == sortKeyIDs[i];