TopologyManager.addLabelToEdge(this.sqlgGraph, edgeVertex, schema, table, true, foreignKey); } else if (column.endsWith(Topology.OUT_VERTEX_COLUMN_END)) { TopologyManager.addLabelToEdge(this.sqlgGraph, edgeVertex, schema, table, false, foreignKey);
TopologyManager.addLabelToEdge(this.sqlgGraph, edgeVertex, schema, table, true, foreignKey); } else if (column.endsWith(Topology.OUT_VERTEX_COLUMN_END)) { TopologyManager.addLabelToEdge(this.sqlgGraph, edgeVertex, schema, table, false, foreignKey);
public void ensureEdgeVertexLabelExist(Direction direction, VertexLabel vertexLabel) { //if the direction is OUT then the vertexLabel must be in the same schema as the edgeLabel (this) if (direction == Direction.OUT) { Preconditions.checkState(vertexLabel.getSchema().equals(getSchema()), "For Direction.OUT the VertexLabel must be in the same schema as the edge. Found %s and %s", vertexLabel.getSchema().getName(), getSchema().getName()); } SchemaTable foreignKey = SchemaTable.of(vertexLabel.getSchema().getName(), vertexLabel.getLabel() + (direction == Direction.IN ? Topology.IN_VERTEX_COLUMN_END : Topology.OUT_VERTEX_COLUMN_END)); if (!foreignKeysContains(direction, vertexLabel)) { //Make sure the current thread/transaction owns the lock Schema schema = this.getSchema(); schema.getTopology().lock(); if (!foreignKeysContains(direction, vertexLabel)) { TopologyManager.addLabelToEdge(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), direction == Direction.IN, foreignKey); if (direction == Direction.IN) { this.uncommittedInVertexLabels.add(vertexLabel); vertexLabel.addToUncommittedInEdgeLabels(schema, this); } else { this.uncommittedOutVertexLabels.add(vertexLabel); vertexLabel.addToUncommittedOutEdgeLabels(schema, this); } SchemaTable vertexSchemaTable = SchemaTable.of(vertexLabel.getSchema().getName(), vertexLabel.getLabel()); addEdgeForeignKey(schema.getName(), EDGE_PREFIX + getLabel(), foreignKey, vertexSchemaTable); this.getSchema().getTopology().fire(this, vertexSchemaTable.toString(), TopologyChangeAction.ADD_IN_VERTEX_LABELTO_EDGE); } } }
public void ensureEdgeVertexLabelExist(Direction direction, VertexLabel vertexLabel) { //if the direction is OUT then the vertexLabel must be in the same schema as the edgeLabel (this) if (direction == Direction.OUT) { Preconditions.checkState(vertexLabel.getSchema().equals(getSchema()), "For Direction.OUT the VertexLabel must be in the same schema as the edge. Found %s and %s", vertexLabel.getSchema().getName(), getSchema().getName()); } SchemaTable foreignKey = SchemaTable.of(vertexLabel.getSchema().getName(), vertexLabel.getLabel() + (direction == Direction.IN ? Topology.IN_VERTEX_COLUMN_END : Topology.OUT_VERTEX_COLUMN_END)); if (!foreignKeysContains(direction, vertexLabel)) { //Make sure the current thread/transaction owns the lock Schema schema = this.getSchema(); schema.getTopology().lock(); if (!foreignKeysContains(direction, vertexLabel)) { TopologyManager.addLabelToEdge(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), direction == Direction.IN, foreignKey); if (direction == Direction.IN) { this.uncommittedInVertexLabels.add(vertexLabel); vertexLabel.addToUncommittedInEdgeLabels(schema, this); } else { this.uncommittedOutVertexLabels.add(vertexLabel); vertexLabel.addToUncommittedOutEdgeLabels(schema, this); } SchemaTable vertexSchemaTable = SchemaTable.of(vertexLabel.getSchema().getName(), vertexLabel.getLabel()); addEdgeForeignKey(schema.getName(), EDGE_PREFIX + getLabel(), foreignKey, vertexSchemaTable); this.getSchema().getTopology().fire(this, vertexSchemaTable.toString(), TopologyChangeAction.ADD_IN_VERTEX_LABELTO_EDGE); } } }