def to_api_doc_repr(regdoc):
    """
    Transform RegistryDocument
    {
        "_id": "bts"
        "@context": { ... }
        "@graph": [ ... ]
    }
    with meta property->
    {
        "url": "http..."
    }
    to
    {
        "url": "http...",
        "namespace": "bts,
        "source": {
            "@context": { ... }
            "@graph": [ ... ]
        }
    }

    """

    api_doc = {}
    api_doc['url'] = regdoc.meta.url if 'url' in regdoc.meta else None
    api_doc['namespace'] = regdoc.pop('_id', None)

    if regdoc:
        api_doc['source'] = regdoc

    return api_doc