@Override default Collection<Vertex> fromFields(Map<String, Object> fields) { Vertex element = createElement(fields); if(element == null) return null; return Collections.singleton(element); }
@Override public Collection<Edge> fromFields(Map<String, Object> fields) { Map<String, Object> edgeProperties = getProperties(fields); if(edgeProperties == null) return null; Vertex outVertex = outVertexSchema.createElement(fields); if(outVertex == null) return null; Vertex inVertex = inVertexSchema.createElement(fields); if(inVertex == null) return null; UniEdge uniEdge = new UniEdge(edgeProperties, outVertex, inVertex, this, graph); return Collections.singleton(uniEdge); }
@Override public Collection<Edge> fromFields(Map<String, Object> fields) { Map<String, Object> edgeProperties = getProperties(fields); if(edgeProperties == null) return null; Vertex outVertex = outVertexSchema.createElement(fields); if(outVertex == null) return null; Vertex inVertex = inVertexSchema.createElement(fields); if(inVertex == null) return null; UniEdge uniEdge = new UniEdge(edgeProperties, outVertex, inVertex, this, graph); return Collections.singleton(uniEdge); }
@Override protected Edge create(Map<String, Object> fields) { Map<String, Object> properties = getProperties(fields); if (properties == null) return null; return new UniEdge(properties, outVertexSchema.createElement(fields), inVertexSchema.createElement(fields), this, graph); }
@Override public Collection<UniEdge> fromVertex(UniVertex parentVertex, Map<String, Object> fields) { Map edgeProperties = this.getProperties(fields); Object inVertex; Object outVertex; if (edgeProperties == null) return null; outVertex = this.outVertexSchema.equals(this.parentVertexSchema) ? parentVertex : this.outVertexSchema.createElement(fields); inVertex = this.outVertexSchema.equals(this.parentVertexSchema) ? parentVertex : this.inVertexSchema.createElement(fields); if (inVertex == null || outVertex == null) return null; UniEdge uniEdge = new UniEdge(edgeProperties, (Vertex)outVertex, (Vertex)inVertex, this, this.graph); return Collections.singleton(uniEdge); } }
private UniEdge createEdge(Vertex parentVertex, Map<String, Object> edgeFields) { Map<String, Object> edgeProperties = getProperties(edgeFields); if (edgeProperties == null) return null; Vertex childVertex = childVertexSchema.createElement(edgeFields); if (childVertex == null) return null; UniEdge edge = new UniEdge(edgeProperties, parentDirection.equals(Direction.OUT) ? parentVertex : childVertex, parentDirection.equals(Direction.IN) ? parentVertex : childVertex, this, graph); return edge; }