| 178 | | String parameters) { |
|---|
| 179 | | // TODO Auto-generated method stub |
|---|
| 180 | | return null; |
|---|
| | 182 | String parameters) throws ObjectStoreException, PathException { |
|---|
| | 183 | |
|---|
| | 184 | PathQuery q = new PathQuery(model); |
|---|
| | 185 | List<Path> view = PathQueryResultHelper.getDefaultView(type, model, webConfig, |
|---|
| | 186 | "Gene.homologues.homologue", false); |
|---|
| | 187 | view = getFixedView(view); |
|---|
| | 188 | q.setViewPaths(view); |
|---|
| | 189 | |
|---|
| | 190 | List<InterMineObject> objectList = im.getObjectStore().getObjectsByIds(fromList); |
|---|
| | 191 | |
|---|
| | 192 | // gene |
|---|
| | 193 | q.addConstraint("Gene", Constraints.in(objectList)); |
|---|
| | 194 | |
|---|
| | 195 | // organism |
|---|
| | 196 | q.addConstraint("Gene.homologues.homologue.organism", Constraints.lookup(parameters)); |
|---|
| | 197 | |
|---|
| | 198 | // homologue.type = "orthologue" |
|---|
| | 199 | q.addConstraint("Gene.homologues.type", Constraints.eq("orthologue")); |
|---|
| | 200 | |
|---|
| | 201 | q.setConstraintLogic("A and B and C"); |
|---|
| | 202 | q.syncLogicExpression("and"); |
|---|
| | 203 | WebResultsExecutor executor = im.getWebResultsExecutor(profile); |
|---|
| | 204 | |
|---|
| | 205 | return executor.execute(q); |
|---|
| | 206 | } |
|---|
| | 207 | |
|---|
| | 208 | /** |
|---|
| | 209 | *If view contains joined organism, this will make sure, that |
|---|
| | 210 | * organism is joined as a inner join. Else constraint on organism doesn't work. |
|---|
| | 211 | * @param pathQuery |
|---|
| | 212 | * @param joinPath |
|---|
| | 213 | * @throws PathException |
|---|
| | 214 | * */ |
|---|
| | 215 | private List<Path> getFixedView(List<Path> view) throws PathException { |
|---|
| | 216 | String invalidPath = "Gene.homologues.homologue:organism"; |
|---|
| | 217 | String validPath = "Gene.homologues.homologue.organism"; |
|---|
| | 218 | List<Path> ret = new ArrayList<Path>(); |
|---|
| | 219 | for (Path path : view) { |
|---|
| | 220 | if (path.toString().contains(invalidPath)) { |
|---|
| | 221 | String newPathString = path.toString().replace(invalidPath, validPath); |
|---|
| | 222 | path = new Path(path.getModel(), newPathString); |
|---|
| | 223 | } |
|---|
| | 224 | ret.add(path); |
|---|
| | 225 | } |
|---|
| | 226 | return ret; |
|---|