- @Query("SELECT xpath FROM FragmentEntity WHERE anchor = :anchor AND parentId IS NULL")\r
- List<String> findAllXpathByAnchorAndParentIdIsNull(@Param("anchor") AnchorEntity anchorEntity);\r
-\r
- @Query(value\r
- = "WITH RECURSIVE parent_search AS ("\r
- + " SELECT id, 0 AS depth "\r
- + " FROM fragment "\r
- + " WHERE anchor_id = :anchorId AND xpath IN :xpaths "\r
- + " UNION "\r
- + " SELECT c.id, depth + 1 "\r
- + " FROM fragment c INNER JOIN parent_search p ON c.parent_id = p.id"\r
- + " WHERE depth <= (SELECT CASE WHEN :maxDepth = -1 THEN " + Integer.MAX_VALUE + " ELSE :maxDepth END) "\r
- + ") "\r
- + "SELECT f.id, anchor_id AS anchorId, xpath, f.parent_id AS parentId, CAST(attributes AS TEXT) AS attributes "\r
- + "FROM fragment f INNER JOIN parent_search p ON f.id = p.id",\r
- nativeQuery = true\r
- )\r
- List<FragmentExtract> findExtractsWithDescendants(@Param("anchorId") int anchorId,\r
- @Param("xpaths") Collection<String> xpaths,\r
- @Param("maxDepth") int maxDepth);\r
-\r
- @Query(value = "SELECT id, anchor_id AS anchorId, xpath, parent_id AS parentId,"\r
- + " CAST(attributes AS TEXT) AS attributes"\r
- + " FROM FRAGMENT WHERE xpath ~ :xpathRegex",\r
- nativeQuery = true)\r
- List<FragmentExtract> quickFindWithDescendantsAcrossAnchor(@Param("xpathRegex") String xpathRegex);\r