com.tinkerpop.blueprints.Direction Java Examples

The following examples show how to use com.tinkerpop.blueprints.Direction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DElementStore.java    From org.openntf.domino with Apache License 2.0 6 votes vote down vote up
@Override
public void removeEdge(final Edge edge) {
	if (edge instanceof DEdge) {
		if (org.openntf.domino.ViewEntry.class.equals(((DEdge) edge).getDelegateType())) {
			throw new UnsupportedOperationException("ViewEntry edges cannot be removed.");
		}
	}
	startTransaction(edge);
	Vertex in = edge.getVertex(Direction.IN);
	if (in != null) {
		((DVertex) in).removeEdge(edge);
	}
	Vertex out = edge.getVertex(Direction.OUT);
	if (out != null) {
		((DVertex) out).removeEdge(edge);
	}
	removeCache(edge);
	((DEdge) edge)._remove();
}
 
Example #2
Source File: AbstractProductRule.java    From light with Apache License 2.0 6 votes vote down vote up
protected void upVoteProduct(Map<String, Object> data) {
    OrientGraph graph = ServiceLocator.getInstance().getGraph();
    try {
        graph.begin();
        OrientVertex updateUser = (OrientVertex) graph.getVertexByKey("User.userId", data.remove("updateUserId"));
        OrientVertex product = (OrientVertex) graph.getVertexByKey("Product.entityId", data.get("entityId"));
        if (product != null && updateUser != null) {
            // remove DownVote edge if there is.
            for (Edge edge : updateUser.getEdges(product, Direction.OUT, "DownVote")) {
                if (edge.getVertex(Direction.IN).equals(product)) graph.removeEdge(edge);
            }
            updateUser.addEdge("UpVote", product);
        }
        graph.commit();
    } catch (Exception e) {
        logger.error("Exception:", e);
        graph.rollback();
    } finally {
        graph.shutdown();
    }
}
 
Example #3
Source File: VertexEvent.java    From epcis with Apache License 2.0 6 votes vote down vote up
public Stream<VertexEvent> getVertexEventStream(final Direction direction, final BsonArray labels,
		TemporalType typeOfVertexEvent, final AC tt, final AC s, final AC e, final AC ss, final AC se, final AC es,
		final AC ee, final Position pos, final boolean setParallel) {

	if (typeOfVertexEvent == null)
		typeOfVertexEvent = this.temporalType;

	final Stream<ChronoEdge> edgeStream = vertex.getChronoEdgeStream(direction, labels, Integer.MAX_VALUE,
			setParallel);

	// T -> T
	return edgeStream.map(edge -> {
		Long t = edge.getTimestamp(timestamp, tt);
		return edge.pickTimestamp(t);
	}).filter(edge -> edge != null).map(edgeEvent -> edgeEvent.getVertexEvent(direction.opposite()));
}
 
Example #4
Source File: CachedChronoVertex.java    From epcis with Apache License 2.0 6 votes vote down vote up
public Set<CachedChronoVertex> getChronoVertexSet(final Direction direction, final BsonArray labels,
		final int branchFactor) {

	HashSet<Long> labelIdxSet = null;
	if (labels != null) {
		labelIdxSet = convertToLabelIdxSet(labels);
	}

	if (direction.equals(Direction.OUT)) {
		return this.getOutChronoVertexSet(labelIdxSet, branchFactor);
	} else if (direction.equals(Direction.IN))
		return this.getInChronoVertexSet(labelIdxSet, branchFactor);
	else {
		Set<CachedChronoVertex> ret = this.getOutChronoVertexSet(labelIdxSet, branchFactor);
		ret.addAll(this.getInChronoVertexSet(labelIdxSet, branchFactor));
		return ret;
	}
}
 
Example #5
Source File: CachedChronoVertex.java    From epcis with Apache License 2.0 6 votes vote down vote up
/**
 * Return the edges incident to the vertex according to the provided direction
 * and edge labels.
 *
 * @param direction
 *            the direction of the edges to retrieve
 * @param labels
 *            the labels of the edges to retrieve
 * @return an iterable of incident edges
 */
public Iterable<CachedChronoEdge> getChronoEdges(final Direction direction, final BsonArray labels,
		final int branchFactor) {

	HashSet<Long> labelIdxSet = null;
	if (labels != null) {
		labelIdxSet = convertToLabelIdxSet(labels);
	}

	if (direction.equals(Direction.OUT)) {
		return this.getOutChronoEdges(labelIdxSet, branchFactor);
	} else if (direction.equals(Direction.IN))
		return this.getInChronoEdges(labelIdxSet, branchFactor);
	else {
		return new MultiIterable<CachedChronoEdge>(Arrays.asList(this.getInChronoEdges(labelIdxSet, branchFactor),
				this.getOutChronoEdges(labelIdxSet, branchFactor)));
	}
}
 
