本文整理匯總了Java中com.tinkerpop.blueprints.Edge.remove方法的典型用法代碼示例。如果您正苦於以下問題:Java Edge.remove方法的具體用法?Java Edge.remove怎麽用?Java Edge.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.tinkerpop.blueprints.Edge
的用法示例。
在下文中一共展示了Edge.remove方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: clearStationOfExchangesOrientDb
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public int clearStationOfExchangesOrientDb(Station station) {
int edgesRemoved = 0;
OrientGraph graph = null;
try {
graph = orientDbService.getFactory().getTx();
OrientVertex vertexStation = (OrientVertex) graph.getVertexByKey("Station.name", station.getName());
for (Edge exchange: vertexStation.getEdges(Direction.OUT, "Exchange")) {
exchange.remove();
edgesRemoved++;
};
} catch (Exception e) {
graph.rollback();
}
return edgesRemoved;
}
示例2: testEdgesExceedCacheSize
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
@Test
public void testEdgesExceedCacheSize() {
// Add a vertex with as many edges as the tx-cache-size. (20000 by default)
int numEdges = graph.getConfiguration().getTxVertexCacheSize();
Vertex parentVertex = graph.addVertex(null);
for (int i = 0; i < numEdges; i++) {
Vertex childVertex = graph.addVertex(null);
parentVertex.addEdge("friend", childVertex);
}
graph.commit();
assertEquals(numEdges, Iterables.size(parentVertex.getEdges(Direction.OUT)));
// Remove an edge.
Edge edge = parentVertex.getEdges(Direction.OUT).iterator().next();
edge.remove();
// Check that getEdges returns one fewer.
assertEquals(numEdges - 1, Iterables.size(parentVertex.getEdges(Direction.OUT)));
// Run the same check one more time.
// This fails! (Expected: 19999. Actual: 20000.)
assertEquals(numEdges - 1, Iterables.size(parentVertex.getEdges(Direction.OUT)));
}
示例3: migrateSchemaContainerRootEdges
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
/**
* The edge label has change. Migrate existing edges.
*/
private void migrateSchemaContainerRootEdges(Vertex schemaRoot) {
for (Edge edge : schemaRoot.getEdges(Direction.OUT, "HAS_SCHEMA_CONTAINER")) {
Vertex container = edge.getVertex(Direction.IN);
schemaRoot.addEdge("HAS_SCHEMA_CONTAINER_ITEM", container);
edge.remove();
}
}
示例4: migrateTagFamilies
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
private void migrateTagFamilies(Vertex project) {
Vertex tagFamilyRoot = project.getVertices(Direction.OUT, "HAS_TAGFAMILY_ROOT").iterator().next();
for (Vertex tagFamily : tagFamilyRoot.getVertices(Direction.OUT, "HAS_TAG_FAMILY")) {
// Check dates
Object tagFamilyCreationTimeStamp = tagFamily.getProperty("creation_timestamp");
if (tagFamilyCreationTimeStamp == null) {
tagFamily.setProperty("creation_timestamp", System.currentTimeMillis());
}
Object tagFamilyEditTimeStamp = tagFamily.getProperty("last_edited_timestamp");
if (tagFamilyEditTimeStamp == null) {
tagFamily.setProperty("last_edited_timestamp", System.currentTimeMillis());
}
// Create a new tag root vertex for the tagfamily and link the tags to this vertex instead to the tag family itself.
Vertex tagRoot = getGraph().addVertex("class:TagRootImpl");
tagRoot.setProperty("ferma_type", "com.gentics.mesh.core.data.root.impl.TagRootImpl");
tagRoot.setProperty("uuid", randomUUID());
for (Edge tagEdge : tagFamily.getEdges(Direction.OUT, "HAS_TAG")) {
Vertex tag = tagEdge.getVertex(Direction.IN);
tagEdge.remove();
tagRoot.addEdge("HAS_TAG", tag);
tag.getEdges(Direction.OUT, "HAS_TAGFAMILY_ROOT").forEach(edge -> edge.remove());
tag.addEdge("HAS_TAGFAMILY_ROOT", tagFamily);
if (!tag.getEdges(Direction.OUT, "ASSIGNED_TO_PROJECT").iterator().hasNext()) {
log.error("Tag {" + tag.getProperty("uuid") + " has no project assigned to it. Fixing it...");
tag.addEdge("ASSIGNED_TO_PROJECT", project);
}
Object creationTimeStamp = tag.getProperty("creation_timestamp");
if (creationTimeStamp == null) {
tag.setProperty("creation_timestamp", System.currentTimeMillis());
}
Object editTimeStamp = tag.getProperty("last_edited_timestamp");
if (editTimeStamp == null) {
tag.setProperty("last_edited_timestamp", System.currentTimeMillis());
}
}
tagFamily.addEdge("HAS_TAG_ROOT", tagRoot);
if (!tagFamily.getEdges(Direction.OUT, "ASSIGNED_TO_PROJECT").iterator().hasNext()) {
log.error("TagFamily {" + tagFamily.getProperty("uuid") + " has no project assigned to it. Fixing it...");
tagFamily.addEdge("ASSIGNED_TO_PROJECT", project);
}
getOrFixUserReference(tagFamily, "HAS_EDITOR");
getOrFixUserReference(tagFamily, "HAS_CREATOR");
}
}
示例5: removeEdge
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
public void removeEdge(Edge edge) {
edge.remove();
}
示例6: testTimestampedUpdates
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
/**
* Tests that timestamped edges and properties can be updated
*/
@Test
public void testTimestampedUpdates() {
clopen(option(GraphDatabaseConfiguration.STORE_META_TIMESTAMPS, "edgestore"), true,
option(GraphDatabaseConfiguration.STORE_META_TTL, "edgestore"), true);
final TimeUnit unit = TimeUnit.SECONDS;
// Transaction 1: Init graph with two vertices, having set "name" and "age" properties
TitanTransaction tx = graph.buildTransaction().setCommitTime(100, unit).start();
TitanVertex v1 = tx.addVertex();
TitanVertex v2 = tx.addVertex();
TitanProperty p = v1.addProperty("name","xyz");
p.setProperty("time",15);
Edge e = v1.addEdge("related",v2);
e.setProperty("time",25);
tx.commit();
tx = graph.buildTransaction().setCommitTime(200, unit).start();
v1 = (TitanVertex)tx.getVertex(v1);
assertNotNull(v1);
p = Iterables.getOnlyElement(v1.getProperties("name"));
e = Iterables.getOnlyElement(v1.getEdges(Direction.OUT, "related"));
assertEquals(3, p.getPropertyKeys().size());
assertEquals(3, p.getPropertyKeys().size());
p.setProperty("time", 115);
e.setProperty("time",125);
tx.commit();
tx = graph.buildTransaction().setCommitTime(300, unit).start();
v1 = (TitanVertex)tx.getVertex(v1);
assertNotNull(v1);
p = Iterables.getOnlyElement(v1.getProperties("name"));
e = Iterables.getOnlyElement(v1.getEdges(Direction.OUT, "related"));
assertEquals(115,p.getProperty("time"));
assertEquals(125, e.getProperty("time"));
p.remove();
e.remove();
tx.commit();
}
示例7: removeConnectionsAt2Dobjects
import com.tinkerpop.blueprints.Edge; //導入方法依賴的package包/類
protected void removeConnectionsAt2Dobjects() {
// this is a cleanup operation -- if there are connection points
// for 1d objects that exist at a 2d shape that they are connected
// to, then remove the connection
for (ShapeData shape: shapes) {
if (!shape.is1d())
continue;
Set<Long> collected2dObjects = null;
// get the connection point from the edge properties
for (Edge edge: shape.vertex.getEdges(Direction.BOTH)) {
Double x = edge.getProperty("x");
if (x == null)
continue;
Double y = edge.getProperty("y");
// ok, the other end must be a 1d object. Find the object.
// Find all 2d objects that I'm connected to, and see if the
// other object is connected to any of them.
if (collected2dObjects == null)
collected2dObjects = collect2dObjects(shape.vertex);
// if both connected to the same object, see if the x/y overlaps
Vertex other = edge.getVertex(Direction.IN);
if (other == shape.vertex)
other = edge.getVertex(Direction.OUT);
Set<Long> other2dObjects = collect2dObjects(other);
for (Long o: other2dObjects) {
if (collected2dObjects.contains(o)) {
ShapeData sd = getShape(o);
if (sd.bounds.intersects(x - 0.00001, y - 0.00001, 0.00002, 0.00002)) {
// remove edge if it overlaps
edge.remove();
}
}
}
}
}
}