本文整理了Java中com.tinkerpop.blueprints.Graph.query()
方法的一些代码示例,展示了Graph.query()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.query()
方法的具体详情如下:
包路径:com.tinkerpop.blueprints.Graph
类名称:Graph
方法名:query
[英]Generate a query object that can be used to fine tune which edges/vertices are retrieved from the graph.
[中]生成一个查询对象,该对象可用于微调从图形检索的边/顶点。
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
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());
}
};
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
@Override
public GraphQuery query() {
return graph.query();
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
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());
}
};
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
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);
}
};
}
}
代码示例来源:origin: tinkerpop/furnace
@Override
public GraphQuery query() {
final DerivedGraph g = this;
return new WrappedGraphQuery(this.baseGraph.query()) {
@Override
public Iterable<Edge> edges() {
return new DerivedEdgeIterable(this.query.edges(), g);
}
@Override
public Iterable<Vertex> vertices() {
return new DerivedVertexIterable(this.query.vertices(), g);
}
};
}
代码示例来源:origin: eu.agrosense.server/storage-tinkerpop
protected static Query uriQuery(Graph g, String uri) {
return g.query().has(AgroEntity.PROP_URI, uri);
}
代码示例来源:origin: com.tinkerpop.blueprints/blueprints-core
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);
}
};
}
代码示例来源:origin: org.jboss.windup.graph.frames/windup-frames
/**
* Generate a query object that can be used to fine tune which edges/vertices are retrieved from the graph.
*
* @return a graph query object with methods for constraining which data is pulled from the underlying graph
*/
public FramedGraphQuery query() {
return new FramedGraphQueryImpl(this, config.getConfiguredGraph().query());
}
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public CloseableIterator<Term> termsByPredicatePosition(Predicate p, int position) throws AtomSetException {
GraphQuery query = this.graph.query();
query.has("class", "atom");
query.has("predicate", predicateToString(p));
Set<Term> terms = new TreeSet<Term>();
Iterator<Term> it = new AtomToTermIterator(query.vertices().iterator(), position);
while (it.hasNext()) {
terms.add(it.next());
}
return new CloseableIteratorAdapter<Term>(terms.iterator());
}
代码示例来源:origin: com.tinkerpop/frames
/**
* Generate a query object that can be used to fine tune which edges/vertices are retrieved from the graph.
*
* @return a graph query object with methods for constraining which data is pulled from the underlying graph
*/
public FramedGraphQuery query() {
return new FramedGraphQueryImpl(this, config.getConfiguredGraph().query());
}
}
代码示例来源:origin: indexiatech/antiquity
/**
* Get a single element by key, value.
*
* @param graph The graph to get the element from
* @param key The key of the element
* @param value The value of the element
* @param clazz The class element type, can be Vertex | Edge.
* @return Found vertex that matches the specified criteria or null if not
* found.
* @throws IllegalStateException if multiple vertices found that matches the
* specified criteria
*/
@SuppressWarnings("unchecked")
public static <E extends Element> E getSingleElement(Graph graph, String key, Object value, Class<E> clazz) {
Iterable<?> it =
Vertex.class.isAssignableFrom(clazz) ? graph.query().has(key, value).vertices() : graph.query().has(key, value).edges();
Iterator<?> iter = it.iterator();
E e = null;
if (iter.hasNext()) {
e = (E) iter.next();
}
return e;
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public Set<Term> getTerms(Type type) {
Set<Term> terms = new TreeSet<Term>();
GraphQuery query = this.graph.query();
query.has("class", "term");
query.has("type", type.toString());
for (Vertex v : query.vertices()) {
terms.add(vertexToTerm(v));
}
return terms;
}
代码示例来源:origin: com.tinkerpop/pipes
} else {
final Graph graph = this.starts.next();
GraphQuery query = graph.query();
if (null != this.hasContainers) {
for (final HasContainer hasContainer : this.hasContainers) {
代码示例来源:origin: iTransformers/netTransformer
((KeyIndexableGraph) graph).createKeyIndex("name", Vertex.class);
GraphQuery result = graph.query().has(nodeId);
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public CloseableIterator<Atom> atomsByPredicate(Predicate p) throws AtomSetException {
GraphQuery query = this.graph.query();
query.has("class", "atom");
query.has("predicate", predicateToString(p));
return new AtomIterator(query.vertices().iterator());
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public boolean contains(Atom atom) {
GraphQuery query = this.graph.query();
query.has("class", "atom");
query.has("predicate", predicateToString(atom.getPredicate()));
int i = 0;
for (Term t : atom) {
query.has("term" + i++, termToString(t));
}
return query.vertices().iterator().hasNext();
}
代码示例来源:origin: BrynCooke/totorom
delegateIterator = delegate.query().has(key, value).vertices().iterator();
delegateIterator = delegate.query().has(key, value).vertices().iterator();
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
private Vertex add(Term term) {
Vertex v = null;
GraphQuery query = this.graph.query();
query.has("class", "term");
query.has("value", term.getIdentifier().toString());
query.has("type", term.getType().toString());
Iterator<Vertex> it = query.vertices().iterator();
if (it.hasNext()) {
v = it.next();
} else {
v = this.graph.addVertex(null);
v.setProperty("class", "term");
v.setProperty("value", term.getIdentifier().toString());
v.setProperty("type", term.getType().toString());
}
return v;
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
@Override
public CloseableIterator<Atom> match(Atom atom) {
GraphQuery query = this.graph.query();
query.has("class", "atom");
query.has("predicate", predicateToString(atom.getPredicate()));
int i = -1;
for (Term t : atom) {
++i;
if (t.isConstant()) {
query.has("term" + i, termToString(t));
}
}
return new AtomIterator(query.vertices().iterator());
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-blueprints
private Vertex add(Predicate predicate) {
Vertex v = null;
GraphQuery query = this.graph.query();
query.has("class", "predicate");
query.has("value", predicate.getIdentifier());
query.has("arity", predicate.getArity());
Iterator<Vertex> it = query.vertices().iterator();
if (it.hasNext()) {
v = it.next();
} else {
v = graph.addVertex(null);
v.setProperty("class", "predicate");
v.setProperty("value", predicate.getIdentifier());
v.setProperty("arity", predicate.getArity());
}
return v;
}
内容来源于网络,如有侵权,请联系作者删除!