@Override public RelationTypeIndex getRelationIndex(RelationType type, String name) { Preconditions.checkArgument(type != null); Preconditions.checkArgument(StringUtils.isNotBlank(name)); String composedName = composeRelationTypeIndexName(type, name); //Don't use SchemaCache to make code more compact and since we don't need the extra performance here TitanVertex v = Iterables.getOnlyElement(QueryUtil.getVertices(transaction, BaseKey.SchemaName, TitanSchemaCategory.getRelationTypeName(composedName)), null); if (v == null) return null; assert v instanceof InternalRelationType; return new RelationTypeIndexWrapper((InternalRelationType) v); }
public TitanSchemaElement getSchemaElement(long id) { TitanVertex v = transaction.getVertex(id); if (v == null) return null; if (v instanceof RelationType) { if (((InternalRelationType) v).getBaseType() == null) return (RelationType) v; return new RelationTypeIndexWrapper((InternalRelationType) v); } if (v instanceof TitanSchemaVertex) { TitanSchemaVertex sv = (TitanSchemaVertex) v; if (sv.getDefinition().containsKey(TypeDefinitionCategory.INTERNAL_INDEX)) { return new TitanGraphIndexWrapper(sv.asIndexType()); } } throw new IllegalArgumentException("Not a valid schema element vertex: " + id); }
RelationTypeIndexWrapper index = new RelationTypeIndexWrapper((InternalRelationType) typeIndex); if (!type.isNew()) updateIndex(index, SchemaAction.REGISTER_INDEX); return index;
@Nullable @Override public RelationTypeIndex apply(@Nullable InternalRelationType internalType) { return new RelationTypeIndexWrapper(internalType); } });
@Override public RelationTypeIndex getRelationIndex(RelationType type, String name) { Preconditions.checkArgument(type != null); Preconditions.checkArgument(StringUtils.isNotBlank(name)); String composedName = composeRelationTypeIndexName(type, name); //Don't use SchemaCache to make code more compact and since we don't need the extra performance here TitanVertex v = Iterables.getOnlyElement(QueryUtil.getVertices(transaction, BaseKey.SchemaName, TitanSchemaCategory.getRelationTypeName(composedName)), null); if (v == null) return null; assert v instanceof InternalRelationType; return new RelationTypeIndexWrapper((InternalRelationType) v); }
@Override public RelationTypeIndex getRelationIndex(RelationType type, String name) { Preconditions.checkArgument(type!=null); Preconditions.checkArgument(StringUtils.isNotBlank(name)); String composedName = composeRelationTypeIndexName(type, name); //Don't use SchemaCache to make code more compact and since we don't need the extra performance here TitanVertex v = Iterables.getOnlyElement(transaction.getVertices(BaseKey.SchemaName,TitanSchemaCategory.getRelationTypeName(composedName)),null); if (v==null) return null; assert v instanceof InternalRelationType; return new RelationTypeIndexWrapper((InternalRelationType)v); }
public TitanSchemaElement getSchemaElement(long id) { TitanVertex v = transaction.getVertex(id); if (v==null) return null; if (v instanceof RelationType) { if (((InternalRelationType)v).getBaseType()==null) return (RelationType)v; return new RelationTypeIndexWrapper((InternalRelationType)v); } if (v instanceof TitanSchemaVertex) { TitanSchemaVertex sv = (TitanSchemaVertex)v; if (sv.getDefinition().containsKey(TypeDefinitionCategory.INTERNAL_INDEX)) { return new TitanGraphIndexWrapper(sv.asIndexType()); } } throw new IllegalArgumentException("Not a valid schema element vertex: "+id); }
public TitanSchemaElement getSchemaElement(long id) { TitanVertex v = transaction.getVertex(id); if (v == null) return null; if (v instanceof RelationType) { if (((InternalRelationType) v).getBaseType() == null) return (RelationType) v; return new RelationTypeIndexWrapper((InternalRelationType) v); } if (v instanceof TitanSchemaVertex) { TitanSchemaVertex sv = (TitanSchemaVertex) v; if (sv.getDefinition().containsKey(TypeDefinitionCategory.INTERNAL_INDEX)) { return new TitanGraphIndexWrapper(sv.asIndexType()); } } throw new IllegalArgumentException("Not a valid schema element vertex: " + id); }
RelationTypeIndexWrapper index = new RelationTypeIndexWrapper((InternalRelationType)typeIndex); if (!type.isNew()) updateIndex(index,SchemaAction.REGISTER_INDEX); return index;
RelationTypeIndexWrapper index = new RelationTypeIndexWrapper((InternalRelationType) typeIndex); if (!type.isNew()) updateIndex(index, SchemaAction.REGISTER_INDEX); return index;