package org.pdxfinder.repositories;

import org.pdxfinder.dao.PdxPassage;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface PdxPassageRepository extends Neo4jRepository<PdxPassage, Long> {


    @Query("MATCH (p:PdxPassage),(s:ModelCreation) WHERE (p)-[:PASSAGED_FROM]-(s) and p.passage={passage} and s.sourcePdxId = {modelId} RETURN p")
    PdxPassage findByPassageAndModelId(@Param("passage") String passage, @Param("modelId")String modelId);

}

@@ -415,74 +415,126 @@
 CH (
-p:PdxPassage),(s:ModelCreation) WHERE (p)-%5B:PASSAGED_FROM%5D-(s) and
+s:Sample)--(mod:ModelCreation)--(p:PdxPassage) %22 +%0A            %22WHERE s.dataSource = %7BdataSource%7D %22 +%0A            %22AND
  p.p
@@ -539,17 +539,19 @@
 .passage
-=
+ = 
 %7Bpassage
@@ -556,13 +556,32 @@
 ge%7D 
-and s
+%22 +%0A            %22AND mod
 .sou
@@ -650,16 +650,29 @@
 dModelId
+AndDataSource
 (@Param(
@@ -682,22 +682,19 @@
 ssage%22) 
-Str
 in
-g
+t
  passage
@@ -730,10 +730,51 @@
 elId
+, @Param(%22dataSource%22) String dataSource
 );%0A%0A
+%0A
 %7D%0A

Add find method by passage, datasource and model Id