本文整理汇总了Java中com.tinkerpop.blueprints.VertexQuery类的典型用法代码示例。如果您正苦于以下问题:Java VertexQuery类的具体用法?Java VertexQuery怎么用?Java VertexQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VertexQuery类属于com.tinkerpop.blueprints包,在下文中一共展示了VertexQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@Override
public VertexQuery query()
{
return new WrapperVertexQuery(getBaseVertex().query())
{
@Override
public Iterable<Edge> edges()
{
return new BjoernEdgeIterable(query.edges());
}
@Override
public Iterable<Vertex> vertices()
{
return new BjoernVertexIterable(query.vertices());
}
};
}
示例2: getRelations
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@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();
}
示例3: has
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@Override
public VertexQuery has(String key, Predicate predicate, Object value) {
if (predicate.toString().equals("EQUAL"))
return has(key, value);
else if (predicate.toString().equals("NOT_EQUAL"))
return hasNot(key, value);
else if (predicate.toString().equals("GREATER_THAN"))
queryBuilder = queryBuilder.greaterThan(key, value);
else if (predicate.toString().equals("LESS_THAN"))
queryBuilder = queryBuilder.lessThan(key, value);
else if (predicate.toString().equals("GREATER_THAN_EQUAL"))
queryBuilder = queryBuilder.greaterThanEq(key, value);
else if (predicate.toString().equals("LESS_THAN_EQUAL"))
queryBuilder = queryBuilder.lessThanEq(key, value);
else if (predicate.toString().equals("IN"))
queryBuilder = queryBuilder.in(key, (Collection<Object>)value);
else if (predicate.toString().equals("NOT_IN"))
queryBuilder = queryBuilder.notIn(key, (Collection<Object>)value);
else
throw new UnsupportedOperationException("Predicate with type " + predicate + " is not supported.");
return this;
}
示例4: testVertexQueryByLabel
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@Test
public void testVertexQueryByLabel() {
int num = 200;
Vertex a = graph.addVertex("Vertex_a");
Vertex b = graph.addVertex("Vertex_b");
for (int i = 0; i < num; ++i) {
graph.addEdge("Edge_" + i, a, b, "label " + i);
}
VertexQuery q = a.query();
q.labels("label 10", "label 100", "label 199");
assertEquals(3, countResults(q.edges()));
}
示例5: testVertexQueryByInterval
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@Test
public void testVertexQueryByInterval() {
int num = 30;
Vertex a = graph.addVertex("Vertex_a");
Vertex b = graph.addVertex("Vertex_b");
for (int i = 0; i < num; ++i) {
Edge e = graph.addEdge("Edge_" + i, a, b, "label " + i);
e.setProperty("intValue", i);
}
VertexQuery q = a.query();
q.interval("intValue", 10, 12);
assertEquals(2, countResults(q.edges()));
}
示例6: testVertexQueryIDs
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testVertexQueryIDs() {
int num = 7;
Vertex a = graph.addVertex("Vertex_a");
Vertex b = graph.addVertex("Vertex_b");
for (int i = 0; i < num; ++i) {
Edge e = graph.addEdge("Edge_" + i, a, b, "label " + i);
e.setProperty("intValue", i);
}
VertexQuery q = a.query();
q.has("intValue", 3);
q.direction(Direction.OUT);
assertEquals(1, countResults((Iterator<String>) q.vertexIds()));
}
示例7: testVertexQueryHas
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testVertexQueryHas() {
int num = 7;
Vertex a = graph.addVertex("Vertex_a");
Vertex b = graph.addVertex("Vertex_b");
for (int i = 0; i < num; ++i) {
Edge e = graph.addEdge("Edge_" + i, a, b, "label " + i);
e.setProperty("intValue" + i, i);
}
VertexQuery q = a.query();
q.has("intValue1");
assertEquals(1, countResults((Iterator<String>) q.vertexIds()));
}
示例8: testVertexQueryIN
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testVertexQueryIN() {
int num = 7;
Vertex a = graph.addVertex("Vertex_a");
Vertex b = graph.addVertex("Vertex_b");
for (int i = 0; i < num; ++i) {
Edge e = graph.addEdge("Edge_" + i, a, b, "label " + i);
e.setProperty("intValue" + i, i);
}
VertexQuery q = a.query();
q.has("label", Contains.IN, Arrays.asList("label 0", "label 1", "unknown"));
int countResults = countResults((Iterator<String>) q.vertexIds());
assertEquals(2, countResults);
}
示例9: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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 com.tinkerpop.blueprints.util.wrappers.event2.EventEdgeIterable(this.query.edges(), eventGraph);
}
};
}
示例10: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
@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());
}
};
}
示例11: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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());
}
};
}
示例12: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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);
}
};
}
示例13: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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);
}
};
}
示例14: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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);
}
};
}
示例15: query
import com.tinkerpop.blueprints.VertexQuery; //导入依赖的package包/类
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());
}
};
}