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


Java LdbcQuery3Result类代码示例

本文整理汇总了Java中com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery3Result的典型用法代码示例。如果您正苦于以下问题:Java LdbcQuery3Result类的具体用法?Java LdbcQuery3Result怎么用?Java LdbcQuery3Result使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LdbcQuery3Result类属于com.ldbc.driver.workloads.ldbc.snb.interactive包,在下文中一共展示了LdbcQuery3Result类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertSingleResult

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery3Result; //导入依赖的package包/类
@Override
public LdbcQuery3Result convertSingleResult(ResultSet result) throws SQLException {
	return new LdbcQuery3Result(
			result.getLong(1),
			result.getString(2),
			result.getString(3),
			result.getInt(4),
			result.getInt(5),
			result.getInt(6));
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:11,代码来源:InteractiveDb.java

示例2: executeOperation

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery3Result; //导入依赖的package包/类
@Override
public void executeOperation(LdbcQuery3 operation,
    DbConnectionState dbConnectionState,
    ResultReporter resultReporter) throws DbException {

  Driver driver = ((Neo4jDbConnectionState) dbConnectionState).getDriver();

  long periodStart = operation.startDate().getTime();
  long periodEnd = periodStart
      + ((long) operation.durationDays()) * 24l * 60l * 60l * 1000l;

  String statement =
      "   MATCH (person:Person {id:{1}})-[:KNOWS*1..2]-(friend:Person)<-[:HAS_CREATOR]-(messageX),"
      + " (messageX)-[:IS_LOCATED_IN]->(countryX:Place)"
      + " WHERE"
      + "   not(person=friend)"
      + "   AND not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryX))"
      + "   AND countryX.name={2} AND messageX.creationDate>={4}"
      + "   AND messageX.creationDate<{5}"
      + " WITH friend, count(DISTINCT messageX) AS xCount"
      + " MATCH (friend)<-[:HAS_CREATOR]-(messageY)-[:IS_LOCATED_IN]->(countryY:Place)"
      + " WHERE"
      + "   countryY.name={3}"
      + "   AND not((friend)-[:IS_LOCATED_IN]->()-[:IS_PART_OF]->(countryY))"
      + "   AND messageY.creationDate>={4}"
      + "   AND messageY.creationDate<{5}"
      + " WITH"
      + "   friend.id AS friendId,"
      + "   friend.firstName AS friendFirstName,"
      + "   friend.lastName AS friendLastName,"
      + "   xCount,"
      + "   count(DISTINCT messageY) AS yCount"
      + " RETURN"
      + "   friendId,"
      + "   friendFirstName,"
      + "   friendLastName,"
      + "   xCount,"
      + "   yCount,"
      + "   xCount + yCount AS xyCount"
      + " ORDER BY xyCount DESC, toInt(friendId) ASC"
      + " LIMIT {6}";
  Value parameters = parameters(
        "1", String.valueOf(operation.personId()), 
        "2", operation.countryXName(), 
        "3", operation.countryYName(),
        "4", periodStart,
        "5", periodEnd,
        "6", operation.limit());

  // Execute the query and get the results.
  List<LdbcQuery3Result> resultList = new ArrayList<>();
  try (Session session = driver.session(AccessMode.READ)) {
    try (Transaction tx = session.beginTransaction()) {
      StatementResult result = tx.run(statement, parameters);
      tx.success();
      tx.close();

      while (result.hasNext()) {
        Record record = result.next();

        resultList.add(
            new LdbcQuery3Result(
                Long.valueOf(record.get("friendId").asString()),
                record.get("friendFirstName").asString(),
                record.get("friendLastName").asString(),
                record.get("xCount").asInt(),
                record.get("yCount").asInt(),
                record.get("xyCount").asInt()));
      }
    }
  }

  resultReporter.report(0, resultList, operation);
}
 
开发者ID:PlatformLab,项目名称:ldbc-snb-impls,代码行数:75,代码来源:Neo4jDb.java


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