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


Java LdbcQuery11类代码示例

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


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

示例1: onInit

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
	protected void onInit(Map<String, String> properties, LoggingService loggingService) throws DbException {
		try {
//			dbs = new JdbcCustomPoolingDbConnectionStore<InteractiveQueryStore>(properties, new InteractiveQueryStore(properties.get("queryDir")));
			dbs = new JdbcPoolingDbConnectionStore<InteractiveQueryStore>(properties, new InteractiveQueryStore(properties.get("queryDir")));
		} catch (ClassNotFoundException | SQLException e) {
			throw new DbException(e);
		}
		
		registerOperationHandler(LdbcQuery1.class, Query1.class); //ARRAY RESULT
		registerOperationHandler(LdbcQuery2.class, Query2.class);
		registerOperationHandler(LdbcQuery3.class, Query3.class);
		registerOperationHandler(LdbcQuery4.class, Query4.class);
		registerOperationHandler(LdbcQuery5.class, Query5.class);
		registerOperationHandler(LdbcQuery6.class, Query6.class);
		registerOperationHandler(LdbcQuery7.class, Query7.class);
		registerOperationHandler(LdbcQuery8.class, Query8.class);
		registerOperationHandler(LdbcQuery9.class, Query9.class);
		registerOperationHandler(LdbcQuery10.class, Query10.class);
		registerOperationHandler(LdbcQuery11.class, Query11.class);
		registerOperationHandler(LdbcQuery12.class, Query12.class); //ARRAY RESULT
		registerOperationHandler(LdbcQuery13.class, Query13.class); //NESTED WITH
		registerOperationHandler(LdbcQuery14.class, Query14.class); //NESTED WITH
		registerOperationHandler(LdbcShortQuery1PersonProfile.class, ShortQuery1PersonProfile.class);
		registerOperationHandler(LdbcShortQuery2PersonPosts.class, ShortQuery2PersonPosts.class); //BUG
		registerOperationHandler(LdbcShortQuery3PersonFriends.class, ShortQuery3PersonFriends.class);
		registerOperationHandler(LdbcShortQuery4MessageContent.class, ShortQuery4MessageContent.class);
		registerOperationHandler(LdbcShortQuery5MessageCreator.class, ShortQuery5MessageCreator.class);
		registerOperationHandler(LdbcShortQuery6MessageForum.class, ShortQuery6MessageForum.class);
		registerOperationHandler(LdbcShortQuery7MessageReplies.class, ShortQuery7MessageReplies.class);
		registerOperationHandler(LdbcUpdate1AddPerson.class, Update1AddPerson.class);
		registerOperationHandler(LdbcUpdate2AddPostLike.class, Update2AddPostLike.class);
		registerOperationHandler(LdbcUpdate3AddCommentLike.class, Update3AddCommentLike.class);
		registerOperationHandler(LdbcUpdate4AddForum.class, Update4AddForum.class);
		registerOperationHandler(LdbcUpdate5AddForumMembership.class, Update5AddForumMembership.class);
		registerOperationHandler(LdbcUpdate6AddPost.class, Update6AddPost.class);
		registerOperationHandler(LdbcUpdate7AddComment.class, Update7AddComment.class);
		registerOperationHandler(LdbcUpdate8AddFriendship.class, Update8AddFriendship.class);
	}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:40,代码来源:InteractiveDb.java

示例2: executeOperation

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
public void executeOperation( LdbcQuery11 operation, DummyDbConnectionState dbConnectionState,
        ResultReporter resultReporter ) throws DbException
{
    sleep( operation, sleepDurationAsNano );
    resultReporter.report( 0, LDBC_QUERY_11_RESULTS, operation );
}
 
开发者ID:ldbc,项目名称:ldbc_snb_driver,代码行数:8,代码来源:DummyLdbcSnbInteractiveDb.java

示例3: executeOperation

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

}
 
开发者ID:PlatformLab,项目名称:ldbc-snb-impls,代码行数:7,代码来源:TitanDb.java

