本文整理了Java中com.tinkerpop.blueprints.Vertex.query()
方法的一些代码示例,展示了Vertex.query()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vertex.query()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Vertex
类名称:Vertex
方法名:query
[英]Generate a query object that can be used to fine tune which edges/vertices are retrieved that are incident/adjacent to this vertex.
[中]生成一个查询对象,可用于微调检索到的与该顶点相关/相邻的边/顶点。
代码示例来源:origin: atlanmod/NeoEMF
@Nonnull
@Override
public IdVertexQuery<?, G> query() {
return new IdVertexQuery<>(base.query(), graph);
}
代码示例来源:origin: atlanmod/NeoEMF
@Nonnull
@Override
public ElementVertexQuery query() {
return new ElementVertexQuery(base.query(), graph);
}
代码示例来源:origin: tinkerpop/furnace
public VertexQuery query() {
return new WrapperVertexQuery(this.baseVertex.query()) {
@Override
public Iterable<Edge> edges() {
return new ShellEdgeIterable(this.query.edges());
}
@Override
public Iterable<Vertex> vertices() {
return new AdjacentShellVertexIterable(this.query.vertices());
}
};
}
代码示例来源:origin: apache/incubator-atlas
@Override
public AtlasVertexQuery<Titan0Vertex, Titan0Edge> query() {
return new Titan0VertexQuery(graph, wrappedElement.query());
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public Term next() {
VertexQuery query = this.it.next().query();
query.has("index", position);
return vertexToTerm(query.vertices().iterator().next());
}
代码示例来源:origin: com.tinkerpop/pipes
protected Edge 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).edges().iterator() :
this.starts.next().getEdges(this.direction, this.labels).iterator();
}
}
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) this.baseElement).query()) {
@Override
public Iterable<Vertex> vertices() {
return new IdVertexIterable(this.query.vertices(), idGraph);
}
@Override
public Iterable<Edge> edges() {
return new IdEdgeIterable(this.query.edges(), idGraph);
}
};
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) this.baseElement).query()) {
@Override
public Iterable<Vertex> vertices() {
return new WrappedVertexIterable(this.query.vertices());
}
@Override
public Iterable<Edge> edges() {
return new WrappedEdgeIterable(this.query.edges());
}
};
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) this.baseElement).query()) {
@Override
public Iterable<Vertex> vertices() {
return new EventVertexIterable(this.query.vertices(), eventGraph);
}
@Override
public Iterable<Edge> edges() {
return new EventEdgeIterable(this.query.edges(), eventGraph);
}
};
}
代码示例来源: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: com.tinkerpop.blueprints/blueprints-core
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) this.baseElement).query()) {
@Override
public Iterable<Vertex> vertices() {
return new PartitionVertexIterable(this.query.vertices(), graph);
}
@Override
public Iterable<Edge> edges() {
return new PartitionEdgeIterable(this.query.edges(), graph);
}
};
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) this.baseElement).query()) {
@Override
public Iterable<Vertex> vertices() {
return new ReadOnlyVertexIterable(this.query.vertices());
}
@Override
public Iterable<Edge> edges() {
return new ReadOnlyEdgeIterable(this.query.edges());
}
};
}
}
代码示例来源:origin: indexiatech/antiquity
@Override
public VertexQuery query() {
return new WrapperVertexQuery(((Vertex) getRaw()).query()) {
@Override
public Iterable<Vertex> vertices() {
return new ActiveVersionedVertexIterable<V>(this.query.vertices(), getGraph());
}
@Override
public Iterable<Edge> edges() {
return new ActiveVersionedEdgeIterable<V>(this.query.edges(), getGraph());
}
};
}
代码示例来源:origin: tinkerpop/furnace
public VertexQuery build(final Vertex vertex) {
VertexQuery query = vertex.query();
for (final HasContainer hasContainer : this.hasContainers) {
query = query.has(hasContainer.key, hasContainer.predicate, hasContainer.value);
}
return query.limit(this.limit).labels(this.labels).direction(this.direction);
}
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected void clearReference(PersistentEObject object, EReference reference) {
Vertex vertex = backend.getOrCreateVertex(object);
for (Edge edge : vertex.query().labels(reference.getName()).direction(Direction.OUT).edges()) {
edge.remove();
}
setSize(vertex, reference, 0);
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected Object getReference(PersistentEObject object, EReference reference, int index) {
Object soughtReference = null;
Vertex vertex = backend.getVertex(object.id());
Vertex referencedVertex;
if (!reference.isMany()) {
referencedVertex = Iterables.getOnlyElement(
vertex.getVertices(Direction.OUT, reference.getName()), null);
}
else {
checkElementIndex(index, getSize(vertex, reference), "Invalid get index " + index);
referencedVertex = Iterables.getOnlyElement(
vertex.query()
.labels(reference.getName())
.direction(Direction.OUT)
.has(POSITION, index)
.vertices(),
null);
}
if (nonNull(referencedVertex)) {
soughtReference = reifyVertex(referencedVertex);
}
return soughtReference;
}
代码示例来源:origin: com.puresoltechnologies.extended-objects/titan
@Override
public boolean hasSingleRelation(Vertex source,
RelationTypeMetadata<TitanEdgeMetadata> metadata,
RelationTypeMetadata.Direction direction) {
String label = metadata.getDatastoreMetadata().getDiscriminator();
long count;
switch (direction) {
case FROM:
count = source.query().direction(Direction.OUT).labels(label)
.count();
break;
case TO:
count = source.query().direction(Direction.IN).labels(label)
.count();
break;
default:
throw new XOException("Unkown direction '" + direction.name()
+ "'.");
}
if (count > 1) {
throw new XOException("Multiple results are available.");
}
return count == 1;
}
代码示例来源:origin: fr.inria.atlanmod.neoemf/neoemf-data-blueprints-core
@Override
protected void unsetReference(PersistentEObject object, EReference reference) {
Vertex vertex = backend.getVertex(object.id());
if (!reference.isMany()) {
Edge edge = Iterables.getOnlyElement(vertex.getEdges(Direction.OUT, reference.getName()), null);
if (nonNull(edge)) {
edge.remove();
}
}
else {
for (Edge edge : vertex.query().labels(reference.getName()).direction(Direction.OUT).edges()) {
edge.remove();
}
vertex.removeProperty(reference.getName() + SEPARATOR + SIZE_LITERAL);
}
}
代码示例来源:origin: com.puresoltechnologies.extended-objects/titan
@Override
public Iterable<Edge> getRelations(Vertex source,
RelationTypeMetadata<TitanEdgeMetadata> metadata,
RelationTypeMetadata.Direction direction) {
VertexQuery query = source.query();
String discriminator = metadata.getDatastoreMetadata()
.getDiscriminator();
switch (direction) {
case TO:
query = query.direction(Direction.IN).labels(discriminator);
break;
case FROM:
query = query.direction(Direction.OUT).labels(discriminator);
break;
default:
throw new XOException("Unknown direction '" + direction.name()
+ "'.");
}
return query.edges();
}
代码示例来源:origin: org.vertexium/vertexium-blueprints-test
public void testVertexEdgesWithNonVisibleVertexOnOtherEnd() {
Graph graph = graphTest.generateGraph();
if (!(graph instanceof VertexiumBlueprintsGraph)) {
throw new RuntimeException("Invalid graph");
}
org.vertexium.Graph vertexiumGraph = ((VertexiumBlueprintsGraph) graph).getGraph();
Authorizations aAuthorizations = vertexiumGraph.createAuthorizations("a");
org.vertexium.Vertex v1 = vertexiumGraph.addVertex("v1", new Visibility(""), aAuthorizations);
org.vertexium.Vertex v2 = vertexiumGraph.addVertex("v2", new Visibility("a"), aAuthorizations);
org.vertexium.Vertex v3 = vertexiumGraph.addVertex("v3", new Visibility(""), aAuthorizations);
vertexiumGraph.addEdge("e1to2", v1, v2, "label", new Visibility(""), aAuthorizations);
vertexiumGraph.addEdge("e1to3", v1, v3, "label", new Visibility(""), aAuthorizations);
vertexiumGraph.flush();
Vertex blueV1 = graph.getVertex("v1");
assertEquals(1, count(blueV1.getEdges(Direction.BOTH, "label")));
assertEquals(1, count(blueV1.getVertices(Direction.BOTH, "label")));
assertEquals(1, count((Iterable) blueV1.query().direction(Direction.BOTH).vertexIds()));
graph.shutdown();
}
}
内容来源于网络,如有侵权,请联系作者删除!