本文整理了Java中com.tinkerpop.blueprints.Vertex.getVertices()
方法的一些代码示例,展示了Vertex.getVertices()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.getVertices()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Vertex
类名称:Vertex
方法名:getVertices
[英]Return the vertices adjacent to the vertex according to the provided direction and edge labels. This method does not remove duplicate vertices (i.e. those vertices that are connected by more than one edge).
[中]
代码示例来源:origin: gentics/mesh
@Override
public void applyInTx() {
Vertex meshRoot = getMeshRootVertex();
Vertex projectRoot = meshRoot.getVertices(Direction.OUT, "HAS_PROJECT_ROOT").iterator().next();
// Iterate over all projects
for (Vertex project : projectRoot.getVertices(Direction.OUT, "HAS_PROJECT")) {
// Migrate all nodes of the project
Vertex baseNode = project.getVertices(Direction.OUT, "HAS_ROOT_NODE").iterator().next();
migrateNode(baseNode);
}
}
代码示例来源:origin: gentics/mesh
private Vertex findEnglish() {
Vertex english = null;
Iterator<Vertex> langIt = getMeshRootVertex().getVertices(Direction.OUT, "HAS_LANGUAGE_ROOT").iterator().next()
.getVertices(Direction.OUT, "HAS_LANGUAGE").iterator();
while (langIt.hasNext()) {
Vertex language = langIt.next();
if (language.getProperty("languageTag").equals("en")) {
english = language;
}
}
return english;
}
代码示例来源:origin: gentics/mesh
private Vertex findAdmin() {
Vertex admin = null;
Iterator<Vertex> langIt = getMeshRootVertex().getVertices(Direction.OUT, "HAS_USER_ROOT").iterator().next()
.getVertices(Direction.OUT, "HAS_USER").iterator();
while (langIt.hasNext()) {
Vertex user = langIt.next();
if (user.getProperty("username").equals("admin")) {
admin = user;
}
}
return admin;
}
代码示例来源:origin: socialsensor/graphdb-benchmarks
public double getNodeOutDegree(Vertex vertex)
{
@SuppressWarnings("rawtypes")
OMultiCollectionIterator result = (OMultiCollectionIterator) vertex.getVertices(Direction.OUT, SIMILAR);
return (double) result.size();
}
代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6
private double testAllVertices(long vid, int numV) {
long start = System.nanoTime();
Vertex v = graph.getVertex(vid);
for (int i=1; i<numV; i++) {
v = Iterables.getOnlyElement(v.getVertices(Direction.OUT, "knows"));
}
return ((System.nanoTime()-start)/1000000.0);
}
代码示例来源:origin: socialsensor/graphdb-benchmarks
public double getNodeInDegree(Vertex vertex)
{
@SuppressWarnings("rawtypes")
OMultiCollectionIterator result = (OMultiCollectionIterator) vertex.getVertices(Direction.IN, SIMILAR);
return (double) result.size();
}
代码示例来源:origin: gentics/mesh
private void migrateUsers(Vertex meshRoot) {
Vertex userRoot = meshRoot.getVertices(Direction.OUT, "HAS_USER_ROOT").iterator().next();
for (Vertex user : userRoot.getVertices(Direction.OUT, "HAS_USER")) {
// Check editor/creator
getOrFixUserReference(user, "HAS_EDITOR");
getOrFixUserReference(user, "HAS_CREATOR");
}
}
代码示例来源:origin: gentics/mesh
private Vertex findBinary(String hash, Vertex binaryRoot) {
for (Vertex binary : binaryRoot.getVertices(OUT, "HAS_BINARY")) {
String foundHash = binary.getProperty(NEW_HASH_KEY);
if (foundHash.equals(hash)) {
return binary;
}
}
return null;
}
代码示例来源:origin: org.hawkular.titan/titan-test
private double testAllVertices(long vid, int numV) {
long start = System.nanoTime();
Vertex v = graph.getVertex(vid);
for (int i=1; i<numV; i++) {
v = Iterables.getOnlyElement(v.getVertices(Direction.OUT, "knows"));
}
return ((System.nanoTime()-start)/1000000.0);
}
代码示例来源:origin: gentics/mesh
@Override
public void applyInTx() {
Vertex meshRoot = getMeshRootVertex();
Vertex searchQueueRoot = meshRoot.getVertices(OUT, "HAS_SEARCH_QUEUE_ROOT").iterator().next();
for (Vertex batch : searchQueueRoot.getVertices(OUT, "HAS_BATCH")) {
for (Vertex entry : batch.getVertices(OUT, "HAS_ITEM")) {
entry.remove();
}
batch.remove();
}
searchQueueRoot.remove();
}
代码示例来源:origin: gentics/mesh
private void updateLists(Vertex container, Map<String, JsonObject> fieldMap) {
for (Vertex listElement: container.getVertices(Direction.OUT, HAS_LIST)) {
String fieldName = listElement.getProperty(FIELD_KEY);
if (fieldMap.containsKey(fieldName) && NUMBER_TYPE.equals(fieldMap.get(fieldName).getString(FIELD_LIST_TYPE_KEY))) {
listElement.getPropertyKeys().stream()
.filter(k -> k.startsWith(ITEM_PREFIX))
.forEach(k -> updateProperty(k, listElement));
}
}
}
代码示例来源:origin: com.orientechnologies/orientdb-graphdb
protected Set<OrientVertex> getNeighbors(final Vertex node) {
context.incrementVariable("getNeighbors");
final Set<OrientVertex> neighbors = new HashSet<OrientVertex>();
if (node != null) {
for (Vertex v : node.getVertices(paramDirection)) {
final OrientVertex ov = (OrientVertex) v;
if (ov != null && isNotSettled(ov))
neighbors.add(ov);
}
}
return neighbors;
}
代码示例来源:origin: com.tinkerpop/pipes
protected Vertex processNextStart() {
while (true) {
if (this.nextEnds.hasNext()) {
return this.nextEnds.next();
} else {
this.nextEnds = this.doBranchFactor ?
this.starts.next().query().direction(this.direction).labels(this.labels).limit(this.branchFactor).vertices().iterator() :
this.starts.next().getVertices(this.direction, this.labels).iterator();
}
}
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected boolean isSetReference(PersistentEObject object, EReference reference) {
boolean isSet = false;
Vertex vertex = backend.getVertex(object.id());
if (nonNull(vertex)) {
isSet = !Iterables.isEmpty(vertex.getVertices(Direction.OUT, reference.getName()));
}
return isSet;
}
代码示例来源: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: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
public InternalEObject getContainer(InternalEObject internalObject) {
InternalEObject container = null;
PersistentEObject object = PersistentEObject.from(internalObject);
Vertex vertex = backend.getVertex(object.id());
Vertex containerVertex = Iterables.getOnlyElement(vertex.getVertices(Direction.OUT, CONTAINER), null);
if (nonNull(containerVertex)) {
container = reifyVertex(containerVertex);
}
return container;
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected boolean containsReference(PersistentEObject object, EReference reference, PersistentEObject value) {
Vertex v = backend.getOrCreateVertex(object);
for (Vertex vOut : v.getVertices(Direction.OUT, reference.getName())) {
if (Objects.equals(vOut.getId(), value.id().toString())) {
return true;
}
}
return false;
}
代码示例来源:origin: gentics/mesh
public void updateVerticesForSchema(Vertex schemaVertex, Map<String, JsonObject> fieldMap, String label) {
long count = 0;
for (Vertex vertex : schemaVertex.getVertices(Direction.IN, label)) {
count++;
updateFields(vertex, fieldMap);
updateLists(vertex, fieldMap);
if (count % 10000 == 0) {
log.debug("Commit the changes for the last 10.000 vertices to database...");
getGraph().commit();
log.info("Updated vertices {}", count);
}
}
}
代码示例来源:origin: com.thinkaurelius.titan/titan-test-jre6
public void testVertexReattachment() {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
Edge e = graph.addEdge(null, a, b, "friend");
graph.commit();
a = graph.getVertex(a);
Assert.assertNotNull(a);
Assert.assertEquals(1, BaseTest.count(a.getVertices(Direction.OUT)));
graph.shutdown();
}
代码示例来源:origin: org.hawkular.titan/titan-test
public void testVertexReattachment() {
TransactionalGraph graph = (TransactionalGraph) graphTest.generateGraph();
Vertex a = graph.addVertex(null);
Vertex b = graph.addVertex(null);
Edge e = graph.addEdge(null, a, b, "friend");
graph.commit();
a = graph.getVertex(a);
Assert.assertNotNull(a);
Assert.assertEquals(1, BaseTest.count(a.getVertices(Direction.OUT)));
graph.shutdown();
}
内容来源于网络,如有侵权,请联系作者删除!