Map<String, PropertyColumn> getPropertiesFor(SchemaTable schemaTable) { Preconditions.checkArgument(schemaTable.getTable().startsWith(VERTEX_PREFIX) || schemaTable.getTable().startsWith(EDGE_PREFIX), "label must start with \"%s\" or \"%s\"", Topology.VERTEX_PREFIX, Topology.EDGE_PREFIX); if (schemaTable.isVertexTable()) { Optional<VertexLabel> vertexLabelOptional = getVertexLabel(schemaTable.withOutPrefix().getTable()); if (vertexLabelOptional.isPresent()) { return vertexLabelOptional.get().getProperties(); } } else { Optional<EdgeLabel> edgeLabelOptional = getEdgeLabel(schemaTable.withOutPrefix().getTable()); if (edgeLabelOptional.isPresent()) { return edgeLabelOptional.get().getProperties(); } } return Collections.emptyMap(); }
Map<String, PropertyColumn> getPropertiesFor(SchemaTable schemaTable) { Preconditions.checkArgument(schemaTable.getTable().startsWith(VERTEX_PREFIX) || schemaTable.getTable().startsWith(EDGE_PREFIX), "label must start with \"%s\" or \"%s\"", Topology.VERTEX_PREFIX, Topology.EDGE_PREFIX); if (schemaTable.isVertexTable()) { Optional<VertexLabel> vertexLabelOptional = getVertexLabel(schemaTable.withOutPrefix().getTable()); if (vertexLabelOptional.isPresent()) { return vertexLabelOptional.get().getProperties(); } } else { Optional<EdgeLabel> edgeLabelOptional = getEdgeLabel(schemaTable.withOutPrefix().getTable()); if (edgeLabelOptional.isPresent()) { return edgeLabelOptional.get().getProperties(); } } return Collections.emptyMap(); }
@Override public List<Topology.TopologyValidationError> validateTopology(DatabaseMetaData metadata) { List<Topology.TopologyValidationError> validationErrors = new ArrayList<>(); for (PropertyColumn propertyColumn : getProperties().values()) { List<Triple<String, Integer, String>> columns = this.sqlgGraph.getSqlDialect().getTableColumns(metadata, null, this.getSchema().getName(), "E_" + this.getLabel(), propertyColumn.getName()); if (columns.isEmpty()) { validationErrors.add(new Topology.TopologyValidationError(propertyColumn)); } // try (ResultSet propertyRs = metadata.getColumns(null, this.getSchema().getName(), "E_" + this.getLabel(), propertyColumn.getName())) { // if (!propertyRs.next()) { // validationErrors.add(new Topology.TopologyValidationError(propertyColumn)); // } // } } return validationErrors; }
@Override public List<Topology.TopologyValidationError> validateTopology(DatabaseMetaData metadata) { List<Topology.TopologyValidationError> validationErrors = new ArrayList<>(); for (PropertyColumn propertyColumn : getProperties().values()) { List<Triple<String, Integer, String>> columns = this.sqlgGraph.getSqlDialect().getTableColumns(metadata, null, this.getSchema().getName(), "E_" + this.getLabel(), propertyColumn.getName()); if (columns.isEmpty()) { validationErrors.add(new Topology.TopologyValidationError(propertyColumn)); } // try (ResultSet propertyRs = metadata.getColumns(null, this.getSchema().getName(), "E_" + this.getLabel(), propertyColumn.getName())) { // if (!propertyRs.next()) { // validationErrors.add(new Topology.TopologyValidationError(propertyColumn)); // } // } } return validationErrors; }
.getSchema(schemaTable.getSchema()).orElseThrow(() -> new IllegalStateException(String.format("Schema %s not found", schemaTable.getSchema()))) .getEdgeLabel(schemaTable.getTable()).orElseThrow(() -> new IllegalStateException(String.format("EdgeLabel %s not found", schemaTable.getTable()))); Map<String, PropertyColumn> propertyColumns = edgeLabel.getProperties(); if (!columns.isEmpty()) { Map<String, PropertyType> propertyTypeMap = new HashMap<>();
.getSchema(schemaTable.getSchema()).orElseThrow(() -> new IllegalStateException(String.format("Schema %s not found", schemaTable.getSchema()))) .getEdgeLabel(schemaTable.getTable()).orElseThrow(() -> new IllegalStateException(String.format("EdgeLabel %s not found", schemaTable.getTable()))); Map<String, PropertyColumn> propertyColumns = edgeLabel.getProperties(); if (!columns.isEmpty()) { Map<String, PropertyType> propertyTypeMap = new HashMap<>();
.ensureIndexExists( IndexType.NON_UNIQUE, new ArrayList<>(edgeLabelOptional.get().getProperties().values()) );
propertyColumns = edgeLabel.getProperties();
propertyColumns = edgeLabel.getProperties();
.getSchema(schemaTable.getSchema()).orElseThrow(() -> new IllegalStateException(String.format("Schema '%s' not found", schemaTable.getSchema()))) .getEdgeLabel(schemaTable.getTable()).orElseThrow(() -> new IllegalStateException(String.format("EdgeLabel '%s' not found", schemaTable.getTable()))) .getProperties();
.getSchema(metaEdge.getSchemaTable().getSchema()).orElseThrow(() -> new IllegalStateException(String.format("Schema %s not found", metaEdge.getSchemaTable().getSchema()))) .getEdgeLabel(metaEdge.getSchemaTable().getTable()).orElseThrow(() -> new IllegalStateException(String.format("EdgeLabel %s not found", metaEdge.getSchemaTable().getTable()))) .getProperties();
.getSchema(metaEdge.getSchemaTable().getSchema()).orElseThrow(() -> new IllegalStateException(String.format("Schema %s not found", metaEdge.getSchemaTable().getSchema()))) .getEdgeLabel(metaEdge.getSchemaTable().getTable()).orElseThrow(() -> new IllegalStateException(String.format("EdgeLabel %s not found", metaEdge.getSchemaTable().getTable()))) .getProperties();