@@ -46,7 +46,7 @@ public Controller(SifgraphProperties properties) {
4646 }
4747
4848 @ PostConstruct
49- void init () throws IOException {
49+ protected void init () throws IOException {
5050 final EdgeAnnotationType [] annotationTypes = props .getAnnotations ();
5151 sifWriter = new org .pathwaycommons .sif .io .Writer (false , annotationTypes );
5252 InputStream is = new GZIPInputStream (resourceLoader .getResource (props .getData ()).getInputStream ());
@@ -69,21 +69,17 @@ public String nhood(
6969 @ ApiParam ("Set of gene identifiers (HGNC Symbol) - 'seeds' for the graph traversal algorithm." )
7070 @ RequestParam (required = true ) String [] source ,
7171 @ ApiParam ("Filter by binary relationship (SIF edge) type(s)" )
72- @ RequestParam (required = false ) RelationTypeEnum [] pattern
73- ) {
72+ @ RequestParam (required = false ) RelationTypeEnum [] pattern ) throws IOException
73+ {
7474 Set <String > sources = new HashSet ();
7575 for (String s : source )
7676 sources .add (s );
7777
78- pattern = (pattern != null && pattern .length > 0 ) ? pattern : DEFAULT_RELS ;
79- try {
80- Set <Object > result = QueryExecutor .searchNeighborhood (graph ,
81- new RelationTypeSelector (pattern ), sources , direction , limit );
78+ Set <Object > result = QueryExecutor .searchNeighborhood (graph ,
79+ new RelationTypeSelector ((pattern !=null && pattern .length >0 )?pattern :DEFAULT_RELS ),
80+ sources , direction , limit );
8281
83- return write (result );
84- } catch (Exception e ) {
85- throw new RuntimeException ("/neighborhood failed: " + e );
86- }
82+ return write (result );
8783 }
8884
8985 @ RequestMapping (path = "/pathsbetween" )
@@ -100,21 +96,17 @@ public String pathsbetween(
10096 @ ApiParam ("A set of gene identifiers." )
10197 @ RequestParam (required = true ) String [] source ,
10298 @ ApiParam ("Filter by binary relationship (SIF edge) type(s)" )
103- @ RequestParam (required = false ) RelationTypeEnum [] pattern
104- ) {
99+ @ RequestParam (required = false ) RelationTypeEnum [] pattern ) throws IOException
100+ {
105101 Set <String > sources = new HashSet ();
106102 for (String s : source )
107103 sources .add (s );
108104
109- try {
110- Set <Object > result = QueryExecutor .searchPathsBetween (graph ,
111- new RelationTypeSelector ((pattern != null && pattern .length > 0 ) ? pattern : DEFAULT_RELS ),
112- sources , directed , limit );
105+ Set <Object > result = QueryExecutor .searchPathsBetween (graph ,
106+ new RelationTypeSelector ((pattern !=null && pattern .length >0 )?pattern :DEFAULT_RELS ),
107+ sources , directed , limit );
113108
114- return write (result );
115- } catch (Exception e ) {
116- throw new RuntimeException ("/pathsbetween failed: " + e );
117- }
109+ return write (result );
118110 }
119111
120112 @ RequestMapping (path = "/commonstream" )
@@ -131,20 +123,16 @@ public String commonstream(
131123 @ ApiParam ("A set of gene identifiers." )
132124 @ RequestParam (required = true ) String [] source ,
133125 @ ApiParam ("Filter by binary relationship (SIF edge) type(s)" )
134- @ RequestParam (required = false ) RelationTypeEnum [] pattern
135- ) {
126+ @ RequestParam (required = false ) RelationTypeEnum [] pattern ) throws IOException
127+ {
136128 Set <String > sources = new HashSet ();
137129 for (String s : source ) sources .add (s );
138130
139- try {
140- Set <Object > result = QueryExecutor .searchCommonStream (graph ,
141- new RelationTypeSelector ((pattern != null && pattern .length > 0 ) ? pattern : DEFAULT_RELS ),
142- sources , direction , limit );
131+ Set <Object > result = QueryExecutor .searchCommonStream (graph ,
132+ new RelationTypeSelector ((pattern !=null && pattern .length >0 )?pattern :DEFAULT_RELS ),
133+ sources , direction , limit );
143134
144- return write (result );
145- } catch (Exception e ) {
146- throw new RuntimeException ("/commonstream failed: " + e );
147- }
135+ return write (result );
148136 }
149137
150138 @ RequestMapping (path = "/pathsfromto" )
@@ -161,23 +149,19 @@ public String pathsfromto(
161149 @ ApiParam ("A target set of gene identifiers." )
162150 @ RequestParam (required = true ) String [] target ,
163151 @ ApiParam ("Filter by binary relationship (SIF edge) type(s)" )
164- @ RequestParam (required = false ) RelationTypeEnum [] pattern
165- ) {
152+ @ RequestParam (required = false ) RelationTypeEnum [] pattern ) throws IOException
153+ {
166154 Set <String > sources = new HashSet ();
167155 for (String s : source ) sources .add (s );
168156
169157 Set <String > targets = new HashSet ();
170158 for (String s : target ) targets .add (s );
171159
172- try {
173- Set <Object > result = QueryExecutor .searchPathsFromTo (graph ,
174- new RelationTypeSelector ((pattern != null && pattern .length > 0 ) ? pattern : DEFAULT_RELS ),
175- sources , targets , limit );
160+ Set <Object > result = QueryExecutor .searchPathsFromTo (graph ,
161+ new RelationTypeSelector ((pattern !=null && pattern .length >0 ) ? pattern :DEFAULT_RELS ),
162+ sources , targets , limit );
176163
177- return write (result );
178- } catch (Exception e ) {
179- throw new RuntimeException ("/pathsfromto failed: " + e );
180- }
164+ return write (result );
181165 }
182166
183167 private String write (Set <Object > result ) throws IOException {
0 commit comments