@Override public SchemaTable createObject(final Map data) { return SchemaTable.of((String)data.get("schema"), (String) data.get("table")); } }
@Override public SchemaTable createObject(final Map data) { return SchemaTable.of((String)data.get("schema"), (String) data.get("table")); } }
public static SchemaTable parseLabel(final String label) { Objects.requireNonNull(label, "label may not be null!"); String[] schemaLabel = label.split("\\."); if (schemaLabel.length != 2) { throw new IllegalStateException(String.format("label must be if the format 'schema.table', %s", label)); } return SchemaTable.of(schemaLabel[0], schemaLabel[1]); }
public static SchemaTable parseLabel(final String label) { Objects.requireNonNull(label, "label may not be null!"); String[] schemaLabel = label.split("\\."); if (schemaLabel.length != 2) { throw new IllegalStateException(String.format("label must be if the format 'schema.table', %s", label)); } return SchemaTable.of(schemaLabel[0], schemaLabel[1]); }
private ForeignKey(String key) { this.compositeKeys.add(key); this.concatenatedIdentifiers += key; this.direction = key.endsWith(Topology.IN_VERTEX_COLUMN_END) ? Direction.IN : Direction.OUT; String[] split = key.split("\\."); String foreignKeySchema = split[0]; String foreignKeyTable = split[1]; this.schemaTable = SchemaTable.of(foreignKeySchema, foreignKeyTable); }
@Override public SchemaTable deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { @SuppressWarnings("unchecked") final Map<String, Object> data = deserializationContext.readValue(jsonParser, Map.class); return SchemaTable.of((String)data.get("schema"), (String) data.get("table")); }
@Override public SchemaTable deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { @SuppressWarnings("unchecked") final Map<String, Object> data = deserializationContext.readValue(jsonParser, Map.class); return SchemaTable.of((String)data.get("schema"), (String) data.get("table")); }
private ForeignKey(String key) { this.compositeKeys.add(key); this.concatenatedIdentifiers += key; this.direction = key.endsWith(Topology.IN_VERTEX_COLUMN_END) ? Direction.IN : Direction.OUT; String[] split = key.split("\\."); String foreignKeySchema = split[0]; String foreignKeyTable = split[1]; this.schemaTable = SchemaTable.of(foreignKeySchema, foreignKeyTable); }
public static SchemaTable parseLabelMaybeNoSchema(SqlgGraph sqlgGraph, final String label) { Objects.requireNonNull(label, "label may not be null!"); String[] schemaLabel = label.split("\\."); if (schemaLabel.length == 2) { return SchemaTable.of(schemaLabel[0], schemaLabel[1]); } else if (schemaLabel.length == 1) { return SchemaTable.of(sqlgGraph.getSqlDialect().getPublicSchema(), schemaLabel[0]); } else { throw new IllegalStateException("label must be if the format 'schema.table' or just 'table'"); } }
public static SchemaTable parseLabelMaybeNoSchema(SqlgGraph sqlgGraph, final String label) { Objects.requireNonNull(label, "label may not be null!"); String[] schemaLabel = label.split("\\."); if (schemaLabel.length == 2) { return SchemaTable.of(schemaLabel[0], schemaLabel[1]); } else if (schemaLabel.length == 1) { return SchemaTable.of(sqlgGraph.getSqlDialect().getPublicSchema(), schemaLabel[0]); } else { throw new IllegalStateException("label must be if the format 'schema.table' or just 'table'"); } }
public SchemaTable withPrefix(String prefix) { Preconditions.checkArgument(prefix.equals(VERTEX_PREFIX) || prefix.equals(EDGE_PREFIX), "Prefix must be either " + VERTEX_PREFIX + " or " + EDGE_PREFIX + " for " + prefix); Preconditions.checkState(!this.table.startsWith(VERTEX_PREFIX) && !this.table.startsWith(EDGE_PREFIX), "SchemaTable is already prefixed."); return SchemaTable.of(this.getSchema(), prefix + this.getTable()); }
public SchemaTable withOutPrefix() { Preconditions.checkState(this.table.startsWith(VERTEX_PREFIX) || this.table.startsWith(EDGE_PREFIX)); if (this.table.startsWith(VERTEX_PREFIX)) return SchemaTable.of(this.getSchema(), this.getTable().substring(VERTEX_PREFIX.length())); else return SchemaTable.of(this.getSchema(), this.getTable().substring(EDGE_PREFIX.length())); }
public SchemaTable withPrefix(String prefix) { Preconditions.checkArgument(prefix.equals(VERTEX_PREFIX) || prefix.equals(EDGE_PREFIX), "Prefix must be either " + VERTEX_PREFIX + " or " + EDGE_PREFIX + " for " + prefix); Preconditions.checkState(!this.table.startsWith(VERTEX_PREFIX) && !this.table.startsWith(EDGE_PREFIX), "SchemaTable is already prefixed."); return SchemaTable.of(this.getSchema(), prefix + this.getTable()); }
public SchemaTable withOutPrefix() { Preconditions.checkState(this.table.startsWith(VERTEX_PREFIX) || this.table.startsWith(EDGE_PREFIX)); if (this.table.startsWith(VERTEX_PREFIX)) return SchemaTable.of(this.getSchema(), this.getTable().substring(VERTEX_PREFIX.length())); else return SchemaTable.of(this.getSchema(), this.getTable().substring(EDGE_PREFIX.length())); }
public SqlgElement(SqlgGraph sqlgGraph, Long id, String schema, String table) { if (table.startsWith(VERTEX_PREFIX) || table.startsWith(EDGE_PREFIX)) { throw new IllegalStateException("SqlgElement.table may not be prefixed with " + VERTEX_PREFIX + " or " + EDGE_PREFIX); } this.sqlgGraph = sqlgGraph; this.schema = schema; this.table = table; this.recordId = RecordId.from(SchemaTable.of(this.schema, this.table), id); this.elementPropertyRollback = new SqlgElementElementPropertyRollback(); // if (!this.graph.tx().isInStreamingBatchMode() && !this.graph.tx().isInStreamingWithLockBatchMode()) { // graph.tx().addElementPropertyRollback(this.elementPropertyRollback); // } }
public SqlgElement(SqlgGraph sqlgGraph, ListOrderedSet<Comparable> identifiers, String schema, String table) { if (table.startsWith(VERTEX_PREFIX) || table.startsWith(EDGE_PREFIX)) { throw new IllegalStateException("SqlgElement.table may not be prefixed with " + VERTEX_PREFIX + " or " + EDGE_PREFIX); } this.sqlgGraph = sqlgGraph; this.schema = schema; this.table = table; this.recordId = RecordId.from(SchemaTable.of(this.schema, this.table), identifiers); this.elementPropertyRollback = new SqlgElementElementPropertyRollback(); // if (!this.graph.tx().isInStreamingBatchMode() && !this.graph.tx().isInStreamingWithLockBatchMode()) { // graph.tx().addElementPropertyRollback(this.elementPropertyRollback); // } }
Pair<Set<SchemaTable>, Set<SchemaTable>> getUncommittedSchemaTableForeignKeys() { Pair<Set<SchemaTable>, Set<SchemaTable>> result = Pair.of(new HashSet<>(), new HashSet<>()); for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedOutEdgeLabels.entrySet()) { result.getRight().add(SchemaTable.of(this.getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } for (Map.Entry<String, EdgeLabel> uncommittedEdgeLabelEntry : this.uncommittedInEdgeLabels.entrySet()) { result.getLeft().add(SchemaTable.of(uncommittedEdgeLabelEntry.getValue().getSchema().getName(), EDGE_PREFIX + uncommittedEdgeLabelEntry.getValue().getLabel())); } return result; }
private SchemaTable getHasContainerSchemaTable(SchemaTableTree schemaTableTree, SchemaTable predicateSchemaTable) { SchemaTable hasContainerLabelSchemaTable; //Check if we are on a vertex or edge if (schemaTableTree.getSchemaTable().getTable().startsWith(VERTEX_PREFIX)) { hasContainerLabelSchemaTable = SchemaTable.of(predicateSchemaTable.getSchema(), VERTEX_PREFIX + predicateSchemaTable.getTable()); } else { hasContainerLabelSchemaTable = SchemaTable.of(predicateSchemaTable.getSchema(), EDGE_PREFIX + predicateSchemaTable.getTable()); } return hasContainerLabelSchemaTable; }
private SchemaTable getHasContainerSchemaTable(SchemaTableTree schemaTableTree, SchemaTable predicateSchemaTable) { SchemaTable hasContainerLabelSchemaTable; //Check if we are on a vertex or edge if (schemaTableTree.getSchemaTable().getTable().startsWith(VERTEX_PREFIX)) { hasContainerLabelSchemaTable = SchemaTable.of(predicateSchemaTable.getSchema(), VERTEX_PREFIX + predicateSchemaTable.getTable()); } else { hasContainerLabelSchemaTable = SchemaTable.of(predicateSchemaTable.getSchema(), EDGE_PREFIX + predicateSchemaTable.getTable()); } return hasContainerLabelSchemaTable; }
void addTemporaryVertex(SqlgVertex sqlgVertex, Map<String, Object> keyValueMap) { SchemaTable schemaTable = SchemaTable.of(sqlgVertex.getSchema(), sqlgVertex.getTable()); Writer writer = this.streamingVertexOutputStreamCache.get(schemaTable); if (writer == null) { String sql = this.sqlDialect.constructCompleteCopyCommandTemporarySqlVertex(sqlgGraph, sqlgVertex, keyValueMap); writer = this.sqlDialect.streamSql(this.sqlgGraph, sql); this.streamingVertexOutputStreamCache.put(schemaTable, writer); } this.sqlDialect.writeTemporaryStreamingVertex(writer, keyValueMap); }