import re


def get_ref_parts(ref):
    """
    Returns the different parts of a ref: the namespace, version and entity
    e.g. "$ref": "http://redfish.dmtf.org/schemas/swordfish/v1/Volume.v1_0_0.json#/definitions/Volume"
    will return Volume, v1_0_0, Volume
    """
    [schema_url, entity] = ref.split('#')
    entity = entity[entity.rfind('/') + 1:]  # remove preceding /../ from entity

    m = re.compile('.*/(\w+)\.?(\w*)\.json$').match(schema_url)
    if m:
        return m.group(1), m.group(2), entity

    return None, None, None