Class BagHelper


  • public final class BagHelper
    extends java.lang.Object
    Helper methods for bags.
    Author:
    Kim Rutherford
    • Field Detail

      • BAG_NAME_PREFIX

        public static final java.lang.String BAG_NAME_PREFIX
        When generating new bag names, this is used as a prefix.
        See Also:
        Constant Field Values
    • Method Detail

      • createBagFromPathQuery

        public static InterMineBag createBagFromPathQuery​(PathQuery query,
                                                          java.lang.String bagName,
                                                          java.lang.String bagDescription,
                                                          java.lang.String pathString,
                                                          Profile profile,
                                                          InterMineAPI im)
                                                   throws ObjectStoreException
        Create a bag for the given profile and bag name from a PathQuery. The PathQuery must select only the id field from the type the bag is to be created from or else provide a path. The name will be made unique with "_n" if it already exists in the profile.
        Parameters:
        query - the query to create the bag from
        bagName - name of new bag
        bagDescription - a description for the new bag
        pathString - path used to create list
        profile - bag will be created in this profile
        im - InterMineAPI that will give us BagManager
        Returns:
        the new bag, already saved
        Throws:
        ObjectStoreException - if persistence problem
      • getAttributesFromBag

        public static java.lang.String getAttributesFromBag​(InterMineBag bag,
                                                            ObjectStore os,
                                                            java.lang.String dbName,
                                                            java.lang.String attrName,
                                                            java.lang.String delimiter)
        Parameters:
        bag - the bag
        os - the object store
        dbName - the database to link to
        attrName - the attribute name (identifier, omimId, etc)
        delimiter - the delimiter to use for the attributes
        Returns:
        the string of comma separated identifiers
      • getAttributesFromBag

        public static java.lang.String getAttributesFromBag​(InterMineBag bag,
                                                            ObjectStore os,
                                                            java.lang.String dbName,
                                                            java.lang.String attrName)
        Used by esyn tool
        Parameters:
        bag - the bag
        os - the object store
        dbName - the database to link to
        attrName - the attribute name (identifier, omimId, etc)
        Returns:
        the string of separated identifiers, using the delimiter supplied