def read_examples(self, queries_file, p=1.0):
    """Read a json file into a list of Example."""
    with tf.gfile.Open(queries_file, "r") as reader:
      examples = []
      for line in tqdm(reader):
        item = json.loads(line.strip())

        qas_id = item["id"]
        relation = random.choice(item["relation"]["text"])
        if item["subject"]["name"] is None or random.uniform(0., 1.) < p:
          question_text = (
              random.choice(item["subject"]["mentions"])["text"] + " . " +
              relation)
        else:
          question_text = item["subject"]["name"] + " . " + relation
        answer_mention = item["object"]["global_mention"]
        answer_entity = item["object"]["ent_id"]

        example = Example(
            qas_id=qas_id,
            question_text=question_text,
            subject_entity=[item["subject"]["wikidata_id"]],
            relations=[relation],
            answer_mention=[answer_mention],
            answer_entity=[answer_entity])
        examples.append(example)

    return examples
Read a json file into a list of Example.
language/labs/drkit/input_fns.py