import re


def resolve_query_res(query):
    """
    Extracts resource name from ``query`` string.
    """
    # split by '(' for queries with arguments
    # split by '{' for queries without arguments
    # rather full query than empty resource name
    return re.split('[({]', query, 1)[0].strip() or query