public Set<String> getEdgeLabels(final Direction direction) { if (direction.equals(Direction.OUT)) return this.outEdges.keySet(); else if (direction.equals(Direction.IN)) return this.inEdges.keySet(); else { final Set<String> labels = new HashSet<String>(); labels.addAll(this.outEdges.keySet()); labels.addAll(this.inEdges.keySet()); return labels; } }
@Override public Vertex getVertex(Direction direction) throws IllegalArgumentException { if (!Direction.IN.equals(direction) && !Direction.OUT.equals(direction)) { throw new IllegalArgumentException("Invalid direction: "+direction); } // The vertex information needs to be loaded. if (inVertex == null || outVertex == null || label == null) { log.debug("Loading information for edge: "+this); globals.getEdgeWrapper().loadEndpointsAndLabel(this); } return Direction.IN.equals(direction) ? inVertex : outVertex; }
@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 void addEdges(final Direction direction, final FaunusVertex vertex) { if (direction.equals(OUT) || direction.equals(BOTH)) { for (final String label : vertex.getEdgeLabels(OUT)) { this.addEdges(OUT, label, (List) vertex.getEdges(OUT, label)); } } if (direction.equals(IN) || direction.equals(BOTH)) { for (final String label : vertex.getEdgeLabels(IN)) { this.addEdges(IN, label, (List) vertex.getEdges(IN, label)); } } }
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 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()); }
@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 Iterable<Edge> getEdges(final Direction direction, final String... labels) { if (direction.equals(Direction.OUT)) { return this.getOutEdges(labels); } else if (direction.equals(Direction.IN)) return this.getInEdges(labels); else { return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels))); } }
public CloseableIterable<Vertex> getVertices(final Direction direction, final String... labels) { graph.autoStartTransaction(false); if (direction.equals(Direction.OUT)) { return this.getIterable(Vertex.class, SPARKSEE_OUT, labels); } else if (direction.equals(Direction.IN)) { return this.getIterable(Vertex.class, SPARKSEE_IN, labels); } else { return new MultiIterable<Vertex>(new ArrayList<Iterable<Vertex>>( Arrays.asList(this.getIterable(Vertex.class, SPARKSEE_IN, labels), this.getIterable(Vertex.class, SPARKSEE_OUT, labels)))); } }
public CloseableIterable<Edge> getEdges(final Direction direction, final String... labels) { graph.autoStartTransaction(false); if (direction.equals(Direction.OUT)) { return this.getIterable(Edge.class, SPARKSEE_OUT, labels); } else if (direction.equals(Direction.IN)) { return this.getIterable(Edge.class, SPARKSEE_IN, labels); } else { return new MultiIterable<Edge>(new ArrayList<Iterable<Edge>>( Arrays.asList(this.getIterable(Edge.class, SPARKSEE_IN, labels), this.getIterable(Edge.class, SPARKSEE_OUT, labels)))); } }
public Iterable<Edge> getEdges(final Direction direction, final String... labels) { if (direction.equals(Direction.OUT)) { return this.getOutEdges(labels); } else if (direction.equals(Direction.IN)) return this.getInEdges(labels); else { return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels))); } }
public Iterable<Edge> getEdges(final Direction direction, final String... labels) { if (direction.equals(Direction.OUT)) { return this.getOutEdges(labels); } else if (direction.equals(Direction.IN)) return this.getInEdges(labels); else { return new MultiIterable<Edge>(Arrays.asList(this.getInEdges(labels), this.getOutEdges(labels))); } }
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(); }
@Override public void setup(final Reducer.Context context) throws IOException, InterruptedException { this.direction = Direction.valueOf(context.getConfiguration().get(DIRECTION)); if (!this.direction.equals(BOTH)) this.direction = this.direction.opposite(); this.labels = context.getConfiguration().getStrings(LABELS); this.vertex = new FaunusVertex(context.getConfiguration().getBoolean(FaunusCompiler.PATH_ENABLED, false)); }
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(); }