def __init__(self, json):
self.json = json
if "boolean" in json:
type_ = 'ASK'
elif "results" in json:
type_ = 'SELECT'
else:
raise ResultException('No boolean or results in json!')
Result.__init__(self, type_)
if type_ == 'ASK':
self.askAnswer = bool(json['boolean'])
else:
self.bindings = self._get_bindings()
self.vars = [Variable(x) for x in json["head"]["vars"]]
评论列表
文章目录