Return a list of all mappings from the given kb, ordered by key.

    If key given, give only those with left side (mapFrom) = key.
    If value given, give only those with right side (mapTo) = value.

    :param kb_name: knowledge base name. if "", return all
    :param sortby: the sorting criteria ('from' or 'to')
    :param key: return only entries where key matches this
    :param value: return only entries where value matches this
    :param match_type: s=substring, e=exact, sw=startswith

def query_kb_mappings(kbid, sortby="to", key="", value="",
                      match_type="s"):
    """Return a list of all mappings from the given kb, ordered by key.

    If key given, give only those with left side (mapFrom) = key.
    If value given, give only those with right side (mapTo) = value.

    :param kb_name: knowledge base name. if "", return all
    :param sortby: the sorting criteria ('from' or 'to')
    :param key: return only entries where key matches this
    :param value: return only entries where value matches this
    :param match_type: s=substring, e=exact, sw=startswith
    """
    return models.KnwKBRVAL.query_kb_mappings(kbid, sortby, key,
                                              value, match_type)