def _convert_dcoument(self, document, graph_type):
    if isinstance(document, list):
        new_doc = []
        captured = []
        referenced = []
        for item in document:
            item_dict = self._conv_to_dict(item)
            new_doc.append(item_dict)
            item_capture = item_dict.get('@capture')
            if item_capture:
                captured.append(item_capture)
            referenced += list(self._ref_extract('@ref', item_dict))
        referenced = list(set(referenced))
        for item in referenced:
            if (item not in captured):
                raise ValueError(f'{item} is referenced but not captured. Seems you forgot to submit one or more object(s).')
    else:
        if (hasattr(document, 'to_dict') and (graph_type != 'schema')):
            raise InterfaceError('Inserting WOQLSchema object into non-schema graph.')
        new_doc = self._conv_to_dict(document)
        if (isinstance(new_doc, dict) and list(self._ref_extract('@ref', new_doc))):
            raise ValueError('There are uncaptured references. Seems you forgot to submit one or more object(s).')
    return new_doc
def _convert_dcoument(self, document, graph_type):
    if isinstance(document, list):
        new_doc = []
        captured = []
        referenced = []
        for item in document:
            item_dict = self._conv_to_dict(item)
            new_doc.append(item_dict)
            item_capture = item_dict.get('@capture')
            if item_capture:
                captured.append(item_capture)
            referenced += list(self._ref_extract('@ref', item_dict))
        referenced = list(set(referenced))
        for item in referenced:
            if (item not in captured):
                raise ValueError(f'{item} is referenced but not captured. Seems you forgot to submit one or more object(s).')
    else:
        if (hasattr(document, 'to_dict') and (graph_type != 'schema')):
            raise InterfaceError('Inserting WOQLSchema object into non-schema graph.')
        new_doc = self._conv_to_dict(document)
        if (isinstance(new_doc, dict) and list(self._ref_extract('@ref', new_doc))):
            raise ValueError('There are uncaptured references. Seems you forgot to submit one or more object(s).')
    return new_doc