示例4: onInit

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
protected void onInit(Map<String, String> properties,
    LoggingService loggingService) throws DbException {

  connectionState = new Neo4jDbConnectionState(properties);

  /*
   * Register operation handlers with the benchmark.
   */
  registerOperationHandler(LdbcQuery1.class,
      LdbcQuery1Handler.class);
  registerOperationHandler(LdbcQuery2.class,
      LdbcQuery2Handler.class);
  registerOperationHandler(LdbcQuery3.class,
      LdbcQuery3Handler.class);
  registerOperationHandler(LdbcQuery4.class,
      LdbcQuery4Handler.class);
  registerOperationHandler(LdbcQuery5.class,
      LdbcQuery5Handler.class);
  registerOperationHandler(LdbcQuery6.class,
      LdbcQuery6Handler.class);
  registerOperationHandler(LdbcQuery7.class,
      LdbcQuery7Handler.class);
  registerOperationHandler(LdbcQuery8.class,
      LdbcQuery8Handler.class);
  registerOperationHandler(LdbcQuery9.class,
      LdbcQuery9Handler.class);
  registerOperationHandler(LdbcQuery10.class,
      LdbcQuery10Handler.class);
  registerOperationHandler(LdbcQuery11.class,
      LdbcQuery11Handler.class);
  registerOperationHandler(LdbcQuery12.class,
      LdbcQuery12Handler.class);
  registerOperationHandler(LdbcQuery13.class,
      LdbcQuery13Handler.class);
  registerOperationHandler(LdbcQuery14.class,
      LdbcQuery14Handler.class);

  registerOperationHandler(LdbcShortQuery1PersonProfile.class,
      LdbcShortQuery1PersonProfileHandler.class);
  registerOperationHandler(LdbcShortQuery2PersonPosts.class,
      LdbcShortQuery2PersonPostsHandler.class);
  registerOperationHandler(LdbcShortQuery3PersonFriends.class,
      LdbcShortQuery3PersonFriendsHandler.class);
  registerOperationHandler(LdbcShortQuery4MessageContent.class,
      LdbcShortQuery4MessageContentHandler.class);
  registerOperationHandler(LdbcShortQuery5MessageCreator.class,
      LdbcShortQuery5MessageCreatorHandler.class);
  registerOperationHandler(LdbcShortQuery6MessageForum.class,
      LdbcShortQuery6MessageForumHandler.class);
  registerOperationHandler(LdbcShortQuery7MessageReplies.class,
      LdbcShortQuery7MessageRepliesHandler.class);

  registerOperationHandler(LdbcUpdate1AddPerson.class,
      LdbcUpdate1AddPersonHandler.class);
  registerOperationHandler(LdbcUpdate2AddPostLike.class,
      LdbcUpdate2AddPostLikeHandler.class);
  registerOperationHandler(LdbcUpdate3AddCommentLike.class,
      LdbcUpdate3AddCommentLikeHandler.class);
  registerOperationHandler(LdbcUpdate4AddForum.class,
      LdbcUpdate4AddForumHandler.class);
  registerOperationHandler(LdbcUpdate5AddForumMembership.class,
      LdbcUpdate5AddForumMembershipHandler.class);
  registerOperationHandler(LdbcUpdate6AddPost.class,
      LdbcUpdate6AddPostHandler.class);
  registerOperationHandler(LdbcUpdate7AddComment.class,
      LdbcUpdate7AddCommentHandler.class);
  registerOperationHandler(LdbcUpdate8AddFriendship.class,
      LdbcUpdate8AddFriendshipHandler.class);
}
 
开发者ID:PlatformLab,项目名称:ldbc-snb-impls,代码行数:71,代码来源:Neo4jDb.java

示例5: executeOperation

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

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

  String statement =
      "   MATCH (person:Person {id:{1}})-[:KNOWS*1..2]-(friend:Person)"
      + " WHERE not(person=friend)"
      + " WITH DISTINCT friend"
      + " MATCH (friend)-[worksAt:WORK_AT]->(company:Organisation)-[:IS_LOCATED_IN]->(:Place {name:{3}})"
      + " WHERE worksAt.workFrom < {2}"
      + " RETURN"
      + "   friend.id AS friendId,"
      + "   friend.firstName AS friendFirstName,"
      + "   friend.lastName AS friendLastName,"
      + "   company.name AS companyName,"
      + "   worksAt.workFrom AS workFromYear"
      + " ORDER BY workFromYear ASC, toInt(friendId) ASC, companyName DESC"
      + " LIMIT {4}";
  Value parameters = parameters(
        "1", String.valueOf(operation.personId()), 
        "2", operation.workFromYear(), 
        "3", operation.countryName(),
        "4", operation.limit());

  // Execute the query and get the results.
  List<LdbcQuery11Result> 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 LdbcQuery11Result(
                Long.valueOf(record.get("friendId").asString()),
                record.get("friendFirstName").asString(),
                record.get("friendLastName").asString(),
                record.get("companyName").asString(),
                record.get("workFromYear").asInt()));
      }
    }
  }

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

