Navigation Menu

Skip to content

Commit

Permalink
Wrapped the search functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Jan 11, 2012
1 parent 0f99580 commit bb3ba81
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Expand Up @@ -48,6 +48,24 @@ public Set<String> listAllSources() {
return sourceCodes;
}

public Set<String> search(String restService, String query, int limit) throws BioclipseException {
logger.debug("doing stuff...");

// now we connect to the driver and create a IDMapper instance.
IDMapper mapper;
try {
mapper = BridgeDb.connect(restService);
} catch (IDMapperException exception) {
throw new BioclipseException("Could not connect to the REST service at: " + restService);
}

try {
return extractIdentifierStrings(mapper.freeSearch(query, limit));
} catch (IDMapperException exception) {
throw new BioclipseException("Could not search the REST service: " + exception);
}
}

public Set<String> map(String restService, String identifier, String source) throws BioclipseException {
return map(restService, identifier, source, null);
}
Expand Down Expand Up @@ -90,10 +108,13 @@ public Set<String> map(String restService, String identifier, String source, Str
}

// and create a list of found, mapped URNs
Set<String> results = new HashSet<String>();
return extractIdentifierStrings(dests);
}

private Set<String> extractIdentifierStrings(Set<Xref> dests) {
Set<String> results = new HashSet<String>();
for (Xref dest : dests)
results.add(dest.getURN());

return results;
}
return results;
}
}
Expand Up @@ -42,6 +42,13 @@ public interface IBridgedbManager extends IBioclipseManager {
)
public Set<String> map(String restService, String identifier, String source) throws BioclipseException;

@Recorded
@PublishedMethod(
methodSummary="Searches a BridgeDB REST service for the given query string, if the service supports searching.",
params="String restService, String query, int limit"
)
public Set<String> search(String restService, String query, int limit) throws BioclipseException;

@Recorded
@PublishedMethod(
methodSummary="Return a BioDataSource for the given string. It throws a BioclipseException when an" +
Expand Down

0 comments on commit bb3ba81

Please sign in to comment.