本文整理了Java中org.vertexium.query.Query.edges
方法的一些代码示例,展示了Query.edges
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.edges
方法的具体详情如下:
包路径:org.vertexium.query.Query
类名称:Query
方法名:edges
暂无
代码示例来源:origin: org.vertexium/vertexium-cypher
private static QueryResultsIterable<? extends Element> executeQuery(
VertexiumCypherQueryContext ctx,
Query query,
MatchConstraint<?, ?> matchConstraint
) {
QueryResultsIterable<? extends Element> elements;
if (matchConstraint instanceof NodeMatchConstraint) {
elements = query.vertices(ctx.getFetchHints());
} else if (matchConstraint instanceof RelationshipMatchConstraint) {
elements = query.edges(ctx.getFetchHints());
} else {
throw new VertexiumCypherNotImplemented("unexpected constraint type: " + matchConstraint.getClass().getName());
}
return elements;
}
代码示例来源:origin: visallo/vertexium
private static QueryResultsIterable<? extends Element> executeQuery(
VertexiumCypherQueryContext ctx,
Query query,
MatchConstraint<?, ?> matchConstraint
) {
QueryResultsIterable<? extends Element> elements;
if (matchConstraint instanceof NodeMatchConstraint) {
elements = query.vertices(ctx.getFetchHints());
} else if (matchConstraint instanceof RelationshipMatchConstraint) {
elements = query.edges(ctx.getFetchHints());
} else {
throw new VertexiumCypherNotImplemented("unexpected constraint type: " + matchConstraint.getClass().getName());
}
return elements;
}
代码示例来源:origin: org.vertexium/vertexium-blueprints
@Override
public Iterable<Edge> getEdges(final String key, final Object value) {
final Authorizations authorizations = getAuthorizationsProvider().getAuthorizations();
return new ConvertingIterable<org.vertexium.Edge, Edge>(getGraph().query(authorizations).has(key, Compare.EQUAL, value).edges(getFetchHints())) {
@Override
protected Edge convert(org.vertexium.Edge edge) {
return VertexiumBlueprintsEdge.create(VertexiumBlueprintsGraph.this, edge, authorizations);
}
};
}
代码示例来源:origin: org.vertexium/vertexium-test
private Map<Object, Long> queryGraphQueryWithTermsAggregation(String queryString, String propertyName, ElementType elementType, Authorizations authorizations) {
Query q = (queryString == null ? graph.query(authorizations) : graph.query(queryString, authorizations)).limit(0);
TermsAggregation agg = new TermsAggregation("terms-count", propertyName);
if (!q.isAggregationSupported(agg)) {
LOGGER.warn("%s unsupported", agg.getClass().getName());
return null;
}
q.addAggregation(agg);
QueryResultsIterable<? extends Element> elements = elementType == ElementType.VERTEX ? q.vertices() : q.edges();
TermsResult aggregationResult = elements.getAggregationResult("terms-count", TermsResult.class);
return termsBucketToMap(aggregationResult.getBuckets());
}
代码示例来源:origin: visallo/vertexium
private Map<Object, Long> queryGraphQueryWithTermsAggregation(String queryString, String propertyName, ElementType elementType, Authorizations authorizations) {
Query q = (queryString == null ? graph.query(authorizations) : graph.query(queryString, authorizations)).limit(0);
TermsAggregation agg = new TermsAggregation("terms-count", propertyName);
if (!q.isAggregationSupported(agg)) {
LOGGER.warn("%s unsupported", agg.getClass().getName());
return null;
}
q.addAggregation(agg);
QueryResultsIterable<? extends Element> elements = elementType == ElementType.VERTEX ? q.vertices() : q.edges();
TermsResult aggregationResult = elements.getAggregationResult("terms-count", TermsResult.class);
return termsBucketToMap(aggregationResult.getBuckets());
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGraphQueryForEdgesUsingEdgeLabel() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL2, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v3, v1, LABEL_LABEL2, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.LABEL_PROPERTY_NAME, LABEL_LABEL1)
.edges();
assertEdgeIdsAnyOrder(edges, "e1");
edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.LABEL_PROPERTY_NAME, LABEL_LABEL2)
.edges();
assertEdgeIdsAnyOrder(edges, "e2", "e3");
}
代码示例来源:origin: visallo/vertexium
@Test
public void testGraphQueryForEdgesUsingEdgeLabel() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL2, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v3, v1, LABEL_LABEL2, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.LABEL_PROPERTY_NAME, LABEL_LABEL1)
.edges();
assertEdgeIdsAnyOrder(edges, "e1");
edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.LABEL_PROPERTY_NAME, LABEL_LABEL2)
.edges();
assertEdgeIdsAnyOrder(edges, "e2", "e3");
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGraphQueryForEdgesUsingInOutVertexIds() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v3, v1, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.has(Edge.IN_VERTEX_ID_PROPERTY_NAME, "v2")
.edges();
assertEdgeIdsAnyOrder(edges, "e1");
edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.edges();
assertEdgeIdsAnyOrder(edges, "e1", "e2");
}
代码示例来源:origin: visallo/vertexium
@Test
public void testGraphQueryForEdgesUsingInOutVertexIds() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v3, v1, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.has(Edge.IN_VERTEX_ID_PROPERTY_NAME, "v2")
.edges();
assertEdgeIdsAnyOrder(edges, "e1");
edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.edges();
assertEdgeIdsAnyOrder(edges, "e1", "e2");
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGraphQueryForEdgesUsingInOrOutVertexId() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v2, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.IN_OR_OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.edges();
assertEdgeIdsAnyOrder(edges, "e1", "e2");
}
代码示例来源:origin: visallo/vertexium
@Test
public void testGraphQueryForEdgesUsingInOrOutVertexId() {
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v3 = graph.addVertex("v3", VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.addEdge("e3", v2, v3, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
graph.flush();
QueryResultsIterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has(Edge.IN_OR_OUT_VERTEX_ID_PROPERTY_NAME, "v1")
.edges();
assertEdgeIdsAnyOrder(edges, "e1", "e2");
}
代码示例来源:origin: visallo/vertexium
@Test
public void testAddEdgeWithoutIndexing() {
assumeTrue("add edge without indexing not supported", !isDefaultSearchIndex());
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_A)
.setIndexHint(IndexHint.DO_NOT_INDEX)
.save(AUTHORIZATIONS_A);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A_AND_B)
.has("prop1", "value1")
.edges();
assertEdgeIds(edges);
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testAddEdgeWithoutIndexing() {
assumeTrue("add edge without indexing not supported", !isDefaultSearchIndex());
Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_A)
.setIndexHint(IndexHint.DO_NOT_INDEX)
.save(AUTHORIZATIONS_A);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A_AND_B)
.has("prop1", "value1")
.edges();
assertEdgeIds(edges);
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testDisableEdgeIndexing() {
assumeTrue("disabling indexing not supported", disableEdgeIndexing(graph));
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v2 = graph.prepareVertex("v2", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has("prop1", "value1")
.edges();
Assert.assertEquals(0, count(edges));
}
代码示例来源:origin: visallo/vertexium
@Test
public void testDisableEdgeIndexing() {
assumeTrue("disabling indexing not supported", disableEdgeIndexing(graph));
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v2 = graph.prepareVertex("v2", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("prop1", "value1", VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has("prop1", "value1")
.edges();
Assert.assertEquals(0, count(edges));
}
代码示例来源:origin: org.visallo/visallo-web
.skip(offset)
.limit(size)
.edges();
代码示例来源:origin: visallo/vertexium
@Test
public void testGraphQueryEdgeHasWithSecurity() {
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v2 = graph.prepareVertex("v2", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v3 = graph.prepareVertex("v3", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("age", 25, VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A)
.setProperty("age", 25, VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has("age", Compare.EQUAL, 25)
.edges();
Assert.assertEquals(1, count(edges));
}
代码示例来源:origin: org.vertexium/vertexium-test
@Test
public void testGraphQueryEdgeHasWithSecurity() {
Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v2 = graph.prepareVertex("v2", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
Vertex v3 = graph.prepareVertex("v3", VISIBILITY_A).save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
.setProperty("age", 25, VISIBILITY_A)
.save(AUTHORIZATIONS_A_AND_B);
graph.prepareEdge("e2", v1, v3, LABEL_LABEL1, VISIBILITY_A)
.setProperty("age", 25, VISIBILITY_B)
.save(AUTHORIZATIONS_A_AND_B);
graph.flush();
Iterable<Edge> edges = graph.query(AUTHORIZATIONS_A)
.has("age", Compare.EQUAL, 25)
.edges();
Assert.assertEquals(1, count(edges));
}
代码示例来源:origin: org.vertexium/vertexium-test
.edges(FetchHints.EDGE_REFS);
代码示例来源:origin: visallo/vertexium
.edges(FetchHints.EDGE_REFS);
内容来源于网络,如有侵权,请联系作者删除!