/** * Only called for a new vertex/edge label being added. * * @param label The vertex or edge's label. * @param properties The vertex's properties. * @param identifiers The vertex or edge's identifiers */ AbstractLabel(SqlgGraph sqlgGraph, String label, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers) { this.sqlgGraph = sqlgGraph; this.label = label; for (Map.Entry<String, PropertyType> propertyEntry : properties.entrySet()) { PropertyColumn property = new PropertyColumn(this, propertyEntry.getKey(), propertyEntry.getValue()); property.setCommitted(false); this.uncommittedProperties.put(propertyEntry.getKey(), property); } this.uncommittedIdentifiers.addAll(identifiers); }
/** * Only called for a new vertex/edge label being added. * * @param label The vertex or edge's label. * @param properties The vertex's properties. * @param identifiers The vertex or edge's identifiers */ AbstractLabel(SqlgGraph sqlgGraph, String label, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers) { this.sqlgGraph = sqlgGraph; this.label = label; for (Map.Entry<String, PropertyType> propertyEntry : properties.entrySet()) { PropertyColumn property = new PropertyColumn(this, propertyEntry.getKey(), propertyEntry.getValue()); property.setCommitted(false); this.uncommittedProperties.put(propertyEntry.getKey(), property); } this.uncommittedIdentifiers.addAll(identifiers); }
/** * Only called for a new partitioned vertex/edge label being added. * * @param label The vertex or edge's label. * @param properties The element's properties. * @param identifiers The element's identifiers. * @param partitionType The partition type. i.e. RANGE or LIST. * @param partitionExpression The sql fragment to express the partition column or expression. */ AbstractLabel(SqlgGraph sqlgGraph, String label, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers, PartitionType partitionType, String partitionExpression) { Preconditions.checkArgument(partitionType == PartitionType.RANGE || partitionType == PartitionType.LIST, "Only RANGE and LIST partitions are supported. Found %s", partitionType.name()); Preconditions.checkArgument(!partitionExpression.isEmpty(), "partitionExpression may not be an empty string."); Preconditions.checkArgument(!identifiers.isEmpty(), "Partitioned labels must have at least one identifier."); this.sqlgGraph = sqlgGraph; this.label = label; for (Map.Entry<String, PropertyType> propertyEntry : properties.entrySet()) { PropertyColumn property = new PropertyColumn(this, propertyEntry.getKey(), propertyEntry.getValue()); property.setCommitted(false); this.uncommittedProperties.put(propertyEntry.getKey(), property); } this.uncommittedIdentifiers.addAll(identifiers); this.partitionType = partitionType; this.partitionExpression = partitionExpression; }
/** * Only called for a new partitioned vertex/edge label being added. * * @param label The vertex or edge's label. * @param properties The element's properties. * @param identifiers The element's identifiers. * @param partitionType The partition type. i.e. RANGE or LIST. * @param partitionExpression The sql fragment to express the partition column or expression. */ AbstractLabel(SqlgGraph sqlgGraph, String label, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers, PartitionType partitionType, String partitionExpression) { Preconditions.checkArgument(partitionType == PartitionType.RANGE || partitionType == PartitionType.LIST, "Only RANGE and LIST partitions are supported. Found %s", partitionType.name()); Preconditions.checkArgument(!partitionExpression.isEmpty(), "partitionExpression may not be an empty string."); Preconditions.checkArgument(!identifiers.isEmpty(), "Partitioned labels must have at least one identifier."); this.sqlgGraph = sqlgGraph; this.label = label; for (Map.Entry<String, PropertyType> propertyEntry : properties.entrySet()) { PropertyColumn property = new PropertyColumn(this, propertyEntry.getKey(), propertyEntry.getValue()); property.setCommitted(false); this.uncommittedProperties.put(propertyEntry.getKey(), property); } this.uncommittedIdentifiers.addAll(identifiers); this.partitionType = partitionType; this.partitionExpression = partitionExpression; }
private EdgeLabel( boolean forSqlgSchema, String edgeLabelName, VertexLabel outVertexLabel, VertexLabel inVertexLabel, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers) { super(outVertexLabel.getSchema().getSqlgGraph(), edgeLabelName, properties, identifiers); if (forSqlgSchema) { this.outVertexLabels.add(outVertexLabel); this.inVertexLabels.add(inVertexLabel); } else { this.uncommittedOutVertexLabels.add(outVertexLabel); this.uncommittedInVertexLabels.add(inVertexLabel); } // this is a topology edge label, the columns exist if (forSqlgSchema) { for (PropertyColumn pc : this.uncommittedProperties.values()) { pc.setCommitted(true); this.properties.put(pc.getName(), pc); } this.uncommittedProperties.clear(); } this.topology = outVertexLabel.getSchema().getTopology(); }
private EdgeLabel( boolean forSqlgSchema, String edgeLabelName, VertexLabel outVertexLabel, VertexLabel inVertexLabel, Map<String, PropertyType> properties, ListOrderedSet<String> identifiers) { super(outVertexLabel.getSchema().getSqlgGraph(), edgeLabelName, properties, identifiers); if (forSqlgSchema) { this.outVertexLabels.add(outVertexLabel); this.inVertexLabels.add(inVertexLabel); } else { this.uncommittedOutVertexLabels.add(outVertexLabel); this.uncommittedInVertexLabels.add(inVertexLabel); } // this is a topology edge label, the columns exist if (forSqlgSchema) { for (PropertyColumn pc : this.uncommittedProperties.values()) { pc.setCommitted(true); this.properties.put(pc.getName(), pc); } this.uncommittedProperties.clear(); } this.topology = outVertexLabel.getSchema().getTopology(); }
public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.schema.isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.schema.getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addVertexColumn(this.sqlgGraph, this.schema.getName(), VERTEX_PREFIX + getLabel(), column); addColumn(this.schema.getName(), VERTEX_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }
public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.schema.isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.schema.getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addVertexColumn(this.sqlgGraph, this.schema.getName(), VERTEX_PREFIX + getLabel(), column); addColumn(this.schema.getName(), VERTEX_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }
public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.getSchema().getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), column, new ListOrderedSet<>()); addColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }
public void ensurePropertiesExist(Map<String, PropertyType> columns) { for (Map.Entry<String, PropertyType> column : columns.entrySet()) { if (!this.properties.containsKey(column.getKey())) { Preconditions.checkState(!this.getSchema().isSqlgSchema(), "schema may not be %s", SQLG_SCHEMA); if (!this.uncommittedProperties.containsKey(column.getKey())) { this.getSchema().getTopology().lock(); if (!getProperty(column.getKey()).isPresent()) { TopologyManager.addEdgeColumn(this.sqlgGraph, this.getSchema().getName(), EDGE_PREFIX + getLabel(), column, new ListOrderedSet<>()); addColumn(this.getSchema().getName(), EDGE_PREFIX + getLabel(), ImmutablePair.of(column.getKey(), column.getValue())); PropertyColumn propertyColumn = new PropertyColumn(this, column.getKey(), column.getValue()); propertyColumn.setCommitted(false); this.uncommittedProperties.put(column.getKey(), propertyColumn); this.getSchema().getTopology().fire(propertyColumn, "", TopologyChangeAction.CREATE); } } } } }
pc.setCommitted(true); this.properties.put(pc.getName(), pc);
pc.setCommitted(true); this.properties.put(pc.getName(), pc);