@Override public boolean apply(@Nullable TitanProperty titanProperty) { return titanProperty.getPropertyKey().equals(key); } });
@Override public synchronized Iterable<TitanProperty> get(final Object value, final PropertyKey key) { List<TitanProperty> result = new ArrayList<TitanProperty>(4); for (TitanProperty p : map.get(value)) { if (p.getPropertyKey().equals(key)) result.add(p); } return result; } }
public static boolean hasSimpleInternalVertexKeyIndex(TitanProperty prop) { return hasSimpleInternalVertexKeyIndex(prop.getPropertyKey()); }
@Override public Set<String> getPropertyKeys() { Set<String> result = new HashSet<String>(); for (TitanProperty p : getProperties()) { result.add(p.getPropertyKey().getName()); } return result; }
public boolean matchesConstraint(TitanSchemaType type, TitanElement element) { Preconditions.checkArgument(type != null && element!=null); assert isInstance(element); assert isValidConstraint(type); switch(this) { case VERTEX: return ((TitanVertex)element).getVertexLabel().equals(type); case EDGE: return ((TitanEdge)element).getEdgeLabel().equals(type); case PROPERTY: return ((TitanProperty)element).getPropertyKey().equals(type); default: throw new IllegalArgumentException(); } }
private RecordEntry(TitanProperty property) { this(property.getLongId(),property.getValue(),property.getPropertyKey()); } }
public Collection<IndexUpdate> getIndexUpdates(InternalVertex vertex, Collection<InternalRelation> updatedProperties) { if (updatedProperties.isEmpty()) return Collections.EMPTY_LIST; Set<IndexUpdate> updates = Sets.newHashSet(); for (InternalRelation rel : updatedProperties) { assert rel.isProperty(); TitanProperty p = (TitanProperty)rel; assert rel.isNew() || rel.isRemoved(); assert rel.getVertex(0).equals(vertex); IndexUpdate.Type updateType = getUpateType(rel); for (IndexType index : ((InternalRelationType)p.getPropertyKey()).getKeyIndexes()) { if (!indexAppliesTo(index,vertex)) continue; if (index.isCompositeIndex()) { //Gather composite indexes CompositeIndexType cIndex = (CompositeIndexType)index; IndexRecords updateRecords = indexMatches(vertex,cIndex,updateType==IndexUpdate.Type.DELETE,p.getPropertyKey(),new RecordEntry(p)); for (RecordEntry[] record : updateRecords) { IndexUpdate update = new IndexUpdate<StaticBuffer,Entry>(cIndex,updateType,getIndexKey(cIndex,record),getIndexEntry(cIndex,record,vertex), vertex); int ttl = getIndexTTL(vertex,getKeysOfRecords(record)); if (ttl>0 && updateType== IndexUpdate.Type.ADD) update.setTTL(ttl); updates.add(update); } } else { //Update mixed indexes if (((MixedIndexType)index).getField(p.getPropertyKey()).getStatus()== SchemaStatus.DISABLED) continue; IndexUpdate update = getMixedIndexUpdate(vertex, p.getPropertyKey(), p.getValue(), (MixedIndexType) index, updateType); int ttl = getIndexTTL(vertex,p.getPropertyKey()); if (ttl>0 && updateType== IndexUpdate.Type.ADD) update.setTTL(ttl); updates.add(update); } } } return updates; }
for (TitanProperty p : v.getProperties()) { assertNotNull(p.getValue()); assertNotNull(p.getPropertyKey());
for (TitanProperty p : v.getProperties()) { assertNotNull(p.getValue()); assertNotNull(p.getPropertyKey());
return (O)((TitanVertex)e).getLabel(); } else if (e instanceof TitanProperty) { return (O)((TitanProperty)e).getPropertyKey().getName(); } else { return null;
} else { assert (relation.isProperty() && ((TitanProperty)relation).getPropertyKey().getCardinality()!=Cardinality.SINGLE) || (relation.isEdge() && idManager.isPartitionedVertex(relation.getVertex(0).getLongId()) && idManager.isPartitionedVertex(relation.getVertex(1).getLongId())); newPartition = idManager.getPartitionHashForId(relation.getLongId());