本文整理匯總了Java中com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery10Result類的典型用法代碼示例。如果您正苦於以下問題:Java LdbcQuery10Result類的具體用法?Java LdbcQuery10Result怎麽用?Java LdbcQuery10Result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LdbcQuery10Result類屬於com.ldbc.driver.workloads.ldbc.snb.interactive包,在下文中一共展示了LdbcQuery10Result類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: executeOperation
import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery10Result; //導入依賴的package包/類
@Override
public void executeOperation(LdbcQuery10 operation,
DbConnectionState dbConnectionState,
ResultReporter resultReporter) throws DbException {
Driver driver = ((Neo4jDbConnectionState) dbConnectionState).getDriver();
String statement =
" MATCH (person:Person {id:{1}})-[:KNOWS*2..2]-(friend:Person)-[:IS_LOCATED_IN]->(city:Place)"
+ " WHERE "
+ " ((friend.birthday_month = {2} AND friend.birthday_day >= 21) OR"
+ " (friend.birthday_month = ({2}%12)+1 AND friend.birthday_day < 22))"
+ " AND not(friend=person)"
+ " AND not((friend)-[:KNOWS]-(person))"
+ " WITH DISTINCT friend, city, person"
+ " OPTIONAL MATCH (friend)<-[:HAS_CREATOR]-(post:Post)"
+ " WITH friend, city, collect(post) AS posts, person"
+ " WITH "
+ " friend,"
+ " city,"
+ " length(posts) AS postCount,"
+ " length([p IN posts WHERE (p)-[:HAS_TAG]->(:Tag)<-[:HAS_INTEREST]-(person)]) AS commonPostCount"
+ " RETURN"
+ " friend.id AS personId,"
+ " friend.firstName AS personFirstName,"
+ " friend.lastName AS personLastName,"
+ " friend.gender AS personGender,"
+ " city.name AS personCityName,"
+ " commonPostCount - (postCount - commonPostCount) AS commonInterestScore"
+ " ORDER BY commonInterestScore DESC, toInt(personId) ASC"
+ " LIMIT {3}";
Value parameters = parameters(
"1", String.valueOf(operation.personId()),
"2", operation.month(),
"3", operation.limit());
// Execute the query and get the results.
List<LdbcQuery10Result> 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 LdbcQuery10Result(
Long.valueOf(record.get("personId").asString()),
record.get("personFirstName").asString(),
record.get("personLastName").asString(),
record.get("commonInterestScore").asInt(),
record.get("personGender").asString(),
record.get("personCityName").asString()));
}
}
}
resultReporter.report(0, resultList, operation);
}
示例2: convertSingleResult
import com.ldbc.driver.workloads.ldbc.snb.interactive.LdbcQuery10Result; //導入依賴的package包/類
@Override
public LdbcQuery10Result convertSingleResult(ResultSet result) throws SQLException {
return new LdbcQuery10Result(
result.getLong(1),
result.getString(2),
result.getString(3),
result.getInt(4),
result.getString(5),
result.getString(6));
}