本文整理汇总了Java中com.tinkerpop.blueprints.GraphQuery类的典型用法代码示例。如果您正苦于以下问题:Java GraphQuery类的具体用法?Java GraphQuery怎么用?Java GraphQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphQuery类属于com.tinkerpop.blueprints包,在下文中一共展示了GraphQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVertices
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
/**
* Gets the specified vertices or null if no such vertex is found
*
* @param label vertex type label
* @param limit int value limiting the result. use Integer.MAX_VALUE for unlimited
* @param pValueMap PropertyKey->Value map
* @return the specified vertices or null if no such vertex is found
*/
public Iterable<Vertex> getVertices(String label, Map<String, String> pValueMap, int limit) throws SchemaViolationException {
Integer suffix = s.getVertexTypes().get(label);
Set<Vertex> res = new HashSet<>();
if (suffix == null)
throw new SchemaViolationException(label + " vertex type is not defined in the schema for " + s.getClass().getSimpleName());
GraphQuery gq = g.query();
for (String property : pValueMap.keySet())
gq = gq.has(property, pValueMap.get(property));
if (limit != Integer.MAX_VALUE)
gq = gq.limit(limit);
for (Vertex v : gq.vertices())
if ((((Long) v.getId()) % mult) == suffix)
res.add(v);
return res;
}
示例2: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Override
public GraphQuery query() {
final ActiveVersionedGraph<T, V> ag = this;
return new WrappedGraphQuery(getBaseGraph().query()) {
@Override
public Iterable<Edge> edges() {
return new ActiveVersionedEdgeIterable<V>(getQuery().edges(), ag);
}
@Override
public Iterable<Vertex> vertices() {
return new ActiveVersionedVertexIterable<V>(getQuery().vertices(), ag);
}
public GraphQuery getQuery() {
return this.query.has(VEProps.HISTORIC_ELEMENT_PROP_KEY, false);
}
};
}
示例3: has
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Override
public GraphQuery 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: has
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Override
public GraphQuery has(String key, Predicate predicate, Object value) {
org.vertexium.query.Predicate vertexiumPredicate = toVertexiumPredicate(predicate);
this.q.has(key, vertexiumPredicate, value);
hasFilter = true;
return this;
}
示例5: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
final EventGraph eventGraph = this;
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new com.tinkerpop.blueprints.util.wrappers.event2.EventEdgeIterable(this.query.edges(), eventGraph);
}
@Override
public Iterable<Vertex> vertices() {
return new EventVertexIterable(this.query.vertices(), eventGraph);
}
};
}
示例6: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new ReadOnlyEdgeIterable(this.query.edges());
}
@Override
public Iterable<Vertex> vertices() {
return new ReadOnlyVertexIterable(this.query.vertices());
}
};
}
示例7: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
final PartitionGraph partitionGraph = this;
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new PartitionEdgeIterable(this.query.has(partitionKey, Contains.IN, readPartitions).edges(), partitionGraph);
}
@Override
public Iterable<Vertex> vertices() {
return new PartitionVertexIterable(this.query.has(partitionKey, Contains.IN, readPartitions).vertices(), partitionGraph);
}
};
}
示例8: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
final IdGraph idGraph = this;
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new IdEdgeIterable(this.query.edges(), idGraph);
}
@Override
public Iterable<Vertex> vertices() {
return new IdVertexIterable(this.query.vertices(), idGraph);
}
};
}
示例9: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
final EventGraph eventGraph = this;
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new EventEdgeIterable(this.query.edges(), eventGraph);
}
@Override
public Iterable<Vertex> vertices() {
return new EventVertexIterable(this.query.vertices(), eventGraph);
}
};
}
示例10: query
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public GraphQuery query() {
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new WrappedEdgeIterable(this.query.edges());
}
@Override
public Iterable<Vertex> vertices() {
return new WrappedVertexIterable(this.query.vertices());
}
};
}
示例11: processNextStart
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
public E processNextStart() {
while (true) {
if (this.count >= this.highRange) {
throw FastNoSuchElementException.instance();
} else if (this.currentIterator.hasNext()) {
this.count++;
final E e = currentIterator.next();
if (this.count > this.lowRange)
return e;
} else {
final Graph graph = this.starts.next();
GraphQuery query = graph.query();
if (null != this.hasContainers) {
for (final HasContainer hasContainer : this.hasContainers) {
query = query.has(hasContainer.key, hasContainer.predicate, hasContainer.value);
}
}
if (null != this.intervalContainers) {
for (final IntervalContainer intervalContainer : this.intervalContainers) {
query = query.interval(intervalContainer.key, intervalContainer.startValue, intervalContainer.endValue);
}
}
if (this.highRange != Integer.MAX_VALUE) {
query = query.limit(this.highRange - this.count);
}
this.currentIterator = this.elementClass.equals(Vertex.class) ?
(Iterator<E>) query.vertices().iterator() :
(Iterator<E>) query.edges().iterator();
}
}
}
示例12: testGraphQueryHas
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHas() {
GraphQuery q = graph.query();
q.has("x");
assertEquals(1, countResults(q.vertices()));
}
示例13: testGraphQueryHas2
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHas2() {
GraphQuery q = graph.query();
q.has("x");
q.has("a");
assertEquals(0, countResults(q.vertices()));
}
示例14: testGraphQueryHas3
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHas3() {
GraphQuery q = graph.query();
q.has("i");
q.has("a");
assertEquals(1, countResults(q.vertices()));
}
示例15: testGraphQueryHasNot
import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHasNot() {
GraphQuery q = graph.query();
q.hasNot("x");
assertEquals(2, countResults(q.vertices()));
}