def get_metadata_statement(self, input, cls=MetadataStatement,
                               context=''):
        """
        Unpack and evaluate a compound metadata statement. Goes through the
        necessary three steps.
        * unpack the metadata statement
        * verify that the given statements are expected to be used in this context
        * evaluate the metadata statements (= flatten)

        :param input: The metadata statement as a JSON document or a
            dictionary
        :param cls: The class the response should be typed into
        :param context: In which context the metadata statement should be used.
        :return: A list of :py:class:`fedoidc.operator.LessOrEqual` instances
        """
        logger.debug('Incoming metadata statement: {}'.format(input))

        if isinstance(input, dict):
            data = input
        else:
            if isinstance(input, Message):
                data = input.to_dict()
            else:
                data = json.loads(input)

        _pi = self.unpack_metadata_statement(ms_dict=data, cls=cls)
        if not _pi.result:
            return []

        logger.debug('Managed to unpack the metadata statement')

        if context:
            _cms = self.correct_usage(_pi.result, context)
        else:
            _cms = _pi.result

        logger.debug('After filtering for correct usage: {}'.format(_cms))

        if _cms:
            return self.evaluate_metadata_statement(_cms)
        else:
            return []
def get_metadata_statement(self, input, cls=MetadataStatement,
                               context=''):
        """
        Unpack and evaluate a compound metadata statement. Goes through the
        necessary three steps.
        * unpack the metadata statement
        * verify that the given statements are expected to be used in this context
        * evaluate the metadata statements (= flatten)

        :param input: The metadata statement as a JSON document or a
            dictionary
        :param cls: The class the response should be typed into
        :param context: In which context the metadata statement should be used.
        :return: A list of :py:class:`fedoidc.operator.LessOrEqual` instances
        """
        logger.debug('Incoming metadata statement: {}'.format(input))

        if isinstance(input, dict):
            data = input
        else:
            if isinstance(input, Message):
                data = input.to_dict()
            else:
                data = json.loads(input)

        _pi = self.unpack_metadata_statement(ms_dict=data, cls=cls)
        if not _pi.result:
            return []

        logger.debug('Managed to unpack the metadata statement')

        if context:
            _cms = self.correct_usage(_pi.result, context)
        else:
            _cms = _pi.result

        logger.debug('After filtering for correct usage: {}'.format(_cms))

        if _cms:
            return self.evaluate_metadata_statement(_cms)
        else:
            return []
def get_metadata_statement ( self , input , cls = MetadataStatement , context = '' ) : logger . debug ( 'Incoming metadata statement: {}' . format ( input ) ) if isinstance ( input , dict ) : data = input else : if isinstance ( input , Message ) : data = input . to_dict ( ) else : data = json . loads ( input ) _pi = self . unpack_metadata_statement ( ms_dict = data , cls = cls ) if not _pi . result : return [ ] logger . debug ( 'Managed to unpack the metadata statement' ) if context : _cms = self . correct_usage ( _pi . result , context ) else : _cms = _pi . result logger . debug ( 'After filtering for correct usage: {}' . format ( _cms ) ) if _cms : return self . evaluate_metadata_statement ( _cms ) else : return [ ]
Unpack and evaluate a compound metadata statement. Goes through the
        necessary three steps.
        * unpack the metadata statement
        * verify that the given statements are expected to be used in this context
        * evaluate the metadata statements (= flatten)

        :param input: The metadata statement as a JSON document or a
            dictionary
        :param cls: The class the response should be typed into
        :param context: In which context the metadata statement should be used.
        :return: A list of :py:class:`fedoidc.operator.LessOrEqual` instances
Unpack and evaluate a compound metadata statement . Goes through the necessary three steps . * unpack the metadata statement * verify that the given statements are expected to be used in this context * evaluate the metadata statements ( = flatten )