use of com.thinkaurelius.titan.graphdb.internal.TitanSchemaCategory in project titan by thinkaurelius.
the class ManagementSystem method changeName.
@Override
public void changeName(TitanSchemaElement element, String newName) {
Preconditions.checkArgument(StringUtils.isNotBlank(newName), "Invalid name: %s", newName);
TitanSchemaVertex schemaVertex = getSchemaVertex(element);
if (schemaVertex.name().equals(newName))
return;
TitanSchemaCategory schemaCategory = schemaVertex.valueOrNull(BaseKey.SchemaCategory);
Preconditions.checkArgument(schemaCategory.hasName(), "Invalid schema element: %s", element);
if (schemaVertex instanceof RelationType) {
InternalRelationType relType = (InternalRelationType) schemaVertex;
if (relType.getBaseType() != null) {
newName = composeRelationTypeIndexName(relType.getBaseType(), newName);
} else
assert !(element instanceof RelationTypeIndex);
TitanSchemaCategory cat = relType.isEdgeLabel() ? TitanSchemaCategory.EDGELABEL : TitanSchemaCategory.PROPERTYKEY;
SystemTypeManager.isNotSystemName(cat, newName);
} else if (element instanceof VertexLabel) {
SystemTypeManager.isNotSystemName(TitanSchemaCategory.VERTEXLABEL, newName);
} else if (element instanceof TitanGraphIndex) {
checkIndexName(newName);
}
transaction.addProperty(schemaVertex, BaseKey.SchemaName, schemaCategory.getSchemaName(newName));
updateSchemaVertex(schemaVertex);
schemaVertex.resetCache();
updatedTypes.add(schemaVertex);
}
use of com.thinkaurelius.titan.graphdb.internal.TitanSchemaCategory in project titan by thinkaurelius.
the class TitanHadoopSetupImpl method getTypeInspector.
@Override
public TypeInspector getTypeInspector() {
//Pre-load schema
for (TitanSchemaCategory sc : TitanSchemaCategory.values()) {
for (TitanVertex k : QueryUtil.getVertices(tx, BaseKey.SchemaCategory, sc)) {
assert k instanceof TitanSchemaVertex;
TitanSchemaVertex s = (TitanSchemaVertex) k;
if (sc.hasName()) {
String name = s.name();
Preconditions.checkNotNull(name);
}
TypeDefinitionMap dm = s.getDefinition();
Preconditions.checkNotNull(dm);
s.getRelated(TypeDefinitionCategory.TYPE_MODIFIER, Direction.OUT);
s.getRelated(TypeDefinitionCategory.TYPE_MODIFIER, Direction.IN);
}
}
return tx;
}
Aggregations