-\r
- @Query(value =\r
- "SELECT * FROM FRAGMENT WHERE (anchor_id = :anchor) AND (xpath = (:xpath) OR xpath LIKE "\r
- + "CONCAT(:xpath,'\\[@%]')) AND attributes @> jsonb_build_object(:leafName , :leafValue)",\r
- nativeQuery = true)\r
- // Above query will match an xpath with or without the index for a list [@key=value] and match anchor id,\r
- // leaf name and leaf value\r
- List<FragmentEntity> getByAnchorAndXpathAndLeafAttributes(@Param("anchor") int anchorId, @Param("xpath")\r
- String xpathPrefix, @Param("leafName") String leafName, @Param("leafValue") Object leafValue);\r
-\r
- @Query(value = "SELECT * FROM FRAGMENT WHERE anchor_id = :anchor AND xpath LIKE CONCAT('%/',:descendantName)",\r
- nativeQuery = true)\r
- // Above query will match the anchor id and last descendant name\r
- List<FragmentEntity> getByAnchorAndXpathEndsInDescendantName(@Param("anchor") int anchorId,\r
- @Param("descendantName") String descendantName);\r
-\r
- @Query(value = "SELECT * FROM FRAGMENT WHERE anchor_id = :anchor AND (xpath LIKE CONCAT('%/',:descendantName) OR "\r
- + "xpath LIKE CONCAT('%/', :descendantName,'\\[@%]')) AND attributes @> :leafDataAsJson\\:\\:jsonb",\r
- nativeQuery = true)\r
- // Above query will match the anchor id, last descendant name and all parameters passed into leafDataASJson with the\r
- // attribute values of the requested data node eg: {"leaf_name":"value", "another_leaf_name":"another value"}\r
- List<FragmentEntity> getByAnchorAndDescendentNameAndLeafValues(@Param("anchor") int anchorId,\r
- @Param("descendantName") String descendantName, @Param("leafDataAsJson") String leafDataAsJson);\r