示例6: onInit

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
protected void onInit(Map<String, String> properties,
    LoggingService loggingService) throws DbException {

  connectionState = new TorcDbConnectionState(properties);

  if (properties.containsKey("txReads")) {
    doTransactionalReads = true;
  }

  /*
   * Register operation handlers with the benchmark.
   */
  registerOperationHandler(LdbcQuery1.class,
      LdbcQuery1Handler.class);
  registerOperationHandler(LdbcQuery2.class,
      LdbcQuery2Handler.class);
  registerOperationHandler(LdbcQuery7.class,
      LdbcQuery7Handler.class);
  registerOperationHandler(LdbcQuery8.class,
      LdbcQuery8Handler.class);
  registerOperationHandler(LdbcQuery10.class,
      LdbcQuery10Handler.class);
  registerOperationHandler(LdbcQuery11.class,
      LdbcQuery11Handler.class);
  registerOperationHandler(LdbcQuery13.class,
      LdbcQuery13Handler.class);

  registerOperationHandler(LdbcShortQuery1PersonProfile.class,
      LdbcShortQuery1PersonProfileHandler.class);
  registerOperationHandler(LdbcShortQuery2PersonPosts.class,
      LdbcShortQuery2PersonPostsHandler.class);
  registerOperationHandler(LdbcShortQuery3PersonFriends.class,
      LdbcShortQuery3PersonFriendsHandler.class);
  registerOperationHandler(LdbcShortQuery4MessageContent.class,
      LdbcShortQuery4MessageContentHandler.class);
  registerOperationHandler(LdbcShortQuery5MessageCreator.class,
      LdbcShortQuery5MessageCreatorHandler.class);
  registerOperationHandler(LdbcShortQuery6MessageForum.class,
      LdbcShortQuery6MessageForumHandler.class);
  registerOperationHandler(LdbcShortQuery7MessageReplies.class,
      LdbcShortQuery7MessageRepliesHandler.class);

  registerOperationHandler(LdbcUpdate1AddPerson.class,
      LdbcUpdate1AddPersonHandler.class);
  registerOperationHandler(LdbcUpdate2AddPostLike.class,
      LdbcUpdate2AddPostLikeHandler.class);
  registerOperationHandler(LdbcUpdate3AddCommentLike.class,
      LdbcUpdate3AddCommentLikeHandler.class);
  registerOperationHandler(LdbcUpdate4AddForum.class,
      LdbcUpdate4AddForumHandler.class);
  registerOperationHandler(LdbcUpdate5AddForumMembership.class,
      LdbcUpdate5AddForumMembershipHandler.class);
  registerOperationHandler(LdbcUpdate6AddPost.class,
      LdbcUpdate6AddPostHandler.class);
  registerOperationHandler(LdbcUpdate7AddComment.class,
      LdbcUpdate7AddCommentHandler.class);
  registerOperationHandler(LdbcUpdate8AddFriendship.class,
      LdbcUpdate8AddFriendshipHandler.class);
}
 
开发者ID:PlatformLab,项目名称:ldbc-snb-impls,代码行数:61,代码来源:TorcDb.java

示例7: executeOperation

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
public void executeOperation(final LdbcQuery11 operation,
    DbConnectionState dbConnectionState,
    ResultReporter resultReporter) throws DbException {
  
  // Parameters of this query
  final long personId = operation.personId();
  final String countryName = operation.countryName();
  final int workFromYear = operation.workFromYear();
  final int limit = operation.limit();

  final UInt128 torcPersonId = 
      new UInt128(TorcEntity.PERSON.idSpace, personId);

  Graph graph = ((TorcDbConnectionState) dbConnectionState).getClient();

  int txAttempts = 0;
  while (txAttempts < MAX_TX_ATTEMPTS) {
    GraphTraversalSource g = graph.traversal();

    List<LdbcQuery11Result> result = new ArrayList<>(limit);

    g.withSideEffect("result", result).V(torcPersonId).as("person")
        .aggregate("done")
        .union(
            out("knows"),
            out("knows").out("knows"))
        .dedup().where(without("done")).as("friend")
        .outE("workAt").has("workFrom", lt(String.valueOf(workFromYear)))
        .as("workAt")
        .inV().as("company")
        .out("isLocatedIn").has("name", countryName)
        .order()
            .by(select("workAt").values("workFrom"), incr)
            .by(select("friend").id())
            .by(select("company").values("name"), decr)
        .limit(limit)
        .project("personId", 
            "personFirstName", 
            "personLastName", 
            "organizationName", 
            "organizationWorkFromYear")
            .by(select("friend").id())
            .by(select("friend").values("firstName"))
            .by(select("friend").values("lastName"))
            .by(select("company").values("name"))
            .by(select("workAt").values("workFrom"))
        .map(t -> new LdbcQuery11Result(
            ((UInt128)t.get().get("personId")).getLowerLong(),
            (String)t.get().get("personFirstName"), 
            (String)t.get().get("personLastName"),
            (String)t.get().get("organizationName"),
            Integer.valueOf((String)t.get().get("organizationWorkFromYear"))))
        .store("result").iterate(); 

    if (doTransactionalReads) {
      try {
        graph.tx().commit();
      } catch (RuntimeException e) {
        txAttempts++;
        continue;
      }
    } else {
      graph.tx().rollback();
    }

    resultReporter.report(result.size(), result, operation);
    break;
  }
}
 
