edgeLabelOptional = this.getEdgeLabel(edgeLabelName); if (!edgeLabelOptional.isPresent()) { edgeLabel = this.createEdgeLabel(edgeLabelName, outVertexLabel, inVertexLabel, columns, identifiers); this.uncommittedRemovedEdgeLabels.remove(this.name + "." + EDGE_PREFIX + edgeLabelName); this.uncommittedOutEdgeLabels.put(this.name + "." + EDGE_PREFIX + edgeLabelName, edgeLabel);
edgeLabelOptional = this.getEdgeLabel(edgeLabelName); if (!edgeLabelOptional.isPresent()) { edgeLabel = this.createEdgeLabel(edgeLabelName, outVertexLabel, inVertexLabel, columns, identifiers); this.uncommittedRemovedEdgeLabels.remove(this.name + "." + EDGE_PREFIX + edgeLabelName); this.uncommittedOutEdgeLabels.put(this.name + "." + EDGE_PREFIX + edgeLabelName, edgeLabel);
@SuppressWarnings("OptionalGetWithoutIsPresent") private EdgeLabel createEdgeLabel( final String edgeLabelName, final VertexLabel outVertexLabel, final VertexLabel inVertexLabel, final Map<String, PropertyType> columns, final ListOrderedSet<String> identifiers) { Preconditions.checkArgument(this.topology.isSqlWriteLockHeldByCurrentThread(), "Lock must be held by the thread to call createEdgeLabel"); Preconditions.checkArgument(!edgeLabelName.startsWith(EDGE_PREFIX), "edgeLabelName may not start with " + EDGE_PREFIX); Preconditions.checkState(!this.isSqlgSchema(), "createEdgeLabel may not be called for \"%s\"", SQLG_SCHEMA); Schema inVertexSchema = inVertexLabel.getSchema(); //Edge may not already exist. Preconditions.checkState(!getEdgeLabel(edgeLabelName).isPresent(), "BUG: Edge \"%s\" already exists!", edgeLabelName); SchemaTable foreignKeyOut = SchemaTable.of(this.name, outVertexLabel.getLabel()); SchemaTable foreignKeyIn = SchemaTable.of(inVertexSchema.name, inVertexLabel.getLabel()); TopologyManager.addEdgeLabel(this.sqlgGraph, this.getName(), EDGE_PREFIX + edgeLabelName, foreignKeyOut, foreignKeyIn, columns, identifiers); if (this.sqlgGraph.getSqlDialect().needsSchemaCreationPrecommit()) { try { this.sqlgGraph.tx().getConnection().commit(); } catch (SQLException e) { throw new RuntimeException(e); } } return outVertexLabel.addEdgeLabel(edgeLabelName, inVertexLabel, columns, identifiers); }
@SuppressWarnings("OptionalGetWithoutIsPresent") private EdgeLabel createEdgeLabel( final String edgeLabelName, final VertexLabel outVertexLabel, final VertexLabel inVertexLabel, final Map<String, PropertyType> columns, final ListOrderedSet<String> identifiers) { Preconditions.checkArgument(this.topology.isSqlWriteLockHeldByCurrentThread(), "Lock must be held by the thread to call createEdgeLabel"); Preconditions.checkArgument(!edgeLabelName.startsWith(EDGE_PREFIX), "edgeLabelName may not start with " + EDGE_PREFIX); Preconditions.checkState(!this.isSqlgSchema(), "createEdgeLabel may not be called for \"%s\"", SQLG_SCHEMA); Schema inVertexSchema = inVertexLabel.getSchema(); //Edge may not already exist. Preconditions.checkState(!getEdgeLabel(edgeLabelName).isPresent(), "BUG: Edge \"%s\" already exists!", edgeLabelName); SchemaTable foreignKeyOut = SchemaTable.of(this.name, outVertexLabel.getLabel()); SchemaTable foreignKeyIn = SchemaTable.of(inVertexSchema.name, inVertexLabel.getLabel()); TopologyManager.addEdgeLabel(this.sqlgGraph, this.getName(), EDGE_PREFIX + edgeLabelName, foreignKeyOut, foreignKeyIn, columns, identifiers); if (this.sqlgGraph.getSqlDialect().needsSchemaCreationPrecommit()) { try { this.sqlgGraph.tx().getConnection().commit(); } catch (SQLException e) { throw new RuntimeException(e); } } return outVertexLabel.addEdgeLabel(edgeLabelName, inVertexLabel, columns, identifiers); }
edgeLabelOptional = this.getEdgeLabel(edgeLabelName); if (!edgeLabelOptional.isPresent()) { edgeLabel = this.createEdgeLabel(edgeLabelName, outVertexLabel, inVertexLabel, columns, identifiers); this.uncommittedRemovedEdgeLabels.remove(this.name + "." + EDGE_PREFIX + edgeLabelName); this.uncommittedOutEdgeLabels.put(this.name + "." + EDGE_PREFIX + edgeLabelName, edgeLabel);
edgeLabelOptional = this.getEdgeLabel(edgeLabelName); if (!edgeLabelOptional.isPresent()) { edgeLabel = this.createEdgeLabel(edgeLabelName, outVertexLabel, inVertexLabel, columns, identifiers); this.uncommittedRemovedEdgeLabels.remove(this.name + "." + EDGE_PREFIX + edgeLabelName); this.uncommittedOutEdgeLabels.put(this.name + "." + EDGE_PREFIX + edgeLabelName, edgeLabel);