本文整理了Java中com.tinkerpop.blueprints.Vertex.addEdge()
方法的一些代码示例,展示了Vertex.addEdge()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.addEdge()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Vertex
类名称:Vertex
方法名:addEdge
[英]Add a new outgoing edge from this vertex to the parameter vertex with provided edge label.
[中]使用提供的边标签,将此顶点的新传出边添加到参数顶点。
代码示例来源:origin: socialsensor/graphdb-benchmarks
@Override
public void relateNodes(Vertex src, Vertex dest)
{
src.addEdge("similar", dest);
}
}
代码示例来源:origin: aws-samples/aws-big-data-blog
Vertex RestaurantVertex = get(graph, RESTAURANT_ID, nextLine[1]);
Edge visitEdge = userVertex.addEdge("visit", RestaurantVertex);
RESTAURANTVertex.addEdge("restaurant_genre", genreVertex);
userVertex.addEdge("friend", friendVertex);
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public Edge addEdge(final String label, final Vertex vertex) {
if (vertex instanceof WrappedVertex)
return new WrappedEdge(((Vertex) this.baseElement).addEdge(label, ((WrappedVertex) vertex).getBaseVertex()));
else
return new WrappedEdge(((Vertex) this.baseElement).addEdge(label, vertex));
}
代码示例来源:origin: gentics/mesh
private void migrateEdge(Edge edge, String newLabel, boolean reverseOrder) {
Vertex in = edge.getVertex(IN);
Vertex out = edge.getVertex(OUT);
if (reverseOrder) {
out.addEdge(newLabel, in);
} else {
in.addEdge(newLabel, out);
}
edge.remove();
}
代码示例来源:origin: tinkerpop/furnace
public Edge addEdge(final String label, final Vertex vertex) {
if (vertex instanceof DerivedVertex)
return new DerivedEdge(((Vertex) this.baseElement).addEdge(label, ((DerivedVertex) vertex).getBaseVertex()), this.derivedGraph);
else
return new DerivedEdge(((Vertex) this.baseElement).addEdge(label, vertex), this.derivedGraph);
}
代码示例来源:origin: org.hawkular.titan/titan-test
@Override
public void run(TitanTransaction tx) {
Vertex u1 = tx.getVertex(vids[0]),
u2 = tx.getVertex(vids[pos++]);
u1.addEdge("spouse",u2);
}
});
代码示例来源:origin: org.hawkular.titan/titan-test
@Override
public void run(TitanTransaction tx) {
Vertex u1 = tx.getVertex(vids[0]), u2 = tx.getVertex(vids[1]);
u1.addEdge("knows",u2);
}
});
代码示例来源:origin: org.hawkular.titan/titan-test
@Override
public void run(TitanTransaction tx) {
Vertex u1 = tx.getVertex(vids[pos++]),
u2 = tx.getVertex(vids[0]);
u1.addEdge("spouse",u2);
}
});
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected void setMetaClass(final Id id, final Id metaClassId) {
Vertex vertex = getVertex(id);
Vertex metaClassVertex = getVertex(metaClassId);
vertex.addEdge(BlueprintsPersistenceBackend.KEY_INSTANCE_OF, metaClassVertex);
}
代码示例来源:origin: gentics/mesh
private Vertex getOrFixUserReference(Vertex element, String edge) {
Vertex creator;
Iterator<Vertex> creatorIterator = element.getVertices(Direction.OUT, edge).iterator();
if (!creatorIterator.hasNext()) {
log.error("The element {" + element.getProperty("uuid") + "} has no {" + edge + "}. Using admin instead.");
creator = findAdmin();
element.addEdge(edge, creator);
} else {
creator = creatorIterator.next();
}
return creator;
}
代码示例来源:origin: com.puresoltechnologies.extended-objects/titan
@Override
public Edge createRelation(
Vertex source,
RelationTypeMetadata<TitanEdgeMetadata> metadata,
RelationTypeMetadata.Direction direction,
Vertex target,
Map<PrimitivePropertyMethodMetadata<TitanPropertyMetadata>, Object> exampleEntity) {
String name = metadata.getDatastoreMetadata().getDiscriminator();
switch (direction) {
case FROM:
return source.addEdge(name, target);
case TO:
return target.addEdge(name, source);
default:
throw new XOException("Unknown direction '" + direction.name()
+ "'.");
}
}
代码示例来源:origin: gentics/mesh
@Override
public void applyInTx() {
Vertex meshRoot = MeshGraphHelper.getMeshRootVertex(getGraph());
Vertex projectRoot = meshRoot.getVertices(Direction.OUT, "HAS_PROJECT_ROOT").iterator().next();
for (Vertex project : projectRoot.getVertices(Direction.OUT, "HAS_PROJECT")) {
Iterator<Vertex> it = project.getVertices(Direction.OUT, "HAS_RELEASE_ROOT").iterator();
if (it.hasNext()) {
Vertex releaseRoot = it.next();
for (Vertex release : releaseRoot.getVertices(Direction.OUT, "HAS_RELEASE")) {
// Assign the release to the project
release.addEdge("ASSIGNED_TO_PROJECT", project);
}
}
}
}
}
代码示例来源:origin: gentics/mesh
/**
* Add the change to the list of executed changes.
*
* @param change
*/
public void add(Change change) {
Vertex vertex = graph.addVertex(ChangeWrapper.class);
ChangeWrapper graphChange = new ChangeWrapper(vertex);
graphChange.update(change);
rootVertex.addEdge(HAS_CHANGE, vertex);
}
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
/**
* Updates the containment identified by its {@code name} between the {@code parentVertex} and the {@code
* childVertex}.
*
* @param localName the name of the property identifying the reference (parent -> child)
* @param parentVertex the parent vertex
* @param childVertex the child vertex
*/
private static void updateContainment(final String localName, final Vertex parentVertex, final Vertex childVertex) {
for (Edge edge : childVertex.getEdges(Direction.OUT, CONTAINER)) {
edge.remove();
}
Edge edge = childVertex.addEdge(CONTAINER, parentVertex);
edge.setProperty(CONTAINING_FEATURE, localName);
}
代码示例来源:origin: org.hawkular.titan/titan-test
@Override
public void run(TitanTransaction tx) {
Vertex a = tx.addVertex();
a.setProperty("name",nameA);
Vertex b = tx.addVertex();
b.setProperty("name",nameB);
b.addEdge("friend",b);
}
},parallelThreads);
代码示例来源:origin: networknt/light
protected void addConfigDb(Map<String, Object> data) throws Exception {
OrientGraph graph = ServiceLocator.getInstance().getGraph();
try{
graph.begin();
Vertex createUser = graph.getVertexByKey("User.userId", data.remove("createUserId"));
OrientVertex config = graph.addVertex("class:Config", data);
createUser.addEdge("Create", config);
graph.commit();
} catch (Exception e) {
logger.error("Exception:", e);
graph.rollback();
} finally {
graph.shutdown();
}
}
代码示例来源:origin: networknt/light
protected void addRole(Map<String, Object> data) throws Exception {
OrientGraph graph = ServiceLocator.getInstance().getGraph();
try {
graph.begin();
Vertex createUser = graph.getVertexByKey("User.userId", data.remove("createUserId"));
OrientVertex role = graph.addVertex("class:Role", data);
createUser.addEdge("Create", role);
graph.commit();
} catch (Exception e) {
logger.error("Exception:", e);
graph.rollback();
throw e;
} finally {
graph.shutdown();
}
}
代码示例来源:origin: networknt/light
protected void addHostConfigDb(Map<String, Object> data) throws Exception {
OrientGraph graph = ServiceLocator.getInstance().getGraph();
try{
graph.begin();
Vertex createUser = graph.getVertexByKey("User.userId", data.remove("createUserId"));
OrientVertex hostConfig = graph.addVertex("class:HostConfig", data);
createUser.addEdge("Create", hostConfig);
graph.commit();
} catch (Exception e) {
logger.error("Exception:", e);
graph.rollback();
} finally {
graph.shutdown();
}
}
代码示例来源:origin: BrynCooke/totorom
/**
* Add an edge using the supplied frame type.
*
* @param label
* The label for the edge
* @param inVertex
* The vertex to link to.
* @param kind
* The kind of frame.
* @return The new edge.
*/
protected <T extends FramedEdge> T addEdge(String label, FramedVertex inVertex, Class<T> kind) {
Edge edge = element().addEdge(label, inVertex.element());
T framedEdge = graph().frameNewElement(edge, kind);
framedEdge.init();
return framedEdge;
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected void addReference(final Id id, final String name, int index, final boolean many, final boolean containment, final Id idReference) {
Vertex vertex = getVertex(id);
Vertex referencedVertex = getVertex(idReference);
// Update the containment reference if needed
if (containment) {
updateContainment(name, vertex, referencedVertex);
}
int size = getSize(vertex, name);
if (index == PersistentStore.NO_INDEX) {
index = size;
}
size++;
setSize(vertex, name, size);
Edge edge = vertex.addEdge(name, referencedVertex);
edge.setProperty(POSITION, index);
}
内容来源于网络,如有侵权,请联系作者删除!