def getOntoCategory(curie, alwaysFetch=False):
    """
     Accessing web-based ontology service is too long, so we cache the 
     information in a pickle file and query the services only if the info
     has not already been cached. 
    """
    
    fileName = os.path.join(os.path.dirname(__file__), "ontoCategories.bin") 
    if not alwaysFetch:
        try:
            with open(fileName, "rb") as catFile:
                ontoCat = pickle.load(catFile)
                
            if curie in ontoCat:
                return ontoCat[curie]                
        except:
            ontoCat = {}
    
    base = bases["KS"] 
    query = base + "/vocabulary/id/" + curie
    response = requests.get(query)
    if not response.ok:
        ontoCat[curie] = []
    else:

        try:
            concepts = response.json()
        except ValueError:
            print(query)
            print(response)
            raise
        
        if len(concepts["categories"]):
            ontoCat[curie] = concepts["categories"]
        else:
            ontoCat[curie] = []


    try:
        with open(fileName, "wb") as catFile:
            pickle.dump(ontoCat, catFile)
    except:
        pass        

    return ontoCat[curie]