org.springframework.data.neo4j.annotation.Query.<init>()方法的使用及代码示例

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

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

Query.<init>介绍

暂无

代码示例

代码示例来源:origin: kbastani/spring-cloud-event-sourcing-example

@Query("MATCH (product:Product),\n" +
      "\t(product)<-[:PRODUCT_TYPE]-(inventory:Inventory)\n" +
      "WHERE product.productId in {productIds} AND NOT (inventory)<-[:CONTAINS_PRODUCT]-()\n" +
      "RETURN inventory")
  List<Inventory> getAvailableInventoryForProductList(@Param("productIds") String[] productIds);
}

代码示例来源:origin: kbastani/spring-cloud-event-sourcing-example

@Query("MATCH (product:Product),\n" +
    "\t(product)<-[:PRODUCT_TYPE]-(inventory:Inventory)\n" +
    "WHERE product.productId = {productId} AND NOT (inventory)<-[:CONTAINS_PRODUCT]-()\n" +
    "RETURN inventory")
List<Inventory> getAvailableInventoryForProduct(@Param("productId") String productId);

代码示例来源:origin: kbastani/spring-cloud-event-sourcing-example

@Query("MATCH (product:Product),\n" +
    "\t(product)<-[:PRODUCT_TYPE]-(inventory:Inventory),\n" +
    "    (inventory)-[:STOCKED_IN]->(:Warehouse { name: \"{warehouseName}\" })\n" +
    "WHERE product.productId = {productId} AND NOT (inventory)<-[:CONTAINS_PRODUCT]-()\n" +
    "RETURN inventory")
List<Inventory> getAvailableInventoryForProductAndWarehouse(@Param("productId") String productId,
                              @Param("warehouseName") String warehouseName);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query(value = 
    "START sourceContent=node({0}) MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "WHERE r.strength > {1} AND r.type = {2} "
    + "RETURN r", 
    countQuery = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "WHERE r.strength > {1} AND r.type = {2} " 
    + "RETURN count(targetContent)")
public Page<SimilarityRelation> getSimilarContents(ContentNode sourceNode, Double minimumStrength, String similarityType, Pageable pageable);

代码示例来源:origin: kbastani/spring-boot-graph-processing-example

@Query("MATCH (user:User) WHERE has(user.pagerank) AND NOT has(user.screenName)\n" +
    "WITH user\n" +
    "ORDER BY user.pagerank DESC\n" +
    "LIMIT 1\n" +
    "RETURN user")
User findRankedUserToCrawl();

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query("START personNode=node({0}) "
    + "MATCH personNode <- [r:identityRelation] - identity "
    + "WHERE {1} in r.versions "
    + "WITH DISTINCT identity "
    + "OPTIONAL MATCH identity - [r:identityRelation] -> (p:personType) "
    + "WHERE NOT has(r.versions) "
    + "WITH DISTINCT identity, count(r) as count "
    + "WHERE count = 0 "
    + "MATCH identity <- [cr:contentContributionRelation] - content "
    + "WHERE content.status <> 'HIDDEN' "
    + "RETURN content.type as type, COUNT(DISTINCT content) as count")
List<Map<String, Object>> countAuthorContributionsByType(PersonNode node, String version);

代码示例来源:origin: opencredo/neo4j-in-action

@Query( value =
    "MATCH (`user`)-[:`referredBy`]->(`user_referredBy`) " +
    "WHERE `user_referredBy`.`name` =~ {0} " +
    "RETURN `user`")
Iterable<User> simulateFindByReferredByNameLikeWhenUsingLabelBasedStrategy(String name);

代码示例来源:origin: opencredo/neo4j-in-action

@Query( value =
    "MATCH (`user`:`User`) " +
    "WHERE `user`.`name` = {0} " +
    "RETURN `user`")
Iterable<User> simulateFindByNameWhenUsingLabelBasedStrategy(String name);

代码示例来源:origin: kbastani/spring-boot-graph-processing-example

/**
 * Initialize the user.lastPageRank value to the current user.pagerank
 */
@Query("MATCH (user:User) WHERE has(user.pagerank) AND has(user.screenName) AND NOT has(user.lastPageRank)\n" +
    "WITH collect(user) as users\n" +
    "FOREACH(x in users | \n" +
    "SET x.lastPageRank = toFloat(x.pagerank))")
void setLastPageRank();

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query("START contentNode=node({0}) "
    + "MATCH contentNode - [:contentContributionRelation] -> (idNode:identityType) "
    + "MATCH idNode - [idRel:identityRelation] -> (person:personType) "
    + "WHERE NOT has(idRel.versions) OR {1} in idRel.versions "
    + "RETURN DISTINCT person")
