def main():
    url = ('https://raw.githubusercontent.com/schemaorg/schemaorg/V%s-release/data/releases/%s/schemaorgcontext.jsonld' % (SCHEMA_VERSION, SCHEMA_VERSION))
    with urllib.request.urlopen(url) as f:
        schema = json.load(f)
    if (len(sys.argv) > 2):
        version = sys.argv[1]
        tag = sys.argv[2]
    elif (len(sys.argv) > 1):
        tag = version = sys.argv[1]
    else:
        tag = version = ROCRATE_VERSION
    schemakeys = list(schema['@context'].keys())
    schemakeys.sort()
    j = OrderedDict()
    j['@id'] = ('https://w3id.org/ro/crate/%s/context' % version)
    j['name'] = ('RO-Crate JSON-LD Context',)
    j['version'] = tag
    j['url'] = {'@id': ('https://w3id.org/ro/crate/%s' % version)}
    j['schemaVersion'] = {'@id': ('http://schema.org/version/%s/' % SCHEMA_VERSION)}
    j['isBasedOn'] = [{'@id': ('http://schema.org/version/%s/' % SCHEMA_VERSION)}, {'@id': 'https://pcdm.org/2016/04/18/models'}, {'@id': BIOSCHEMA_WORKFLOW_PROFILE}, {'@id': BIOSCHEMA_FORMAL_PARAMETER_PROFILE}]
    j['license'] = {'@id': 'https://creativecommons.org/publicdomain/zero/1.0/'}
    context = OrderedDict()
    j['@context'] = context
    for k in schemakeys:
        if (':' in k):
            continue
        if ('@' in k):
            continue
        definition = schema['@context'][k]
        if ((not ('@id' in definition)) or isinstance(definition, str)):
            continue
        context[k] = schema['@context'][k]['@id'].replace('schema:', 'http://schema.org/')
    context.update(ADDITIONAL)
    json.dump(j, sys.stdout, ensure_ascii=False, indent=5)
    print()
def main():
    url = ('https://raw.githubusercontent.com/schemaorg/schemaorg/V%s-release/data/releases/%s/schemaorgcontext.jsonld' % (SCHEMA_VERSION, SCHEMA_VERSION))
    with urllib.request.urlopen(url) as f:
        schema = json.load(f)
    if (len(sys.argv) > 2):
        version = sys.argv[1]
        tag = sys.argv[2]
    elif (len(sys.argv) > 1):
        tag = version = sys.argv[1]
    else:
        tag = version = ROCRATE_VERSION
    schemakeys = list(schema['@context'].keys())
    schemakeys.sort()
    j = OrderedDict()
    j['@id'] = ('https://w3id.org/ro/crate/%s/context' % version)
    j['name'] = ('RO-Crate JSON-LD Context',)
    j['version'] = tag
    j['url'] = {'@id': ('https://w3id.org/ro/crate/%s' % version)}
    j['schemaVersion'] = {'@id': ('http://schema.org/version/%s/' % SCHEMA_VERSION)}
    j['isBasedOn'] = [{'@id': ('http://schema.org/version/%s/' % SCHEMA_VERSION)}, {'@id': 'https://pcdm.org/2016/04/18/models'}, {'@id': BIOSCHEMA_WORKFLOW_PROFILE}, {'@id': BIOSCHEMA_FORMAL_PARAMETER_PROFILE}]
    j['license'] = {'@id': 'https://creativecommons.org/publicdomain/zero/1.0/'}
    context = OrderedDict()
    j['@context'] = context
    for k in schemakeys:
        if (':' in k):
            continue
        if ('@' in k):
            continue
        definition = schema['@context'][k]
        if ((not ('@id' in definition)) or isinstance(definition, str)):
            continue
        context[k] = schema['@context'][k]['@id'].replace('schema:', 'http://schema.org/')
    context.update(ADDITIONAL)
    json.dump(j, sys.stdout, ensure_ascii=False, indent=5)
    print()