@Override public TitanGraphIndex getGraphIndex(String name) { IndexType index = getGraphIndexDirect(name, transaction); return index == null ? null : new TitanGraphIndexWrapper(index); }
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); }
TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType()); if (!oneNewKey) updateIndex(index, SchemaAction.REGISTER_INDEX); return index;
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory, TitanSchemaType constraint, String backingIndex) { Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex), "Unknown external index backend: %s", backingIndex); checkIndexName(indexName); TypeDefinitionMap def = new TypeDefinitionMap(); def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, false); def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory); def.setValue(TypeDefinitionCategory.BACKING_INDEX, backingIndex); def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName); def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST); def.setValue(TypeDefinitionCategory.STATUS, SchemaStatus.ENABLED); TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def); Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex)); if (constraint != null) { addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null); } updateSchemaVertex(indexVertex); return new TitanGraphIndexWrapper(indexVertex.asIndexType()); }
@Nullable @Override public TitanGraphIndex apply(@Nullable IndexType indexType) { return new TitanGraphIndexWrapper(indexType); } });
@Override public TitanGraphIndex getGraphIndex(String name) { IndexType index = getGraphIndexDirect(name, transaction); return index==null?null:new TitanGraphIndexWrapper(index); }
@Override public TitanGraphIndex getGraphIndex(String name) { IndexType index = getGraphIndexDirect(name, transaction); return index == null ? null : new TitanGraphIndexWrapper(index); }
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); }
TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType()); if (!oneNewKey) updateIndex(index, SchemaAction.REGISTER_INDEX); return index;
TitanGraphIndexWrapper index = new TitanGraphIndexWrapper(indexVertex.asIndexType()); if (!oneNewKey) updateIndex(index,SchemaAction.REGISTER_INDEX); return index;
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory, TitanSchemaType constraint, String backingIndex) { Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex),"Unknown external index backend: %s",backingIndex); checkIndexName(indexName); TypeDefinitionMap def = new TypeDefinitionMap(); def.setValue(TypeDefinitionCategory.INTERNAL_INDEX,false); def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY,elementCategory); def.setValue(TypeDefinitionCategory.BACKING_INDEX,backingIndex); def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME,indexName); def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST); def.setValue(TypeDefinitionCategory.STATUS,SchemaStatus.ENABLED); TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX,indexName,def); Preconditions.checkArgument(constraint==null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex)); if (constraint!=null) { addSchemaEdge(indexVertex,(TitanSchemaVertex)constraint,TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT,null); } updateSchemaVertex(indexVertex); return new TitanGraphIndexWrapper(indexVertex.asIndexType()); }
private TitanGraphIndex createMixedIndex(String indexName, ElementCategory elementCategory, TitanSchemaType constraint, String backingIndex) { Preconditions.checkArgument(graph.getIndexSerializer().containsIndex(backingIndex), "Unknown external index backend: %s", backingIndex); checkIndexName(indexName); TypeDefinitionMap def = new TypeDefinitionMap(); def.setValue(TypeDefinitionCategory.INTERNAL_INDEX, false); def.setValue(TypeDefinitionCategory.ELEMENT_CATEGORY, elementCategory); def.setValue(TypeDefinitionCategory.BACKING_INDEX, backingIndex); def.setValue(TypeDefinitionCategory.INDEXSTORE_NAME, indexName); def.setValue(TypeDefinitionCategory.INDEX_CARDINALITY, Cardinality.LIST); def.setValue(TypeDefinitionCategory.STATUS, SchemaStatus.ENABLED); TitanSchemaVertex indexVertex = transaction.makeSchemaVertex(TitanSchemaCategory.GRAPHINDEX, indexName, def); Preconditions.checkArgument(constraint == null || (elementCategory.isValidConstraint(constraint) && constraint instanceof TitanSchemaVertex)); if (constraint != null) { addSchemaEdge(indexVertex, (TitanSchemaVertex) constraint, TypeDefinitionCategory.INDEX_SCHEMA_CONSTRAINT, null); } updateSchemaVertex(indexVertex); return new TitanGraphIndexWrapper(indexVertex.asIndexType()); }