本文整理汇总了Java中com.tinkerpop.blueprints.GraphQuery.has方法的典型用法代码示例。如果您正苦于以下问题:Java GraphQuery.has方法的具体用法?Java GraphQuery.has怎么用?Java GraphQuery.has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tinkerpop.blueprints.GraphQuery
的用法示例。
在下文中一共展示了GraphQuery.has方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
}
}
示例3: testGraphQueryHas
import com.tinkerpop.blueprints.GraphQuery; //导入方法依赖的package包/类
@Test
public void testGraphQueryHas() {
GraphQuery q = graph.query();
q.has("x");
assertEquals(1, countResults(q.vertices()));
}
示例4: 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()));
}
示例5: 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()));
}
示例6: HistoricGraphQuery
import com.tinkerpop.blueprints.GraphQuery; //导入方法依赖的package包/类
/**
* Create instance
*
* @param hg associated graph
* @param query query instance to be wrapped
*/
public HistoricGraphQuery(HistoricVersionedGraph<?, V> hg, GraphQuery query) {
super(query.has(VEProps.HISTORIC_ELEMENT_PROP_KEY, true));
this.hg = hg;
}