public String getVertexId(Direction direction) throws IllegalArgumentException { switch (direction) { case IN: return destinationId; case OUT: return sourceId; case BOTH: default: throw ExceptionFactory.bothIsNotSupported(); } }
public String getVertexId(Direction direction) throws IllegalArgumentException { switch (direction) { case IN: return destinationId; case OUT: return sourceId; case BOTH: default: throw ExceptionFactory.bothIsNotSupported(); } }
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException { this.direction = context.getConfiguration().getEnum(FAUNUS_GRAPH_INPUT_EDGE_COPY_DIRECTION, Direction.OUT); if (this.direction.equals(Direction.BOTH)) throw new InterruptedException(ExceptionFactory.bothIsNotSupported().getMessage()); }
public long getVertexId(final Direction direction) { if (OUT.equals(direction)) { return this.outVertex; } else if (IN.equals(direction)) { return this.inVertex; } else { throw ExceptionFactory.bothIsNotSupported(); } }
private void addEdges(final Direction direction, final String label, final List<FaunusEdge> edges) { List<Edge> list; if (direction.equals(OUT)) list = this.outEdges.get(label); else if (direction.equals(IN)) list = this.inEdges.get(label); else throw ExceptionFactory.bothIsNotSupported(); if (null == list) { list = new ArrayList<Edge>(); if (direction.equals(OUT)) this.outEdges.put(label, list); else this.inEdges.put(label, list); } list.addAll(edges); }
@Override public void setup(final Reduce.Context context) throws IOException, InterruptedException { this.direction = context.getConfiguration().getEnum(FAUNUS_GRAPH_INPUT_EDGE_COPY_DIRECTION, Direction.OUT); if (this.direction.equals(Direction.BOTH)) throw new InterruptedException(ExceptionFactory.bothIsNotSupported().getMessage()); }
public Vertex getVertex(final Direction direction) throws IllegalArgumentException { if (direction.equals(Direction.IN)) return this.inVertex; else if (direction.equals(Direction.OUT)) return this.outVertex; else throw ExceptionFactory.bothIsNotSupported(); }
public FaunusEdge addEdge(final Direction direction, final FaunusEdge edge) { if (OUT.equals(direction)) { List<Edge> edges = this.outEdges.get(edge.getLabel()); if (null == edges) { edges = new ArrayList<Edge>(); this.outEdges.put(edge.getLabel(), edges); } edges.add(edge); } else if (IN.equals(direction)) { List<Edge> edges = this.inEdges.get(edge.getLabel()); if (null == edges) { edges = new ArrayList<Edge>(); this.inEdges.put(edge.getLabel(), edges); } edges.add(edge); } else throw ExceptionFactory.bothIsNotSupported(); return edge; }
public Vertex getVertex(final Direction direction) { if (OUT.equals(direction)) { return new FaunusVertex(this.outVertex); } else if (IN.equals(direction)) { return new FaunusVertex(this.inVertex); } else { throw ExceptionFactory.bothIsNotSupported(); } }
public void writeCompressed(final DataOutput out, final Direction idToWrite) throws IOException { super.write(out); if (idToWrite.equals(Direction.IN)) WritableUtils.writeVLong(out, this.inVertex); else if (idToWrite.equals(Direction.OUT)) WritableUtils.writeVLong(out, this.outVertex); else throw ExceptionFactory.bothIsNotSupported(); }
public void readFieldsCompressed(final DataInput in, final Direction idToRead) throws IOException { super.readFields(in); if (idToRead.equals(Direction.IN)) this.inVertex = WritableUtils.readVLong(in); else if (idToRead.equals(Direction.OUT)) this.outVertex = WritableUtils.readVLong(in); else throw ExceptionFactory.bothIsNotSupported(); this.label = null; }
@Override public Vertex getVertex(final Direction direction) { if (direction.equals(Direction.BOTH)) { throw ExceptionFactory.bothIsNotSupported(); } graph.autoStartTransaction(false); setEdges(); long vertexId = (direction.equals(Direction.OUT)) ? out : in; return new SparkseeVertex(graph, vertexId); }
public Vertex getVertex(final Direction direction) { if (direction.equals(Direction.OUT)) return new SailVertex(this.rawEdge.getSubject(), this.graph); else if (direction.equals(Direction.IN)) return new SailVertex(this.rawEdge.getObject(), this.graph); else throw ExceptionFactory.bothIsNotSupported(); }
public Edge addEdge(final Direction direction, final String label, final long otherVertexId) { if (direction.equals(Direction.OUT)) return this.addEdge(Direction.OUT, new FaunusEdge(this.id, otherVertexId, label)); else if (direction.equals(Direction.IN)) return this.addEdge(Direction.IN, new FaunusEdge(otherVertexId, this.id, label)); else throw ExceptionFactory.bothIsNotSupported(); }
public void build() { if (this.type instanceof SystemType) return; if (this.type.isPropertyKey()) { Preconditions.checkNotNull(value); vertex.setProperty(this.type.getName(), this.value); } else { Preconditions.checkArgument(this.type.isEdgeLabel()); FaunusEdge edge = null; if (this.direction.equals(Direction.IN)) edge = new FaunusEdge(this.relationID, this.otherVertexID, getVertexID(), this.type.getName()); else if (this.direction.equals(Direction.OUT)) edge = new FaunusEdge(this.relationID, getVertexID(), this.otherVertexID, this.type.getName()); else if (this.direction.equals(Direction.BOTH)) throw ExceptionFactory.bothIsNotSupported(); if (null != edge) { // load edge properties for (final Map.Entry<String, Object> entry : this.properties.entrySet()) { if (entry.getValue() != null) { edge.setProperty(entry.getKey(), entry.getValue()); } } vertex.addEdge(this.direction, edge); } } } }
public Vertex getVertex(final Direction direction) { this.graph.autoStartTransaction(false); if (direction.equals(Direction.OUT)) return new Neo4j2Vertex(((Relationship) this.rawElement).getStartNode(), this.graph); else if (direction.equals(Direction.IN)) return new Neo4j2Vertex(((Relationship) this.rawElement).getEndNode(), this.graph); else throw ExceptionFactory.bothIsNotSupported(); }
@Override public OrientVertex getVertex(final Direction direction) { graph.setCurrentGraphInThreadLocal(); if (direction.equals(Direction.OUT)) return new OrientVertex(graph, getOutVertex()); else if (direction.equals(Direction.IN)) return new OrientVertex(graph, getInVertex()); else throw ExceptionFactory.bothIsNotSupported(); }
/** * Returns the connected incoming or outgoing vertex. * * @param direction Direction between IN or OUT */ @Override public OrientVertex getVertex(final Direction direction) { final OrientBaseGraph graph = setCurrentGraphInThreadLocal(); if (direction.equals(Direction.OUT)) return graph.getVertex(getOutVertex()); else if (direction.equals(Direction.IN)) return graph.getVertex(getInVertex()); else throw ExceptionFactory.bothIsNotSupported(); }
public Vertex getVertex(final Direction direction) { if (direction.equals(Direction.OUT)) return new RexsterVertex(RestHelper.getResultObject(this.graph.getGraphURI() + RexsterTokens.SLASH_VERTICES_SLASH + RestHelper.encode(this.outVertex)), this.graph); else if (direction.equals(Direction.IN)) return new RexsterVertex(RestHelper.getResultObject(this.graph.getGraphURI() + RexsterTokens.SLASH_VERTICES_SLASH + RestHelper.encode(this.inVertex)), this.graph); else throw ExceptionFactory.bothIsNotSupported(); }