'Constructor
@param query: the URL query (list of key-value pairs or a
string with such a list in JSON)'

def __init__(self, resource, query):

    if (type(query) is not list):
        try:
            self.query = json.loads(query)
        except ValueError:
            self.query = []
    else:
        self.query = query
    get_vars = {}
    for (k, v) in self.query:
        if (v is not None):
            key = resource.prefix_selector(k)
            if (key in get_vars):
                value = get_vars[key]
                if (type(value) is list):
                    value.append(v)
                else:
                    get_vars[key] = [value, v]
            else:
                get_vars[key] = v
    self.resource = resource
    self.get_vars = get_vars
