@Override public RelationType getExistingRelationType(long typeid) { assert idInspector.isRelationTypeId(typeid); if (idInspector.isSystemRelationTypeId(typeid)) { return SystemTypeManager.getSystemType(typeid); } else { InternalVertex v = getInternalVertex(typeid); return (RelationType) v; } }
public static boolean isNotSystemName(TitanSchemaCategory category, String name) { TypeUtil.checkTypeName(category, name); if (SystemTypeManager.isSystemType(name.toLowerCase()) || Token.isSystemName(name)) throw new IllegalArgumentException("Name cannot be in protected namespace: "+name); for (char c : RESERVED_CHARS) Preconditions.checkArgument(name.indexOf(c) < 0, "Name contains reserved character %s: %s", c, name); return true; }
public StandardVertexLabelMaker name(String name) { //Verify name SystemTypeManager.isNotSystemName(TitanSchemaCategory.VERTEXLABEL, name); this.name=name; return this; }
@Override public RelationType getRelationType(String name) { verifyOpen(); RelationType type = SystemTypeManager.getSystemType(name); if (type!=null) return type; return (RelationType)getSchemaVertex(TitanSchemaCategory.getRelationTypeName(name)); }
public static void checkName(String name) { Preconditions.checkArgument(StringUtils.isNotBlank(name), "Need to specify name"); for (char c : RESERVED_CHARS) Preconditions.checkArgument(name.indexOf(c) < 0, "Name can not contains reserved character %s: %s", c, name); Preconditions.checkArgument(!name.startsWith(SystemTypeManager.systemETprefix), "Name starts with a reserved keyword: " + SystemTypeManager.systemETprefix); Preconditions.checkArgument(!SystemTypeManager.isSystemType(name.toLowerCase()), "Name is reserved by system and cannot be used: %s",name); }
public StandardRelationTypeMaker name(String name) { SystemTypeManager.isNotSystemName(getSchemaCategory(), name); this.name = name; return this; }
if (idInspector.isPropertyKeyId(vertexid)) { if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new PropertyKeyVertex(StandardTitanTx.this, vertexid, lifecycle); assert idInspector.isEdgeLabelId(vertexid); if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new EdgeLabelVertex(StandardTitanTx.this, vertexid, lifecycle);
public static boolean isNotSystemName(TitanSchemaCategory category, String name) { TypeUtil.checkTypeName(category, name); if (SystemTypeManager.isSystemType(name.toLowerCase()) || Token.isSystemName(name)) throw new IllegalArgumentException("Name cannot be in protected namespace: "+name); for (char c : RESERVED_CHARS) Preconditions.checkArgument(name.indexOf(c) < 0, "Name contains reserved character %s: %s", c, name); return true; }
@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); }
@Override public RelationType getExistingRelationType(long typeid) { assert idInspector.isRelationTypeId(typeid); if (idInspector.isSystemRelationTypeId(typeid)) { return SystemTypeManager.getSystemType(typeid); } else { InternalVertex v = getInternalVertex(typeid); return (RelationType) v; } }
public StandardVertexLabelMaker name(String name) { //Verify name SystemTypeManager.isNotSystemName(TitanSchemaCategory.VERTEXLABEL, name); this.name=name; return this; }
@Override public RelationType getRelationType(String name) { verifyOpen(); RelationType type = SystemTypeManager.getSystemType(name); if (type!=null) return type; return (RelationType)getSchemaVertex(TitanSchemaCategory.getRelationTypeName(name)); }
public StandardRelationTypeMaker name(String name) { SystemTypeManager.isNotSystemName(getSchemaCategory(), name); this.name = name; return this; }
@Override public<A> A getProperty(String key) { if (key.equals(executor.stateKey)) { return (A)executor.getVertexState(getLongId()); } SystemRelationType t = SystemTypeManager.getSystemType(key); if (t!=null && t instanceof ImplicitKey) return ((ImplicitKey)t).computeProperty(this); throw getAccessException(); }
@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); }
@Override public RelationType getRelationType(String name) { verifyOpen(); RelationType type = SystemTypeManager.getSystemType(name); if (type!=null) return type; return (RelationType)getSchemaVertex(TitanSchemaCategory.getRelationTypeName(name)); }
@Override public RelationType getExistingRelationType(long typeid) { assert idInspector.isRelationTypeId(typeid); if (idInspector.isSystemRelationTypeId(typeid)) { return SystemTypeManager.getSystemType(typeid); } else { InternalVertex v = getInternalVertex(typeid); return (RelationType) v; } }
if (idInspector.isPropertyKeyId(vertexid)) { if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new PropertyKeyVertex(StandardTitanTx.this, vertexid, lifecycle); assert idInspector.isEdgeLabelId(vertexid); if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new EdgeLabelVertex(StandardTitanTx.this, vertexid, lifecycle);
if (idInspector.isPropertyKeyId(vertexid)) { if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new PropertyKeyVertex(StandardTitanTx.this, vertexid, lifecycle); assert idInspector.isEdgeLabelId(vertexid); if (idInspector.isSystemRelationTypeId(vertexid)) { vertex = SystemTypeManager.getSystemType(vertexid); } else { vertex = new EdgeLabelVertex(StandardTitanTx.this, vertexid, lifecycle);