@Override public Vertex createElement(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if(properties == null) return null; return new DeferredVertex(properties, this, graph); } }
@Override public <V> VertexProperty<V> property(VertexProperty.Cardinality cardinality, String key, V value, Object... keyValues) { validateProperties(); return super.property(cardinality, key, value, keyValues); }
@Override public Set<String> toFields(Set<String> propertyKeys) { return super.toFields(propertyKeys).stream().map(key -> path + "." + key).collect(Collectors.toSet()); }
@Override protected VertexSchema createVertexSchema(String key) throws JSONException { JSONObject vertexConfiguration = this.json.optJSONObject(key); if(vertexConfiguration == null) return null; if(vertexConfiguration.optBoolean("ref", false)) return new ReferenceVertexSchema(vertexConfiguration, graph); return new InnerRowVertexSchema(vertexConfiguration, table, graph); }
@Override public void fetchProperties(DeferredVertexQuery uniQuery) { Map<DocumentVertexSchema, QueryBuilder> schemas = vertexSchemas.stream() .filter(schema -> this.traversalFilter.filter(schema, uniQuery.getTraversal())) .collect(new SearchCollector<>((schema) -> schema.getSearch(uniQuery))); Iterator<Vertex> search = search(uniQuery, schemas); Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream() .collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a)); search.forEachRemaining(newVertex -> { DeferredVertex deferredVertex = vertexMap.get(newVertex.id()); if (deferredVertex != null) deferredVertex.loadProperties(newVertex); }); }
public void loadProperties(Vertex vertex) { deferred = false; vertex.properties().forEachRemaining(prop -> addPropertyLocal(prop.key(), prop.value())); }
@Override public PredicatesHolder toPredicates(PredicatesHolder predicatesHolder) { return super.toPredicates(predicatesHolder).map(has -> new HasContainer(path + "." + has.getKey(), has.getPredicate())); } }
protected VertexSchema createVertexSchema(String key) throws JSONException { JSONObject vertexConfiguration = this.json.optJSONObject(key); if(vertexConfiguration == null) return null; if(vertexConfiguration.optBoolean("ref", false)) return new ReferenceVertexSchema(vertexConfiguration, graph); return new RowVertexSchema(vertexConfiguration, table, graph); }
@Override public void fetchProperties(DeferredVertexQuery uniQuery) { RestCollector<RestVertexSchema, BaseRequest, Vertex> collector = new RestCollector<>(schema -> schema.getSearch(uniQuery), (schema, result) -> schema.parseResults(result, uniQuery)); Map<RestVertexSchema, BaseRequest> schemas = vertexSchemas.stream() .filter(schema -> this.traversalFilter.filter(schema,uniQuery.getTraversal())).collect(collector); Iterator<Vertex> iterator = search(uniQuery, schemas, collector); Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream() .collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a)); iterator.forEachRemaining(newVertex -> { DeferredVertex deferredVertex = vertexMap.get(newVertex.id()); if (deferredVertex != null) deferredVertex.loadProperties(newVertex); }); }
@Override public <V> VertexProperty<V> property(String key, V value) { validateProperties(); return super.property(key, value); }
protected VertexSchema createVertexSchema(String key) throws JSONException { JSONObject vertexConfiguration = this.json.optJSONObject(key); if(vertexConfiguration == null) return null; if(vertexConfiguration.optBoolean("ref", false)) return new ReferenceVertexSchema(vertexConfiguration, graph); return new DocVertexSchema(vertexConfiguration, client, graph); }
@Override public void fetchProperties(DeferredVertexQuery uniQuery) { SelectCollector<JdbcSchema<Vertex>, Select, Vertex> collector = new SelectCollector<>( schema -> schema.getSearch(uniQuery, schema.toPredicates(uniQuery.getPredicates())), (schema, results) -> schema.parseResults(results, uniQuery) ); Map<JdbcSchema<Vertex>, Select> selects = vertexSchemas.stream() .filter(schema -> this.traversalFilter.filter(schema, uniQuery.getTraversal())).collect(collector); Iterator<Vertex> searchIterator = this.search(uniQuery, selects, collector); Map<Object, DeferredVertex> vertexMap = uniQuery.getVertices().stream().collect(Collectors.toMap(UniElement::id, Function.identity(), (a, b) -> a)); searchIterator.forEachRemaining(newVertex -> { DeferredVertex deferredVertex = vertexMap.get(newVertex.id()); if (deferredVertex != null) { deferredVertex.loadProperties(newVertex); } }); }
@Override public Set<String> keys() { validateProperties(); return super.keys(); }
protected VertexSchema createVertexSchema(String key, String resource) throws JSONException { JSONObject vertexConfiguration = this.json.optJSONObject(key); if (vertexConfiguration == null) return null; if (vertexConfiguration.optBoolean("ref", false)) return new ReferenceVertexSchema(vertexConfiguration, graph); return new RestVertex(vertexConfiguration, baseUrl, graph, templateHolder, resultPath, opTranslator, maxResultSize, complexTranslator, valuesToString); }
@Override public <V> VertexProperty<V> property(String key) { validateProperties(); return super.property(key); }
protected VertexSchema createVertexSchema(String key) throws JSONException { JSONObject vertexConfiguration = this.json.optJSONObject(key); if (vertexConfiguration == null) return null; if (vertexConfiguration.optBoolean("ref", false)) return new ReferenceVertexSchema(vertexConfiguration, graph); return new RestVertex(vertexConfiguration, baseUrl, resource, graph, templateHolder, resultPath, opTranslator, maxResultSize, complexTranslator, valuesToString); }
@Override public <V> Iterator<VertexProperty<V>> properties(String... propertyKeys) { validateProperties(); return super.properties(propertyKeys); }
@Override public void removeProperty(Property property) { validateProperties(); super.removeProperty(property); } }