Request metadata about a text or a collection

        :param objectId: Object Identifier to filter on
        :type objectId: str
        :param filters: Kwargs parameters.
        :type filters: dict
        :return: Collection
974740
def getMetadata(self, objectId=None, **filters):
        
        if objectId is None:
            return self.inventory
        elif objectId in self.inventory.children.keys():
            return self.inventory[objectId]
        texts, _, _ = self.__getTextMetadata__(urn=objectId)

        # We store inventory names and if there is only one we recreate the inventory
        inv_names = [text.parent.parent.parent.id for text in texts]
        if len(set(inv_names)) == 1:
            inventory = self.classes["inventory"](name=inv_names[0])
        else:
            inventory = self.classes["inventory"]()

        # For each text we found using the filter
        for text in texts:
            tg_urn = str(text.parent.parent.urn)
            wk_urn = str(text.parent.urn)
            txt_urn = str(text.urn)
            # If we need to generate a textgroup object
            if tg_urn not in inventory.textgroups:
                self.classes["textgroup"](urn=tg_urn, parent=inventory)
            # If we need to generate a work object
            if wk_urn not in inventory.textgroups[tg_urn].works:
                self.classes["work"](urn=wk_urn, parent=inventory.textgroups[tg_urn])

            if isinstance(text, CtsEditionMetadata):
                x = self.classes["edition"](urn=txt_urn, parent=inventory.textgroups[tg_urn].works[wk_urn])
                x.citation = text.citation
            elif isinstance(text, CtsTranslationMetadata):
                x = self.classes["translation"](urn=txt_urn, parent=inventory.textgroups[tg_urn].works[wk_urn], lang=text.lang)
                x.citation = text.citation
            elif isinstance(text, CtsCommentaryMetadata):
                x = self.classes["commentary"](urn=txt_urn, parent=inventory.textgroups[tg_urn].works[wk_urn], lang=text.lang)
                x.citation = text.citation

        return inventory[objectId]
953241
def filter_oids(self, oids):
        '''
        
        '''
        oids = set(oids)
        return self[self['_oid'].map(lambda x: x in oids)]
1353939
def getMetadata(self, objectId=None, **filters):
        
        return self.get_or(
            _cache_key("Nautilus", self.name, "GetMetadata", objectId),
            super(ProtoNautilusCtsResolver, self).getMetadata, objectId
        )
461815
def get_filter(self, **filter_kwargs):
        

        q_objects = super(ListView, self).get_filter(**filter_kwargs)
        form = self.get_filter_form()
        if form:
            q_objects.extend(form.get_filter())

        return q_objects
779312
def filter(self, **filters):
        

        q = self._clone()
        for key, value in filters.items():
            filter_key = re.split('__', key)
            filter_attr = filter_key[0]
            if filter_attr not in self._valid_filter_attrs:
                raise ClientValidationError("Invalid filter attribute: %s" % key)

            # we use __ as a separator in the Python library, the APIs use '.'
            q._filters['.'.join(filter_key)].append(value)
        return q
677718
def filters(self):
        
        params = {}
        for _filter in self._filters:
            params.update(_filter)

        return params
1205518
def retrieve(self, request, _id):
        
        _id = deserialize(_id)

        retrieved = self.collection.find_one({'_id': _id})
        if retrieved:
            return Response(serialize(retrieved))
        else:
            return Response(
                response=serialize(
                    DocumentNotFoundError(self.collection.__name__, _id)
                ),
                status=400
            )
1166876
def get(self, request, id=None, **kwargs):
        
        if not self.has_get_permission(request):
            return HttpResponseForbidden(_('You do not have permission to perform this action.'))

        if id:
            obj = get_object_or_404(self.queryset(request, **kwargs), id=id)
            return self.get_object_detail(request, obj)
        else:
            return self.get_collection(request, **kwargs)
496413
def get_filters(self, request, **resources):
        
        filters = dict()

        if not self._meta.fields:
            return filters

        for field in request.GET.iterkeys():
            tokens = field.split(LOOKUP_SEP)
            field_name = tokens[0]

            if field_name not in self._meta.fields:
                continue

            exclude = False
            if tokens[-1] == 'not':
                exclude = True
                tokens.pop()

            value = request.GET.getlist(field)
            if len(tokens) == 1:
                value = map(self._meta.model._meta.get_field(field_name).to_python, value)

            if len(value) > 1:
                tokens.append('in')
            else:
                value = value.pop()

            filters[LOOKUP_SEP.join(tokens)] = (value, exclude)

        return filters
522249
def get_documents_in_database(self, with_id=True):
        
        documents = []
        for coll in self.get_collection_names():
            documents += self.get_documents_in_collection(
                coll,
                with_id=with_id
            )

        return documents
1349348
def documents(cls, filter=None, **kwargs):
        
        documents = [cls(document) for document in cls.find(filter, **kwargs)]
        return [document for document in documents if document.document]
690588
def get(cls, identifier: Any) -> 'Entity':
        
        logger.debug(f'Lookup `{cls.__name__}` object with identifier {identifier}')
        # Get the ID field for the entity
        filters = {
            cls.meta_.id_field.field_name: identifier
        }

        # Find this item in the repository or raise Error
        results = cls.query.filter(**filters).limit(1).all()
        if not results:
            raise ObjectNotFoundError(
                f'`{cls.__name__}` object with identifier {identifier} '
                f'does not exist.')

        # Return the first result
        return results.first
1220121
def get_synonym(objectID, request_options = {})
      client.get(Protocol.synonym_uri(name, objectID), :read, request_options)
    end
145664
def dicts_filter(dicts_object, field_to_filter, value_of_filter):
    
    lambda_query = lambda value: value[field_to_filter] == value_of_filter

    filtered_coin = filter(lambda_query, dicts_object)
    selected_coins = list(filtered_coin)
    #if not selected_coin: #Empty list, no coin found
    #    raise AttributeError('attribute %s not found' % attr)
    return selected_coins
270988
def count_documents(self, filter={},  *args, **kwargs):
        
        result = self.collection.count_documents(filter, *args, **kwargs)
        return result
317342
def request(self, filter=None):
        
        node = new_ele("get-bulk")
        if filter is not None:
            node.append(util.build_filter(filter))
        return self._request(node)
80974
def get(self, mongo_id):
        """"""
        try:
            return self.filter(self.type.mongo_id == mongo_id).first()
        except exceptions.BadValueException:
            return None