当前位置: 首页>>代码示例>>Java>>正文


Java GraphQuery类代码示例

本文整理汇总了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;
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:26,代码来源:TitanFTMDb.java

示例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);
        }
    };
}
 
开发者ID:indexiatech,项目名称:antiquity,代码行数:20,代码来源:ActiveVersionedGraph.java

示例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;
}
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:24,代码来源:EntityGraphQuery.java

示例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;
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:8,代码来源:VertexiumBlueprintsGraphQuery.java

示例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);
        }
    };
}
 
开发者ID:dsiegel,项目名称:BlueprintsExperiment,代码行数:15,代码来源:EventGraph.java

示例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());
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:14,代码来源:ReadOnlyGraph.java

示例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);
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:15,代码来源:PartitionGraph.java

示例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);
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:15,代码来源:IdGraph.java

示例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);
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:15,代码来源:EventGraph.java

示例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());
        }
    };
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:14,代码来源:WrappedGraph.java

示例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();
        }
    }
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:33,代码来源:GraphQueryPipe.java

示例12: testGraphQueryHas

import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHas() {
	GraphQuery q = graph.query();
	q.has("x");

	assertEquals(1, countResults(q.vertices()));
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:8,代码来源:ArangoGraphQueryTest.java

示例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()));
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:9,代码来源:ArangoGraphQueryTest.java

示例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()));
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:9,代码来源:ArangoGraphQueryTest.java

示例15: testGraphQueryHasNot

import com.tinkerpop.blueprints.GraphQuery; //导入依赖的package包/类
@Test
public void testGraphQueryHasNot() {
	GraphQuery q = graph.query();
	q.hasNot("x");

	assertEquals(2, countResults(q.vertices()));
}
 
开发者ID:arangodb,项目名称:blueprints-arangodb-graph,代码行数:8,代码来源:ArangoGraphQueryTest.java


注:本文中的com.tinkerpop.blueprints.GraphQuery类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。