Class CvParameterLookupService


  • public class CvParameterLookupService
    extends Object
    Abstraction over OLSClient to autoconvert Terms to Parameters and to allow easy matching of Parameters against parent terms and their children.
    Author:
    nilshoffmann
    • Constructor Detail

      • CvParameterLookupService

        public CvParameterLookupService()
        Create a new instance of the lookup service with default OLS configuration.
      • CvParameterLookupService

        public CvParameterLookupService​(uk.ac.ebi.pride.utilities.ols.web.service.client.OLSClient client)
        Create a new instance of the lookup service with a custom OLSClient.
        Parameters:
        client - the custom OLS client
      • CvParameterLookupService

        public CvParameterLookupService​(uk.ac.ebi.pride.utilities.ols.web.service.config.OLSWsConfig config)
        Create a new instance of the lookup service with a custom OLSWsConfig configuration.
        Parameters:
        config - the custom configuration
    • Method Detail

      • clearCaches

        public void clearCaches()
        Clears all query result caches (parent and child).
      • resolveParents

        public List<ParameterresolveParents​(Parameter parameter)
                                       throws org.springframework.web.client.HttpClientErrorException
        Resolve all parents of parameter up to an arbitrary depth (actually height, since we go from bottom to top). Use at your own risk, the OLS service may terminate your connection if the response is too large or takes too long.
        Parameters:
        parameter - the parameter to start from
        Returns:
        a list of all parent parameters for the given parameter
        Throws:
        org.springframework.web.client.HttpClientErrorException - on http related errors
      • resolveParents

        public List<ParameterresolveParents​(Parameter parameter,
                                              int levels)
                                       throws org.springframework.web.client.HttpClientErrorException
        Resolve all parents of a parameter up to a given maximum depth (1 meaning the immediate parents, -1 meaning all).
        Parameters:
        parameter - the parameter to start from
        levels - maximum levels to query
        Returns:
        a list of all parent parameters for the given parameter
        Throws:
        org.springframework.web.client.HttpClientErrorException - on http related errors
      • resolveChildren

        public List<ParameterresolveChildren​(Parameter parameter,
                                               int levels)
                                        throws org.springframework.web.client.HttpClientErrorException
        Resolve all children of a parameter up to a given maximum depth (1 meaning immediate children, -1 meaning all).
        Parameters:
        parameter - the parameter to start from
        levels - maximum levels to query
        Returns:
        a list of all child parameters for the given parameter
        Throws:
        org.springframework.web.client.HttpClientErrorException - on http related errors
      • resolveChildren

        public List<ParameterresolveChildren​(Parameter parameter)
                                        throws org.springframework.web.client.HttpClientErrorException
        Resolve all children of a parameter up to an arbitrary depth. Use at your own risk, the OLS service may terminate your connection if the response is too large or takes too long.
        Parameters:
        parameter - the parameter to start from
        Returns:
        a list of all child parameters for the given parameter
        Throws:
        org.springframework.web.client.HttpClientErrorException - on http related errors
      • isChildOfOrSame

        public ParameterComparisonResult isChildOfOrSame​(Parameter parent,
                                                         Parameter potentialChild)
                                                  throws org.springframework.web.client.HttpClientErrorException
        Compares two parameters for their parent to child relationship. The result can be one of: IDENTICAL, if parent and potential child are the same node, CHILD_OF, if potentialChild is a child of parent (at least 1 level away), or NOT_RELATED, if there is no path from child to parent.
        Parameters:
        parent - the parent term to start from
        potentialChild - the potential child term to check against parent
        Returns:
        the comparison result
        Throws:
        org.springframework.web.client.HttpClientErrorException - on http related errors