Iterable<PersonNode> findContentPersons(ContentNode node, String version);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query(value = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] -> targetContent "
    + "WHERE r.type = {1} " + 
    "RETURN r", 
    countQuery = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] -> targetContent "
    + "WHERE r.type = {1} "
    + "RETURN count(targetContent)")
public Page<SimilarityRelation> getSimilarContents(ContentNode sourceNode, String similarityType, Pageable pageable);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query(value = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "WHERE r.strength > {1}"
    + "RETURN r", 
    countQuery = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "WHERE r.strength > {1}"
    + "RETURN count(targetContent)")
public Page<SimilarityRelation> getSimilarContents(ContentNode sourceNode, Double minimumStrength, Pageable pageable);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query(value = "MATCH (cited:contentType) <- [c:citationRelation] - (target:citationType)"
    + " <- [ref:referenceRelation] - (source:contentType)" 
    + " WHERE {0} in c.types" 
    + " WITH cited, count(distinct source) as count"
    + " RETURN count, cited.id as id", 
    countQuery="MATCH (cited:contentType) <- [c:citationRelation] - (target:citationType)"
    + " <- [ref:referenceRelation] - (source:contentType)" 
    + " WHERE {0} in c.types" 
    + " WITH cited, count(distinct source) as count"
    + " RETURN count(cited)",
    elementClass = Citation.class)
public Page<Citation> getMostCitedPublications(String citationType, Pageable pageable);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query("START sourcePerson=node({0}) " + 
    "MATCH sourcePerson -[toIdentity:identityRelation] - identity " +
    "MATCH identity -[toPerson:identityRelation] - targetPerson " +
    "WHERE {1} IN toPerson.versions " + 
    "RETURN targetPerson LIMIT 1")
PersonNode findCurrentPerson(PersonNode sourceNode, String requiredVersion);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query("START userNode=node({0}) "
    + "MATCH userNode <- [r:identityRelation] - identity "
    + "WHERE NOT has(r.versions) "
    + "MATCH identity <- [cr:contentContributionRelation] - content "
    + "WHERE content.status <> 'HIDDEN'"
    + "RETURN content.type as type, COUNT(DISTINCT content) as count")
List<Map<String, Object>> countUserContributionsByType(UserNode node);

代码示例来源:origin: pl.edu.icm.synat/synat-neo4j-graph-impl

@Query(value = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "RETURN r", 
    countQuery = 
    "START sourceContent=node({0}) "
    + "MATCH sourceContent - [r:similarityRelation] - targetContent "
    + "RETURN count(targetContent)")
public Page<SimilarityRelation> getSimilarContents(ContentNode sourceNode, Pageable pageable);

代码示例来源:origin: kbastani/spring-boot-graph-processing-example

@Query("MATCH (a:User)<-[r:FOLLOWS]-(b)\n" +
    "WHERE NOT has(a.screenName)\n" +
    "WITH a, count(r) as weight\n" +
    "WHERE weight > 2\n" +
    "WITH a, weight\n" +
    "ORDER BY weight DESC\n" +
    "LIMIT 1\n" +
    "WITH a\n" +
    "RETURN a")
User findNextUserToCrawl();

代码示例来源:origin: chaokunyang/microservices-event-sourcing

/**
 * Inventory到Product关系为:PRODUCT_TYPE
 * Shipment到Inventory关系为:CONTAINS_PRODUCT
 * @param productId
 * @return
 */
@Query("MATCH (product:Product)<-[:PRODUCT_TYPE]-(inventory:Inventory) WHERE product.productId = {productId} AND NOT (inventory)<-[:CONTAINS_PRODUCT]-() RETURN inventory")
List<Inventory> getAvailableInventory(@Param("productId") String productId);

代码示例来源:origin: kbastani/spring-boot-graph-processing-example

/**
   * Efficiently batches the creation of many FOLLOWS relationships
   * between {@link User} nodes
   *
   * @param follows a set of relationship entities containing a user "A" who follows a user "B"
   */
  @Query("FOREACH(x in {follows} | MERGE (a:User { profileId: x.userA.profileId })\n" +
      "MERGE (b:User { profileId: x.userB.profileId })\n" +
      "MERGE (a)-[:FOLLOWS]->(b))")
  void saveFollows(@Param("follows") Set<Follows> follows);
}

代码示例来源:origin: kbastani/spring-boot-graph-processing-example

@Query("MATCH (user:User) WHERE has(user.pagerank) AND has(user.screenName) AND coalesce(user.imported, false) = true\n" +
    "WITH user\n" +
    "ORDER BY user.pagerank DESC\n" +
    "SKIP {skip}\n" +
    "LIMIT {limit}\n" +
    "RETURN user")
Set<User> findRankedUsers(@Param("skip") Integer skip, @Param("limit") Integer limit);

相关文章