Class ListService


  • public class ListService
    extends Service
    An interface to all the resources that represent list information and list operations available at an InterMine implementation. Normally the user should obtain an instance of this class through the ServiceFactory class. Any authentication provided to that parent class will be used in all requests that need authentication by the ListService. The services provided include:
    • Getting information about the available lists
    • Getting information about which lists an item is in
    • Creating new lists
    • Modifying lists by adding items to them
    • Creating new lists from set operations between existing lists
    • Renaming lists
    • Deleting lists
    • Constructor Detail

      • ListService

        public ListService​(java.lang.String rootUrl,
                           java.lang.String applicationName)
        Use ServiceFactory instead of constructor for creating this service .
        Parameters:
        rootUrl - root URL
        applicationName - application name
    • Method Detail

      • getListsWithObject

        public java.util.List<ItemList> getListsWithObject​(java.lang.String publicId,
                                                           java.lang.String type)
        Returns all accessible InterMine lists containing the object corresponding to the specified publicId.
        Parameters:
        publicId - An identifier of the object of interest. An object can have different identifiers in different public databases. If there is an object with one of these as a property, the webservice will resolve the given id to that object.
        type - the type of Object. Must be a valid name of a class in the service's data-model (eg: "Gene")
        Returns:
        A list of ItemList objects that represent lists containing the given object.
      • getListsWithObject

        public java.util.List<ItemList> getListsWithObject​(int id)
        Returns all accessible InterMine public lists containing the object with the specified DB identifier.
        Parameters:
        id - The internal DB identifier. This value changes between releases, so this method is only reliable for fetching data when the id has been fetched immediately before the request.
        Returns:
        A list of ItemList objects that represent lists containing the given object.
      • getListMap

        public java.util.Map<java.lang.String,​ItemList> getListMap()
        Returns a map from list-name to list. This method retrieves all accessible lists and returns them as a map, with each list accessible via its name. getAccessibleLists() getList(String)
        Returns:
        A map of all accessible lists, with the lists accessible by name.
      • getList

        public ItemList getList​(java.lang.String name)
        Returns an object representing a list on the server. getListMap() getAccessibleLists()
        Parameters:
        name - the name of the list to retrieve.
        Returns:
        The list, or null if it does not exist.
      • getAccessibleLists

        public java.util.List<ItemList> getAccessibleLists()
        Returns all the lists that this service has access to. Note that the return value of this method will differ depending on the authentication credentials supplied, as each user only has access to their own list, and those that are publicly available. getListMap() getList(String)
        Returns:
        A list of all accessible lists.
      • createList

        public ItemList createList​(ListService.ListCreationInfo info)
        Create a new list on the server by specifying its content. This method abstracts a couple of different REST calls that create lists based on a specification of content. Content may be given as a set of identifiers to resolve into objects, or as a query to collect as a result set. These parameters, and others are bundled into the ListCreationInfo parameter.
        Parameters:
        info - The bundle of options that defines what content the new list will have.
        Returns:
        A new list.
      • append

        public ItemList append​(ItemList list,
                               java.lang.String... ids)
        Append some objects corresponding to identifiers to the given list, returning a list representing the new state. Use ItemList.append(String...)
        Parameters:
        list - The list to append the new items to.
        ids - The ids to append to the list.
        Returns:
        A list object representing the new state.
      • append

        public ItemList append​(ItemList list,
                               java.util.Collection<? extends java.lang.String> ids)
        Append some objects corresponding to identifiers to the given list, returning a list representing the new state. Use ItemList.append(Collection)
        Parameters:
        list - The list to append the new items to.
        ids - The identifiers of the objects to append to the list.
        Returns:
        A list object representing the new state.
      • append

        public ItemList append​(ItemList list,
                               org.intermine.pathquery.PathQuery query)
        Append the objects contained in the result set of a given query to the given list, returning a list representing the new state. The query must have a single output column (that of the id of the objects to add) and that column must be on an object of a compatible type to the list it is being appended to. Note that this is the most efficient method of appending to a list from a query's result set. Use ItemList.append(PathQuery)
        Parameters:
        list - The list to append the new items to.
        query - The query to run to find objects for the list.
        Returns:
        A list object representing the new state.
      • deleteList

        public void deleteList​(ItemList delendum)
        Deletes a list on the server. After being deleted, any query or operation that uses this list will throw an exception.
        Parameters:
        delendum - The list to delete.
      • merge

        public ItemList merge​(ItemList... lists)
        Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.
        Parameters:
        lists - The lists to merge.
        Returns:
        A new list
      • merge

        public ItemList merge​(ListService.ListOperationInfo info,
                              ItemList... lists)
        Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to merge.
        Returns:
        A new list
      • merge

        public ItemList merge​(java.util.Collection<ItemList> lists)
        Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.
        Parameters:
        lists - The lists to merge.
        Returns:
        A new list
      • merge

        public ItemList merge​(ListService.ListOperationInfo info,
                              java.util.Collection<ItemList> lists)
        Merge one or more lists into a new list. This operation is the equivalent of the set 'union' operation.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to merge.
        Returns:
        A new list
      • intersect

        public ItemList intersect​(ItemList... lists)
        Intersect one or more lists to produce a new list.
        Parameters:
        lists - The lists to intersect.
        Returns:
        A new list
      • intersect

        public ItemList intersect​(ListService.ListOperationInfo info,
                                  ItemList... lists)
        Intersect one or more lists to produce a new list.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to intersect.
        Returns:
        A new list
      • intersect

        public ItemList intersect​(java.util.Collection<ItemList> lists)
        Intersect one or more lists to produce a new list.
        Parameters:
        lists - The lists to intersect.
        Returns:
        A new list
      • intersect

        public ItemList intersect​(ListService.ListOperationInfo info,
                                  java.util.Collection<ItemList> lists)
        Intersect one or more lists to produce a new list.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to intersect.
        Returns:
        A new list
      • diff

        public ItemList diff​(ItemList... lists)
        Find the symmetric difference of one or more lists to produce a new list.
        Parameters:
        lists - The lists to find the symmetric difference of.
        Returns:
        A new list
      • diff

        public ItemList diff​(ListService.ListOperationInfo info,
                             ItemList... lists)
        Find the symmetric difference of one or more lists to produce a new list.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to find the symmetric difference of.
        Returns:
        A new list
      • diff

        public ItemList diff​(java.util.Collection<ItemList> lists)
        Find the symmetric difference of one or more lists to produce a new list.
        Parameters:
        lists - The lists to find the symmetric difference of.
        Returns:
        A new list
      • diff

        public ItemList diff​(ListService.ListOperationInfo info,
                             java.util.Collection<ItemList> lists)
        Find the symmetric difference of one or more lists to produce a new list.
        Parameters:
        info - The parameter bundle specifying the details of the new list.
        lists - The lists to find the symmetric difference of.
        Returns:
        A new list
      • subtract

        public ItemList subtract​(ItemList from,
                                 ItemList... lists)
        Subtract some lists from some other lists to produce a new list. ItemList.subtract(ItemList...)
        Parameters:
        from - The list to subtract items from.
        lists - The lists to subtract.
        Returns:
        A new list
      • subtract

        public ItemList subtract​(ItemList[] from,
                                 ItemList... lists)
        Subtract some lists from some other lists to produce a new list. ItemList.subtract(ItemList...)
        Parameters:
        from - The lists to subtract items from.
        lists - The lists to subtract.
        Returns:
        A new list
      • subtract

        public ItemList subtract​(java.util.Collection<ItemList> from,
                                 java.util.Collection<ItemList> lists)
        Subtract some lists from some other lists to produce a new list. ItemList.subtract(Collection)
        Parameters:
        from - The lists to subtract items from.
        lists - The lists to subtract.
        Returns:
        A new list
      • rename

        public ItemList rename​(ItemList list,
                               java.lang.String newName)
        Rename a list on the server, returning a list representing the new state. Use ItemList.rename(String)
        Parameters:
        list - The list to rename.
        newName - The new name to give it.
        Returns:
        A list object representing the new state.
      • contains

        public boolean contains​(ItemList list,
                                Item... items)
        Report whether the given list contains all the items in the supplied array.
        Parameters:
        list - The list supposed to contain the items.
        items - The items supposed to belong to the list
        Returns:
        Whether or not all the items are members of this list.
      • getTags

        public java.util.List<java.lang.String> getTags​(ItemList itemList)
        Get the most current tag set for a list.
        Parameters:
        itemList - The list to get tags for.
        Returns:
        A list of tags.
      • addTags

        public java.util.List<java.lang.String> addTags​(ItemList itemList,
                                                        java.lang.String... newTags)
        Get the tags for a list after adding some to the tag set.
        Parameters:
        itemList - The list to add to.
        newTags - The new tags to add.
        Returns:
        The current list of tags.
      • removeTags

        public java.util.List<java.lang.String> removeTags​(ItemList itemList,
                                                           java.lang.String... removeThese)
        Get the tags for a list after removing some from its tag set.
        Parameters:
        itemList - The list to remove from.
        removeThese - The tags to remove.
        Returns:
        The current list of tags.