org.vertexium.query.Query.elements()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.vertexium.query.Query.elements方法的一些代码示例,展示了Query.elements的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.elements方法的具体详情如下:
包路径:org.vertexium.query.Query
类名称:Query
方法名:elements

Query.elements介绍

暂无

代码示例

代码示例来源:origin: org.visallo/visallo-core

/**
 * Create a {@link java.util.stream.Stream} containing the results of executing the queries, in order. The results
 * are not loaded into memory first.
 */
public static Stream<Element> stream(Query... queries) {
  return Arrays.stream(queries)
      .map(query -> StreamSupport.stream(query.elements().spliterator(), false))
      .reduce(Stream::concat)
      .orElseGet(Stream::empty);
}

代码示例来源:origin: org.vertexium/vertexium-core

/**
 * Create a {@link java.util.stream.Stream} containing the results of executing the queries, in order. The results
 * are not loaded into memory first.
 */
public static Stream<Element> stream(Query... queries) {
  return Arrays.stream(queries)
      .map(query -> StreamSupport.stream(query.elements().spliterator(), false))
      .reduce(Stream::concat)
      .orElseGet(Stream::empty);
}

代码示例来源:origin: visallo/vertexium

/**
 * Create a {@link java.util.stream.Stream} containing the results of executing the queries, in order. The results
 * are not loaded into memory first.
 */
public static Stream<Element> stream(Query... queries) {
  return Arrays.stream(queries)
      .map(query -> StreamSupport.stream(query.elements().spliterator(), false))
      .reduce(Stream::concat)
      .orElseGet(Stream::empty);
}

代码示例来源:origin: visallo/vertexium

graph.flush();
Iterable<Element> results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop1").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop3").sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING).elements();
assertEquals(2, count(results));
Iterator<Element> iterator = results.iterator();
assertEquals("v2", iterator.next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("exact").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("location").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());

代码示例来源:origin: visallo/vertexium

@Test
public void testGraphQueryHasGeoPointAndExact() {
  graph.defineProperty("location").dataType(GeoPoint.class).define();
  graph.defineProperty("exact").dataType(String.class).textIndexHint(TextIndexHint.EXACT_MATCH).define();
  graph.prepareVertex("v1", VISIBILITY_A)
      .setProperty("prop1", "val1", VISIBILITY_A)
      .setProperty("exact", "val1", VISIBILITY_A)
      .setProperty("location", new GeoPoint(38.9186, -77.2297), VISIBILITY_A)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.prepareVertex("v2", VISIBILITY_A)
      .setProperty("prop2", "val2", VISIBILITY_A)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Iterable<Element> results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("prop1").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
  results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("exact").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
  results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("location").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
}

代码示例来源:origin: org.vertexium/vertexium-test

graph.flush();
Iterable<Element> results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop1").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("prop3").sort(Element.ID_PROPERTY_NAME, SortDirection.ASCENDING).elements();
assertEquals(2, count(results));
Iterator<Element> iterator = results.iterator();
assertEquals("v2", iterator.next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("exact").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
assertEquals("v2", results.iterator().next().getId());
results = graph.query("*", AUTHORIZATIONS_A_AND_B).hasNot("location").elements();
assertEquals(1, count(results));
assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testGraphQueryHasGeoPointAndExact() {
  graph.defineProperty("location").dataType(GeoPoint.class).define();
  graph.defineProperty("exact").dataType(String.class).textIndexHint(TextIndexHint.EXACT_MATCH).define();
  graph.prepareVertex("v1", VISIBILITY_A)
      .setProperty("prop1", "val1", VISIBILITY_A)
      .setProperty("exact", "val1", VISIBILITY_A)
      .setProperty("location", new GeoPoint(38.9186, -77.2297), VISIBILITY_A)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.prepareVertex("v2", VISIBILITY_A)
      .setProperty("prop2", "val2", VISIBILITY_A)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  Iterable<Element> results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("prop1").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
  results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("exact").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
  results = graph.query("*", AUTHORIZATIONS_A_AND_B).has("location").elements();
  assertEquals(1, count(results));
  assertEquals(1, ((IterableWithTotalHits) results).getTotalHits());
  assertEquals("v1", results.iterator().next().getId());
}

代码示例来源:origin: visallo/vertexium

assertIdsAnyOrder(edgeIds, e1.getId());
QueryResultsIterable<Element> elements = graph.query(AUTHORIZATIONS_A).hasAuthorization(VISIBILITY_A_STRING).elements(FetchHints.ALL);
assertResultsCount(0, elements);
assertResultsCount(0, 0, elementIds);
elements = graph.query(AUTHORIZATIONS_A).hasAuthorization(VISIBILITY_A_STRING).elements(FetchHints.ALL_INCLUDING_HIDDEN);
assertResultsCount(2, elements);
assertElementIdsAnyOrder(elements, v1.getId(), e1.getId());

代码示例来源:origin: org.vertexium/vertexium-test

assertIdsAnyOrder(edgeIds, e1.getId());
QueryResultsIterable<Element> elements = graph.query(AUTHORIZATIONS_A).hasAuthorization(VISIBILITY_A_STRING).elements(FetchHints.ALL);
assertResultsCount(0, elements);
assertResultsCount(0, 0, elementIds);
elements = graph.query(AUTHORIZATIONS_A).hasAuthorization(VISIBILITY_A_STRING).elements(FetchHints.ALL_INCLUDING_HIDDEN);
assertResultsCount(2, elements);
assertElementIdsAnyOrder(elements, v1.getId(), e1.getId());

相关文章