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


Java LdbcQuery14类代码示例

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


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

示例1: onInit

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

示例3: executeOperation

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery14; //导入依赖的package包/类
@Override
public void executeOperation(final LdbcQuery14 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.LdbcQuery14; //导入依赖的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.LdbcQuery14; //导入依赖的package包/类
@Override
public void executeOperation(LdbcQuery14 operation,
    DbConnectionState dbConnectionState,
    ResultReporter resultReporter) throws DbException {

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

  String statement =
      "   MATCH path = allShortestPaths((person1:Person {id:{1}})-[:KNOWS*..15]-(person2:Person {id:{2}}))"
      + " WITH nodes(path) AS pathNodes"
      + " RETURN"
      + "   extract(n IN pathNodes | n.id) AS pathNodeIds,"
      + "   reduce(weight=0.0, idx IN range(1,size(pathNodes)-1) | extract(prev IN [pathNodes[idx-1]] | extract(curr IN [pathNodes[idx]] | weight + length((curr)<-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]->(:Post)-[:HAS_CREATOR]->(prev))*1.0 + length((prev)<-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]->(:Post)-[:HAS_CREATOR]->(curr))*1.0 + length((prev)-[:HAS_CREATOR]-(:Comment)-[:REPLY_OF]-(:Comment)-[:HAS_CREATOR]-(curr))*0.5) )[0][0]) AS weight"
      + " ORDER BY weight DESC";
  Value parameters = parameters(
        "1", String.valueOf(operation.person1Id()), 
        "2", String.valueOf(operation.person2Id()));

  // Execute the query and get the results.
  List<LdbcQuery14Result> 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();

        List<Long> personIdsInPath = new ArrayList<>();
        if (!record.get("pathNodeIds").isNull()) {
          personIdsInPath = 
              record.get("pathNodeIds").asList((e) -> 
                  Long.valueOf(e.asString()));
        }

        resultList.add(
            new LdbcQuery14Result(
                personIdsInPath,
                record.get("weight").asDouble()));
      }
    }
  }

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

示例6: getQuery14

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery14; //导入依赖的package包/类
public String getQuery14(LdbcQuery14 operation) {
	return getSql(QueryType.Query14, 
			operation.person1Id(),
			operation.person2Id());
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:6,代码来源:InteractiveQueryStore.java

示例7: getStmtQuery14

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery14; //导入依赖的package包/类
public PreparedStatement getStmtQuery14(LdbcQuery14 operation, Connection con) {
	return getStmt(QueryType.Query14, con,
			operation.person1Id(),
			operation.person2Id());
}
 
开发者ID:ldbc,项目名称:ldbc_snb_implementations,代码行数:6,代码来源:InteractiveQueryStore.java

示例8: getStatement

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

示例9: shouldFailValidationWhenDbImplementationIsIncorrect

import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery14; //导入依赖的package包/类
@Test
public void shouldFailValidationWhenDbImplementationIsIncorrect()
        throws DbException, WorkloadException, IOException, DriverConfigurationException
{
    // Given
    LoggingService loggingService = new Log4jLoggingServiceFactory( false ).loggingServiceFor( "Test" );
    long operationCount = 1;
    String dbClassName = DummyLdbcSnbInteractiveDb.class.getName();
    String workloadClassName = LdbcSnbInteractiveWorkload.class.getName();
    ConsoleAndFileDriverConfiguration configuration =
            ConsoleAndFileDriverConfiguration.fromDefaults( dbClassName, workloadClassName, operationCount );

    Map<String,String> paramsMap = LdbcSnbInteractiveWorkloadConfiguration.defaultConfigSF1();
    paramsMap.put( LdbcSnbInteractiveWorkloadConfiguration.PARAMETERS_DIRECTORY,
            TestUtils.getResource( "/snb/interactive/" ).getAbsolutePath() );
    paramsMap.put( LdbcSnbInteractiveWorkloadConfiguration.UPDATES_DIRECTORY,
            TestUtils.getResource( "/snb/interactive/" ).getAbsolutePath() );
    configuration = (ConsoleAndFileDriverConfiguration) configuration.applyArgs( paramsMap );
    configuration = (ConsoleAndFileDriverConfiguration) configuration.applyArgs(
            MapUtils.loadPropertiesToMap( TestUtils.getResource( "/snb/interactive/updateStream.properties" ) )
    );

    Workload workload = new LdbcSnbInteractiveWorkload();
    workload.init( configuration );

    GeneratorFactory gf = new GeneratorFactory( new RandomDataGeneratorFactory( 42l ) );
    List<ValidationParam> correctValidationParamsList =
            Lists.newArrayList( gf.limit( gf.repeating( buildParams().iterator() ), 10000 ) );

    LdbcQuery14 operation14 = DummyLdbcSnbInteractiveOperationInstances.read14();
    List<LdbcQuery14Result> unexpectedResult14 = DummyLdbcSnbInteractiveOperationResultSets.read14Results();
    unexpectedResult14.add( DummyLdbcSnbInteractiveOperationResultInstances.read14Result() );

    ValidationParam unexpectedValidationParam14 = ValidationParam.createTyped( operation14, unexpectedResult14 );
    correctValidationParamsList.add( unexpectedValidationParam14 );

    Iterator<ValidationParam> validationParams = correctValidationParamsList.iterator();
    Db db = new DummyLdbcSnbInteractiveDb();
    db.init(
            new HashMap<String,String>(),
            loggingService,
            workload.operationTypeToClassMapping()
    );
    DbValidator dbValidator = new DbValidator();

    // When
    DbValidationResult validationResult = dbValidator.validate(
            validationParams,
            db,
            correctValidationParamsList.size(),
            workload
    );

    // Then
    System.out.println( validationResult.resultMessage() );
    assertThat( validationResult.isSuccessful(), is( false ) );
}
 
开发者ID:ldbc,项目名称:ldbc_snb_driver,代码行数:58,代码来源:DbValidatorTest.java


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