Skip to content

Anntopia and NIF Connector

paolociccarese edited this page Oct 31, 2014 · 1 revision

Until now I’ve implemented the Annotopia staff in DomeoClient as separate packages so that I could preserve the old code.

NIF Manager

If you consider the connector to the NIF, in the NifManager.java code we have a method selectConnector() that presented the following code.

public boolean selectConnector(IDomeo domeo) {
	if(_connector!=null) return true;
	_domeo = domeo;
	if(domeo.isStandaloneMode()) {
		_connector = new StandaloneNifConnector();
	} else {
		if(domeo.isAnnotopiaEnabled()) {
			_connector = new AnnotopiaNifConnector(domeo, null);
		} else if (domeo.isHostedMode()) {
			_connector = new StandaloneNifConnector();
		} else {
			// Real service
			_connector = new NifJsonConnector(domeo);
		}
	}
	domeo.getLogger().debug(this, "Nif Connector selected: " + _connector.getClass().getName());	
	return false;
} 

Therefore if the domeo.isAnnotopiaEnabled() is true the AnnotopiaNifConnector.java gets injected. The AnnotopiaNifConnector contains all the implementations for terms search and text mining.

AnnotopiaNifConnector

The AnnotopiaNifConnector.java is responsible for connecting to the Annotopia NIF connector for either terms search and text mining.

Annotator

The NIF Annotator has been integrated through the code in the method:

public void annotate(final ITextminingRequestCompleted completionCallback, final String url,
	final String textContent, final String includeCat, final String excludeCat,
	final int minLength, final boolean longestOnly, final boolean includeAbbrev, 
	final boolean includeAcronym, final boolean includeNumbers)
	throws IllegalArgumentException {

TODO (Tom) Data search

Keeping AnnotopiaBioPortalConnector.java as a reference, look at NifJsonConnector.java and understand how to port the code in the method (line 150):

public void searchData(final INifDataRequestCompleted completionCallback,
	String textQuery, String type, String vendor, String resource, int pageNumber, int pageSize)
	throws IllegalArgumentException {

NIF allows for different data searches. In fact, if you look at the code, there are conditional blocks that act differently according to the value of resource.

TODO: Strings should be externalized into static variables.

  1. For Antibodies search
   resource.equals("nif-0000-07730-1")

Note that this search has parameters such as type and vendor that will need to be passed over to Anntopia in the parametrization.

  1. For Organizations and Integrated Animals:
   resource.equals("nlx_144509-1") || resource.equals("nif-0000-08137-1")

Antibodies Search Widget

The search for Antibodies is performed in AntibodiesSearchWidget.java:

   public void performSearch(String typeQuery, String textQuery, String vendor)

The method refers to the selected Nif Connector (for instance the AnnotopiaNifConnector).