Example #6
Source File: TraversalEngine.java    From epcis with Apache License 2.0 5 votes vote down vote up
/**
 * Add a BothPipe to the end of the Pipeline. Emit the adjacent incoming
 * vertices for the incoming vertex.
 *
 * Path Enabled -> Greedy,
 * 
 * Path Disabled -> Lazy
 * 
 * Pipeline: Stream<CachedChronoVertex> -> Stream<CachedChronoVertex>
 *
 * Path: Map<CachedChronoVertex, Set<CachedChronoVertex>>
 *
 * @param branchFactor
 *            the number of max adjacent vertices for each incoming vertex
 * @param labels
 *            the edge labels to traverse
 * @return the extended Pipeline
 */
public TraversalEngine both(final BsonArray labels, final int branchFactor) {
	// Check Input element class
	checkInputElementClass(ChronoVertex.class);

	// Pipeline Update
	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.map(v -> {
			ChronoVertex cv = (ChronoVertex) v;
			return new AbstractMap.SimpleImmutableEntry(cv,
					cv.getChronoVertexSet(Direction.BOTH, labels, branchFactor));
		}).collect(Collectors.toMap(e -> ((Entry) e).getKey(), e -> ((Entry) e).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.flatMap(v -> {
			return ((ChronoVertex) v).getChronoVertexStream(Direction.BOTH, labels, branchFactor, isParallel);
		});
	}
	// Step Update
	final Class[] args = new Class[2];
	args[0] = BsonArray.class;
	args[1] = Integer.TYPE;
	final Step step = new Step(this.getClass().getName(), "both", args, labels, branchFactor);
	stepList.add(step);

	// Set Class
	elementClass = ChronoVertex.class;
	return this;
}
 
Example #7
Source File: GraphHelper.java    From org.openntf.domino with Apache License 2.0 5 votes vote down vote up
/**
 * Copy the vertex/edges of one graph over to another graph.
 * The id of the elements in the from graph are attempted to be used in the to graph.
 * This method only works for graphs where the user can control the element ids.
 *
 * @param from the graph to copy from
 * @param to   the graph to copy to
 */
public static void copyGraph(final Graph from, final Graph to) {
    for (final Vertex fromVertex : from.getVertices()) {
        final Vertex toVertex = to.addVertex(fromVertex.getId());
        ElementHelper.copyProperties(fromVertex, toVertex);
    }
    for (final Edge fromEdge : from.getEdges()) {
        final Vertex outVertex = to.getVertex(fromEdge.getVertex(Direction.OUT).getId());
        final Vertex inVertex = to.getVertex(fromEdge.getVertex(Direction.IN).getId());
        final Edge toEdge = to.addEdge(fromEdge.getId(), outVertex, inVertex, fromEdge.getLabel());
        ElementHelper.copyProperties(fromEdge, toEdge);
    }
}
 
Example #8
Source File: DVertex.java    From org.openntf.domino with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<Vertex> getVertices(final Direction direction, final String... labels) {
	if (direction == Direction.BOTH) {
		List<Iterable<Vertex>> list = new ArrayList<Iterable<Vertex>>();
		list.add(new VerticesFromEdgesIterable(this, Direction.IN, labels));
		list.add(new VerticesFromEdgesIterable(this, Direction.OUT, labels));
		return new MultiIterable<Vertex>(list);
	} else {
		return new VerticesFromEdgesIterable(this, direction, labels);
	}
}
 
Example #9
Source File: ExternalTraversalEngine.java    From epcis with Apache License 2.0 5 votes vote down vote up
/**
 * Add a InPipe to the end of the Pipeline. Emit the adjacent incoming vertices
 * for the incoming vertex.
 *
 * Path Enabled -> Greedy,
 * 
 * Path Disabled -> Lazy
 *
 * Pipeline: Stream<CachedChronoVertex> -> Stream<CachedChronoEdge>
 *
 * Path: Map<CachedChronoVertex, Set<CachedChronoEdge>>
 *
 * @param branchFactor
 *            the number of max incident edges for each incoming vertex
 * @param labels
 *            the edge labels to traverse
 * @return the extended Pipeline
 */
public ExternalTraversalEngine inE(final BsonArray labels, final int branchFactor) {
	// Check Input element class
	checkInputElementClass(ChronoVertex.class);

	// Pipeline Update

	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.map(v -> {
			ChronoVertex cv = (ChronoVertex) v;
			return new AbstractMap.SimpleImmutableEntry(cv,
					cv.getChronoEdgeSet(Direction.IN, labels, branchFactor));
		}).collect(Collectors.toMap(e -> ((Entry) e).getKey(), e -> ((Entry) e).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.flatMap(v -> {
			return ((ChronoVertex) v).getChronoEdgeStream(Direction.IN, labels, branchFactor, isParallel);
		});
	}

	// Step Update
	final Class[] args = new Class[2];
	args[0] = BsonArray.class;
	args[1] = Integer.TYPE;
	final Step step = new Step(this.getClass().getName(), "inE", args, labels, branchFactor);
	stepList.add(step);

	// Set Class
	elementClass = ChronoEdge.class;
	return this;
}
 
Example #10
Source File: VertexEvent.java    From epcis with Apache License 2.0 5 votes vote down vote up
public Set<EdgeEvent> getEdgeEventSet(final Direction direction, final BsonArray labels,
		TemporalType typeOfEdgeEvent, final AC tt, final AC s, final AC e, final AC ss, final AC se, final AC es,
		final AC ee) {
	if (typeOfEdgeEvent == null)
		typeOfEdgeEvent = this.temporalType;

	Set<ChronoEdge> edgeSet = vertex.getChronoEdgeSet(direction, labels, Integer.MAX_VALUE);

	// T -> T
	Set<EdgeEvent> ret = edgeSet.parallelStream().map(edge -> {
		Long t = edge.getTimestamp(timestamp, tt);
		return edge.pickTimestamp(t);
	}).filter(edgeEvent -> exFilter(edgeEvent)).collect(Collectors.toSet());
	return ret;
}
 
Example #11
Source File: OrientDBArquillianTest.java    From thorntail with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldAddAFriendshipToTheGraph() {
    String firstName = "test-name-" + LocalTime.now();
    String secondName = "test-name-" + LocalTime.now();
    OrientEdge edge = statefulTestBean.addFriend(firstName, secondName);
    assertEquals(firstName, edge.getVertex(Direction.OUT).getProperty("name"));
    assertEquals(secondName, edge.getVertex(Direction.IN).getProperty("name"));
    assertEquals("knows", edge.getLabel());

    List<Edge> edges = statefulTestBean.getFriends();
    assertEquals(1, edges.size());
    assertEquals(edge, edges.get(0));
}
 
Example #12
Source File: DVertex.java    From org.openntf.domino with Apache License 2.0 5 votes vote down vote up
@Override
public Iterable<Edge> getEdges(final Direction direction, final String... labels) {
	if (direction == Direction.IN) {
		if (labels == null || labels.length == 0) {
			return getInEdgeObjects().unmodifiable();
		} else {
			return getInEdgeObjects(labels);
		}
	} else if (direction == Direction.OUT) {
		if (labels == null || labels.length == 0) {
			return getOutEdgeObjects().unmodifiable();
		} else {
			return getOutEdgeObjects(labels);
		}
	} else {
		DEdgeList result = null;
		if (labels == null || labels.length == 0) {
			result = getInEdgeObjects();
			if (result == null) {
				result = getOutEdgeObjects();
			} else {
				result.addAll(getOutEdgeObjects());
			}
		} else {
			result = getInEdgeObjects(labels);
			if (result == null) {
				result = getOutEdgeObjects(labels);
			} else {
				result.addAll(getOutEdgeObjects(labels));
			}
		}
		//			if (result != null) {
		//				System.out.println("Found " + result.size() + " edges going " + direction.name());
		//			}
		return result;
	}
}
 
Example #13
Source File: TraversalEngine.java    From epcis with Apache License 2.0 5 votes vote down vote up
/**
 * Add an InVertexPipe to the end of the Pipeline. Emit the head vertex of the
 * incoming edge.
 * 
 * Path Enabled -> Greedy,
 * 
 * Path Disabled -> Lazy
 * 
 * Pipeline: Stream<CachedChronoEdge> -> Stream<CachedChronoVertex>
 * 
 * Path: Map<CachedChronoEdge, CachedChronoVertex>
 * 
 * @return the extended Pipeline
 */
public TraversalEngine inV() {
	// Check Input element class
	checkInputElementClass(ChronoEdge.class);

	// Pipeline Update
	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.map(e -> {
			ChronoEdge ce = (ChronoEdge) e;
			return new AbstractMap.SimpleImmutableEntry(ce, ce.getChronoVertex(Direction.IN));
		}).collect(Collectors.toMap(e -> ((Entry) e).getKey(), e -> ((Entry) e).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.map(e -> {
			return ((ChronoEdge) e).getChronoVertex(Direction.IN);
		});
	}

	// Step Update
	final Class[] args = {};
	final Step step = new Step(this.getClass().getName(), "inV", args);
	stepList.add(step);

	// Set Class
	elementClass = ChronoVertex.class;
	return this;
}
 
Example #14
Source File: TraversalEngine.java    From epcis with Apache License 2.0 5 votes vote down vote up
/**
 * Add a InPipe to the end of the Pipeline. Emit the adjacent incoming vertices
 * for the incoming vertex.
 *
 * Path Enabled -> Greedy,
 * 
 * Path Disabled -> Lazy
 *
 * Pipeline: Stream<CachedChronoVertex> -> Stream<CachedChronoEdge>
 *
 * Path: Map<CachedChronoVertex, Set<CachedChronoEdge>>
 *
 * @param branchFactor
 *            the number of max incident edges for each incoming vertex
 * @param labels
 *            the edge labels to traverse
 * @return the extended Pipeline
 */
public TraversalEngine inE(final BsonArray labels, final int branchFactor) {
	// Check Input element class
	checkInputElementClass(ChronoVertex.class);

	// Pipeline Update

	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.map(v -> {
			ChronoVertex cv = (ChronoVertex) v;
			return new AbstractMap.SimpleImmutableEntry(cv,
					cv.getChronoEdgeSet(Direction.IN, labels, branchFactor));
		}).collect(Collectors.toMap(e -> ((Entry) e).getKey(), e -> ((Entry) e).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.flatMap(v -> {
			return ((ChronoVertex) v).getChronoEdgeStream(Direction.IN, labels, branchFactor, isParallel);
		});
	}

	// Step Update
	final Class[] args = new Class[2];
	args[0] = BsonArray.class;
	args[1] = Integer.TYPE;
	final Step step = new Step(this.getClass().getName(), "inE", args, labels, branchFactor);
	stepList.add(step);

	// Set Class
	elementClass = ChronoEdge.class;
	return this;
}
 
Example #15
Source File: AccumuloEdge.java    From AccumuloGraph with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #16
Source File: VersionedGraphTestSuite.java    From antiquity with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void ensureAddingEdgesReflectedInAssocLoadedVertex() {
    Vertex v1 = graph.addVertex(null);
    assertThat(v1.getEdges(Direction.BOTH), hasAmount(0));
    Vertex v2 = graph.addVertex(null);
    assertThat(v2.getEdges(Direction.BOTH), hasAmount(0));
    Edge e1 = graph.addEdge(null, v1, v2, "LINKED");
    assertThat(v1.getEdges(Direction.BOTH), hasAmount(1));
    assertThat(v2.getEdges(Direction.BOTH), hasAmount(1));
    CIT();
    assertThat(v1.getEdges(Direction.BOTH), hasAmount(1));
    assertThat(v2.getEdges(Direction.BOTH), hasAmount(1));
}
 
Example #17
Source File: NaiveTraversalEngine.java    From epcis with Apache License 2.0 5 votes vote down vote up
public NaiveTraversalEngine outVe() {
	// Check Input element class
	checkInputElementClass(EdgeEvent.class);

	// Pipeline Update

	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.map(ee -> {
			EdgeEvent cee = (EdgeEvent) ee;
			return new AbstractMap.SimpleImmutableEntry(cee, cee.getVertexEvent(Direction.OUT));
		}).collect(Collectors.toMap(e -> ((Entry) e).getKey(), e -> ((Entry) e).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.map(ee -> {
			return ((EdgeEvent) ee).getVertexEvent(Direction.OUT);
		});
	}

	// Step Update
	final Class[] args = {};
	final Step step = new Step(this.getClass().getName(), "outVe", args);
	stepList.add(step);

	// Set Class
	elementClass = VertexEvent.class;
	return this;
}
 
Example #18
Source File: TitanObjectFactory.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
/**
 * Retrieves the titan direction corresponding to the given
 * AtlasEdgeDirection.
 *
 * @param dir
 * @return
 */
public static Direction createDirection(AtlasEdgeDirection dir) {

    switch(dir) {
    case IN:
        return Direction.IN;
    case OUT:
        return Direction.OUT;
    case BOTH:
        return Direction.BOTH;
    default:
        throw new RuntimeException("Unrecognized direction: " + dir);
    }
}
 
Example #19
Source File: CachedChronoVertex.java    From epcis with Apache License 2.0 5 votes vote down vote up
public Set<CachedChronoVertex> getChronoVertexSet(final Direction direction, final String label,
		final int branchFactor) {

	Long labelIdx = graph.getLabelIndex().get(label);

	if (direction.equals(Direction.OUT)) {
		return this.getOutChronoVertexSet(labelIdx, branchFactor);
	} else if (direction.equals(Direction.IN))
		return this.getInChronoVertexSet(labelIdx, branchFactor);
	else {
		Set<CachedChronoVertex> ret = this.getOutChronoVertexSet(labelIdx, branchFactor);
		ret.addAll(this.getInChronoVertexSet(labelIdx, branchFactor));
		return ret;
	}
}
 
Example #20
Source File: ActiveVersionedGraph.java    From antiquity with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Version removed vertices
 * 
 * @param nextVer next version (to be committed) of the graph
 * @param maxVer current max version of the graph
 * @param vertices A map of removed vertices where key=removed vertex &
 *        value=A map of the removed vertex's properties.
 */
protected void versionRemovedVertices(V nextVer, V maxVer, Map<Vertex, Map<String, Object>> vertices) {
    for (Map.Entry<Vertex, Map<String, Object>> v : vertices.entrySet()) {
        // we can't touch the vertex as it's deleted already
        // utils.ensureActiveType(v.getKey());
        // ActiveVersionedVertex<V> av = new
        // ActiveVersionedVertex<V>(v.getKey(), this);
        if (!v.getValue().containsKey(VEProps.REF_TO_LATEST_HISTORIC_ID_KEY)) {
            throw new IllegalStateException("Expected removed vertx to contain key: "
                    + VEProps.REF_TO_LATEST_HISTORIC_ID_KEY);
        }

        HistoricVersionedVertex<V> hv =
                getHistoricGraph().getLatestHistoricRevision(
                        (String) v.getValue().get(VEProps.REF_TO_LATEST_HISTORIC_ID_KEY));

        // Remove ALL vertex's edges, must be invoked on getRaw to avoid
        // filtering.
        for (Edge e : hv.getRaw().getEdges(Direction.BOTH)) {
            if (utils.isInternal(e)) {
                continue;
            }

            utils.ensureHistoricType(e);
            e.setProperty(VEProps.REMOVED_PROP_KEY, nextVer);
            e.setProperty(VEProps.VALID_MAX_VERSION_PROP_KEY, maxVer);
        }


        hv.getRaw().setProperty(VEProps.REMOVED_PROP_KEY, nextVer);
        hv.getRaw().setProperty(VEProps.VALID_MAX_VERSION_PROP_KEY, maxVer);
    }
}
 
Example #21
Source File: OutVertexAnnotationHandler.java    From org.openntf.domino with Apache License 2.0 5 votes vote down vote up
@Override
public Object processElement(final OutVertex annotation, final Method method, final Object[] arguments, final FramedGraph framedGraph, final Element element, final Direction direction) {
    if (element instanceof Edge) {
    	return framedGraph.frame(((Edge)element).getVertex(Direction.OUT), method.getReturnType());
    } else {
        throw new UnsupportedOperationException();
    }
}
 
Example #22
Source File: TraceabilityQueryService.java    From epcis with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/Location", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> getLocationQuery(@RequestParam String epc,
		@RequestParam(required = false) String startTime, @RequestParam(required = false) String order) {

	// Time processing
	long startTimeMil = 0;
	startTimeMil = TimeUtil.getTimeMil(startTime);

	ChronoGraph g = Configuration.persistentGraph;

	HttpHeaders responseHeaders = new HttpHeaders();
	responseHeaders.add("Content-Type", "application/json; charset=utf-8");

	ChronoVertex v = g.getChronoVertex(epc);
	TreeMap<Long, ChronoVertex> timestampNeighbors = v.getTimestampNeighborVertices(Direction.OUT, "isLocatedIn",
			startTimeMil, AC.$gte);

	// outV : [ "t1", "t2", "t3", "t4" ];
	JSONObject retObj = new JSONObject();
	Iterator<Entry<Long, ChronoVertex>> iterator = timestampNeighbors.entrySet().iterator();
	while (iterator.hasNext()) {
		Entry<Long, ChronoVertex> elem = iterator.next();
		Long time = elem.getKey();
		ChronoVertex neighbor = elem.getValue();
		retObj.put(time.toString(), neighbor.toString());
	}

	return new ResponseEntity<>(retObj.toString(2), responseHeaders, HttpStatus.OK);

}
 
Example #23
Source File: FlowDefinition.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = Uses.LABEL_FLOWABLEUSES, direction = Direction.IN)
public Flowable addUsesFlowable(Flowable flowable);
 
Example #24
Source File: CachedVertexEvent.java    From epcis with Apache License 2.0 4 votes vote down vote up
public Set<CachedEdgeEvent> getEdgeEventSet(final Direction direction, final BsonArray labels, final AC tt) {
	return vertex.getEdgeEventSet(direction, labels, this.timestamp, tt, Integer.MAX_VALUE);
}
 
Example #25
Source File: CachedTraversalEngine.java    From epcis with Apache License 2.0 4 votes vote down vote up
/**
 * Add oute step to the traversal engine
 * 
 * 
 * Path Enabled -> Greedy,
 * 
 * Path Disabled -> Lazy
 *
 * Pipeline: Stream<CachedVertexEdge> -> Stream<CachedVertexEdge> (flatMap)
 * 
 * Path: Map<CachedVertexEdge, Set<CachedVertexEdge>>
 * 
 * @param labels
 * @param typeOfEdgeEvent
 * @param tt
 *            from timestamp to timestamp
 * @param s
 *            from timestamp to interval or from interval to timestamp
 * @param e
 *            from timestamp to interval or from interval to timestamp
 * @param ss
 *            from interval to interval
 * @param se
 *            from interval to interval
 * @param es
 *            from interval to interval
 * @param ee
 *            from interval to interval
 * 
 * @return the extended Stream
 */
public CachedTraversalEngine oute(final BsonArray labels, final TemporalType typeOfVertexEvent, final AC tt,
		final AC s, final AC e, final AC ss, final AC se, final AC es, final AC ee, final Position pos) {
	// Check Input element class
	checkInputElementClass(CachedVertexEvent.class);

	// Stream Update
	if (isPathEnabled) {
		// Get Sub-Path
		Map intermediate = (Map) stream.distinct().map(ve -> {
			CachedVertexEvent cve = (CachedVertexEvent) ve;
			return new AbstractMap.SimpleImmutableEntry(cve, cve.getVertexEventSet(Direction.OUT, labels, tt));
		}).collect(Collectors.toMap(entry -> ((Entry) entry).getKey(), entry -> ((Entry) entry).getValue()));

		// Update Path
		updateTransformationPath(intermediate);

		// Make stream again
		stream = getStream(intermediate, isParallel);
	} else {
		stream = stream.flatMap(ve -> {
			return ((CachedVertexEvent) ve).getVertexEventStream(Direction.OUT, labels, tt, isParallel);
		});
	}
	// Step Update
	final Class[] args = new Class[10];
	args[0] = BsonArray.class;
	args[1] = TemporalType.class;
	args[2] = AC.class;
	args[3] = AC.class;
	args[4] = AC.class;
	args[5] = AC.class;
	args[6] = AC.class;
	args[7] = AC.class;
	args[8] = AC.class;
	args[9] = Position.class;
	final Step step = new Step(this.getClass().getName(), "oute", args, labels, typeOfVertexEvent, tt, s, e, ss, se,
			es, ee, pos);
	stepList.add(step);

	// Set Class
	elementClass = CachedVertexEvent.class;
	return this;
}
 
Example #26
Source File: Commentable.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = Mentions.LABEL, direction = Direction.IN)
public int countMentions();
 
Example #27
Source File: Sharer.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = SharedWith.LABEL, direction = Direction.IN)
public List<SharedWith> getSharedWiths();
 
Example #28
Source File: Share.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = SharedBy.LABEL, direction = Direction.IN)
public int countSharedBys();
 
Example #29
Source File: Attendee.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@IncidenceUnique(label = InvitedTo.LABEL, direction = Direction.IN)
public Iterable<InvitedTo> getInvitedTos();
 
Example #30
Source File: FlowDefinition.java    From org.openntf.domino with Apache License 2.0 4 votes vote down vote up
@AdjacencyUnique(label = Finishes.LABEL_FINISHES, direction = Direction.IN)
public TaskDefinition addFinishTask(TaskDefinition definition);