@Override public Q types(RelationType... types) { String[] ts = new String[types.length]; for (int i = 0; i < types.length; i++) { ts[i]=types[i].getName(); } return types(ts); }
public Q type(RelationType type) { return types(type.getName()); }
@Override public Set<String> getPropertyKeys() { Set<String> result = Sets.newHashSet(); for (RelationType type : it().getPropertyKeysDirect()) result.add(type.getName()); return result; }
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 boolean apply(@Nullable TitanRelation titanRelation) { return titanRelation.isProperty() && titanRelation.isIncidentOn(vertex) && (stypes.isEmpty() || stypes.contains(titanRelation.getType().getName())); } });
@Override public void setPropertyDirect(RelationType type, Object value) { Preconditions.checkArgument(!(type instanceof ImplicitKey),"Cannot use implicit type [%s] when setting property",type.getName()); if (properties == EMPTY_PROPERTIES) { if (tx().getConfiguration().isSingleThreaded()) { properties = new HashMap<RelationType, Object>(5); } else { synchronized (this) { if (properties == EMPTY_PROPERTIES) { properties = Collections.synchronizedMap(new HashMap<RelationType, Object>(5)); } } } } properties.put(type, value); }
@Override public void setPropertyDirect(RelationType type, Object value) { Preconditions.checkArgument(!(type instanceof ImplicitKey),"Cannot use implicit type [%s] when setting property",type.getName()); if (properties == EMPTY_PROPERTIES) { if (tx().getConfiguration().isSingleThreaded()) { properties = new HashMap<RelationType, Object>(5); } else { synchronized (this) { if (properties == EMPTY_PROPERTIES) { properties = Collections.synchronizedMap(new HashMap<RelationType, Object>(5)); } } } } properties.put(type, value); }
@Override public boolean apply(@Nullable TitanRelation titanRelation) { return titanRelation.isEdge() && titanRelation.isIncidentOn(vertex) && (dir==Direction.BOTH || ((TitanEdge)titanRelation).getVertex(dir).equals(vertex)) && (stypes.isEmpty() || stypes.contains(titanRelation.getType().getName())); } });