开发者ID:PlatformLab,项目名称:ldbc-snb-impls,代码行数:71,代码来源:TorcDb.java

示例8: getQuery11

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
public String getQuery11(LdbcQuery11 operation) {
	return getSql(QueryType.Query11, 
			operation.personId(), 
			operation.workFromYear(), 
			operation.countryName());
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:7,代码来源:InteractiveQueryStore.java

示例9: getStmtQuery11

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
public PreparedStatement getStmtQuery11(LdbcQuery11 operation, Connection con) {
	return getStmt(QueryType.Query11, con,
			operation.personId(), 
			operation.workFromYear(), 
			operation.countryName());
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:7,代码来源:InteractiveQueryStore.java

示例10: getStatement

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
public PreparedStatement getStatement(Connection con, JdbcDbConnectionStore<InteractiveQueryStore> state, LdbcQuery11 operation) {
	return state.getQueryStore().getStmtQuery11(operation,con);
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:5,代码来源:InteractiveDb.java

示例11: executeOperation

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery11; //导入依赖的package包/类
@Override
public void executeOperation(final LdbcQuery11 operation,TitanFTMDb.BasicDbConnectionState dbConnectionState,ResultReporter resultReporter) throws DbException {
    long person_id = operation.personId();
    String countryName = operation.countryName();
    int year = operation.workFromYear();
    final int limit = operation.limit();

    logger.debug("Query 11 called on Person id: {} with counrty {} and year {}",
            person_id, countryName, year);

    TitanFTMDb.BasicClient client = dbConnectionState.client();
    final Set<Vertex> friends = QueryUtils.getInstance().getFoF(person_id, client);

    GremlinPipeline<Collection<Vertex>, Vertex> gpf = new GremlinPipeline<>(friends);

    Iterable<Row> it = gpf.as("friend")
            .outE("workAt")
            .has("workFrom", Compare.LESS_THAN, year)
            .as("startWork")
            .inV().as("comp").out("isLocatedIn")
            .has("name", countryName)
            .select();

    List<LdbcQuery11Result> result = new ArrayList<>();

    for (Row r : it) {
        Vertex person = (Vertex) r.getColumn(0);
        Edge workAt = (Edge) r.getColumn(1);
        Vertex company = (Vertex) r.getColumn(2);
        LdbcQuery11Result res = new LdbcQuery11Result(client.getVLocalId((Long) person.getId()),
                (String) person.getProperty("firstName"), (String) person.getProperty("lastName")
                , (String) company.getProperty("name"), (Integer) workAt.getProperty("workFrom"));
        result.add(res);
    }

    Collections.sort(result, new Comparator<LdbcQuery11Result>() {
        @Override
        public int compare(LdbcQuery11Result o1, LdbcQuery11Result o2) {
            if (o1.organizationWorkFromYear() == o2.organizationWorkFromYear()) {
                if (o1.personId() == o2.personId())
                    return o2.organizationName().compareTo(o1.organizationName());
                else
                    return Long.compare(o1.personId(), o2.personId());
            } else
                return Integer.compare(o1.organizationWorkFromYear(), o2.organizationWorkFromYear());
        }
    });

    if (result.size() > limit)
        result = result.subList(0, limit);
    resultReporter.report(result.size(), result, operation);
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:53,代码来源:LdbcQuery11Handler.java


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