@Override public String toString() { return this.schemaTable.toString(); }
@Override public String toString() { return this.schemaTable.toString(); }
@Override public int compareTo(Object o) { if (!(o instanceof SchemaTable)) { return -1; } return toString().compareTo(o.toString()); }
@Override public int compareTo(Object o) { if (!(o instanceof SchemaTable)) { return -1; } return toString().compareTo(o.toString()); }
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
@Override public String toString() { return this.schemaTable.toString() + RECORD_ID_DELIMITER + this.id.toString(); }
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
@Override public void serialize(final SchemaTable schemaTable, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException, JsonGenerationException { // when types are not embedded, stringify or resort to JSON primitive representations of the // type so that non-jvm languages can better interoperate with the TinkerPop stack. jsonGenerator.writeString(schemaTable.toString()); }
@Override public String toString() { return this.schemaTable.toString() + RECORD_ID_DELIMITER + this.id.toString(); }
public Map<String, PropertyType> getTableFor(SchemaTable schemaTable) { Map<String, PropertyType> result = getAllTables(schemaTable.getSchema().equals(Topology.SQLG_SCHEMA), schemaTable.getSchema().equals(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA)).get(schemaTable.toString()); if (result != null) { return Collections.unmodifiableMap(result); } return Collections.emptyMap(); }
public Map<String, PropertyType> getTableFor(SchemaTable schemaTable) { Map<String, PropertyType> result = getAllTables(schemaTable.getSchema().equals(Topology.SQLG_SCHEMA), schemaTable.getSchema().equals(Schema.GLOBAL_UNIQUE_INDEX_SCHEMA)).get(schemaTable.toString()); if (result != null) { return Collections.unmodifiableMap(result); } return Collections.emptyMap(); }
private Set<SchemaTableTree> calculatePathFromVertexToEdge(SchemaTableTree schemaTableTree, SchemaTable schemaTableTo, Direction direction, Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> groupedIds) { Set<SchemaTableTree> result = new HashSet<>(); //add the child for schemaTableTo to the tree SchemaTableTree schemaTableTree1 = schemaTableTree.addChild( schemaTableTo, direction, Vertex.class, this, this.labels ); SchemaTable schemaTable = SchemaTable.from(this.topology.getSqlgGraph(), schemaTableTo.toString()); List<Multimap<BiPredicate, RecordId>> biPredicateRecordIs = groupedIds.get(schemaTable.withOutPrefix()); addIdHasContainers(schemaTableTree1, biPredicateRecordIs); result.add(schemaTableTree1); return result; }
private static void printEdgeInOutVertexIdFromClauseFor(SqlgGraph sqlgGraph, SchemaTableTree firstSchemaTableTree, SchemaTableTree lastSchemaTableTree, ColumnList cols) { Preconditions.checkState(lastSchemaTableTree.getSchemaTable().isEdgeTable()); Set<ForeignKey> edgeForeignKeys = sqlgGraph.getTopology().getEdgeForeignKeys().get(lastSchemaTableTree.getSchemaTable().toString()); for (ForeignKey edgeForeignKey : edgeForeignKeys) { if (firstSchemaTableTree == null || !firstSchemaTableTree.equals(lastSchemaTableTree) || firstSchemaTableTree.getDirection() != edgeForeignKey.getDirection()) { for (String foreignKey : edgeForeignKey.getCompositeKeys()) { String alias = lastSchemaTableTree.calculateAliasPropertyName(foreignKey); cols.addForeignKey(lastSchemaTableTree, foreignKey, alias); } } } }
private SqlgVertex internalStreamVertex(Object... keyValues) { Preconditions.checkState(this.sqlDialect.supportsStreamingBatchMode(), "Streaming batch mode is not supported."); final String label = ElementHelper.getLabelValue(keyValues).orElse(Vertex.DEFAULT_LABEL); SchemaTable schemaTablePair = SchemaTable.from(this, label); SchemaTable streamingBatchModeVertexSchemaTable = this.tx().getBatchManager().getStreamingBatchModeVertexSchemaTable(); if (streamingBatchModeVertexSchemaTable != null && !streamingBatchModeVertexSchemaTable.toString().equals(schemaTablePair.toString())) { throw new IllegalStateException("Streaming batch mode must occur for one label at a time. Expected \"" + streamingBatchModeVertexSchemaTable + "\" found \"" + label + "\". First commit the transaction or call SqlgGraph.flush() before streaming a different label"); } List<String> keys = this.tx().getBatchManager().getStreamingBatchModeVertexKeys(); Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> keyValueMapTriple = SqlgUtil.validateVertexKeysValues(this.sqlDialect, keyValues, keys); final Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair = Pair.of(keyValueMapTriple.getMiddle(), keyValueMapTriple.getRight()); final Map<String, PropertyType> columns = keyValueMapTriple.getLeft(); this.tx().readWrite(); this.getTopology().ensureVertexLabelExist(schemaTablePair.getSchema(), schemaTablePair.getTable(), columns); return new SqlgVertex(this, false, true, schemaTablePair.getSchema(), schemaTablePair.getTable(), keyValueMapPair); }
private void internalStreamTemporaryVertex(Object... keyValues) { Preconditions.checkState(this.sqlDialect.supportsBatchMode()); final String label = ElementHelper.getLabelValue(keyValues).orElse(Vertex.DEFAULT_LABEL); SchemaTable schemaTablePair = SchemaTable.from(this, label); SchemaTable streamingBatchModeVertexSchemaTable = this.tx().getBatchManager().getStreamingBatchModeVertexSchemaTable(); if (streamingBatchModeVertexSchemaTable != null && !streamingBatchModeVertexSchemaTable.toString().equals(schemaTablePair.toString())) { throw new IllegalStateException("Streaming batch mode must occur for one label at a time. Expected \"" + streamingBatchModeVertexSchemaTable + "\" found \"" + label + "\". First commit the transaction or call SqlgGraph.flush() before streaming a different label"); } List<String> keys = this.tx().getBatchManager().getStreamingBatchModeVertexKeys(); Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> keyValuesTriple = SqlgUtil.validateVertexKeysValues(this.sqlDialect, keyValues, keys); final Map<String, Object> allKeyValueMap = keyValuesTriple.getMiddle(); final Map<String, PropertyType> columns = keyValuesTriple.getLeft(); this.tx().readWrite(); this.getTopology().ensureTemporaryVertexTableExist(schemaTablePair.getSchema(), schemaTablePair.getTable(), columns); new SqlgVertex(this, schemaTablePair.getTable(), allKeyValueMap); }
private SqlgVertex internalStreamVertex(Object... keyValues) { Preconditions.checkState(this.sqlDialect.supportsStreamingBatchMode(), "Streaming batch mode is not supported."); final String label = ElementHelper.getLabelValue(keyValues).orElse(Vertex.DEFAULT_LABEL); SchemaTable schemaTablePair = SchemaTable.from(this, label); SchemaTable streamingBatchModeVertexSchemaTable = this.tx().getBatchManager().getStreamingBatchModeVertexSchemaTable(); if (streamingBatchModeVertexSchemaTable != null && !streamingBatchModeVertexSchemaTable.toString().equals(schemaTablePair.toString())) { throw new IllegalStateException("Streaming batch mode must occur for one label at a time. Expected \"" + streamingBatchModeVertexSchemaTable + "\" found \"" + label + "\". First commit the transaction or call SqlgGraph.flush() before streaming a different label"); } List<String> keys = this.tx().getBatchManager().getStreamingBatchModeVertexKeys(); Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> keyValueMapTriple = SqlgUtil.validateVertexKeysValues(this.sqlDialect, keyValues, keys); final Pair<Map<String, Object>, Map<String, Object>> keyValueMapPair = Pair.of(keyValueMapTriple.getMiddle(), keyValueMapTriple.getRight()); final Map<String, PropertyType> columns = keyValueMapTriple.getLeft(); this.tx().readWrite(); this.getTopology().ensureVertexLabelExist(schemaTablePair.getSchema(), schemaTablePair.getTable(), columns); return new SqlgVertex(this, false, true, schemaTablePair.getSchema(), schemaTablePair.getTable(), keyValueMapPair); }
private static void printEdgeInOutVertexIdFromClauseFor(SqlgGraph sqlgGraph, SchemaTableTree firstSchemaTableTree, SchemaTableTree lastSchemaTableTree, ColumnList cols) { Preconditions.checkState(lastSchemaTableTree.getSchemaTable().isEdgeTable()); Set<ForeignKey> edgeForeignKeys = sqlgGraph.getTopology().getEdgeForeignKeys().get(lastSchemaTableTree.getSchemaTable().toString()); for (ForeignKey edgeForeignKey : edgeForeignKeys) { if (firstSchemaTableTree == null || !firstSchemaTableTree.equals(lastSchemaTableTree) || firstSchemaTableTree.getDirection() != edgeForeignKey.getDirection()) { for (String foreignKey : edgeForeignKey.getCompositeKeys()) { String alias = lastSchemaTableTree.calculateAliasPropertyName(foreignKey); cols.addForeignKey(lastSchemaTableTree, foreignKey, alias); } } } }
private void printLabeledEdgeInOutVertexIdFromClauseFor(ColumnList cols) { Preconditions.checkState(this.getSchemaTable().isEdgeTable()); Set<ForeignKey> edgeForeignKeys = this.sqlgGraph.getTopology().getEdgeForeignKeys().get(this.getSchemaTable().toString()); for (ForeignKey edgeForeignKey : edgeForeignKeys) { for (String foreignKey : edgeForeignKey.getCompositeKeys()) { String alias = cols.getAlias(this.getSchemaTable(), foreignKey, this.stepDepth); if (alias == null) { cols.addForeignKey(this, foreignKey, this.calculateLabeledAliasPropertyName(foreignKey)); } else { this.calculateLabeledAliasPropertyName(foreignKey, alias); } } } }
private void printLabeledEdgeInOutVertexIdFromClauseFor(ColumnList cols) { Preconditions.checkState(this.getSchemaTable().isEdgeTable()); Set<ForeignKey> edgeForeignKeys = this.sqlgGraph.getTopology().getEdgeForeignKeys().get(this.getSchemaTable().toString()); for (ForeignKey edgeForeignKey : edgeForeignKeys) { for (String foreignKey : edgeForeignKey.getCompositeKeys()) { String alias = cols.getAlias(this.getSchemaTable(), foreignKey, this.stepDepth); if (alias == null) { cols.addForeignKey(this, foreignKey, this.calculateLabeledAliasPropertyName(foreignKey)); } else { this.calculateLabeledAliasPropertyName(foreignKey, alias); } } } }