class_docstr: A cache for requests against Wikidata's SPARQL endpoint.
class_docstr_tok: ["A","cache","for","requests","against","Wikidata","'s","SPARQL","endpoint","."]
docstr: Query the SPARQL endpoints about information for the given IDs.
  
  :param wikidata_ids:
      the Wikidata IDs
  :param language:
      the label language
  :param batch_size:
      the batch size; if more ids are provided, break the big request into multiple smaller ones
  
  :return:
      a mapping from Wikidata Ids to dictionaries with the label and description of the entities
docstr_tok: ["Query","the","SPARQL","endpoints","about","information","for","the","given","IDs",".",":","param","wikidata_ids",":","the","Wikidata","IDs",":","param","language",":","the","label","language",":","param","batch_size",":","the","batch","size",";","if","more","ids","are","provided",",","break","the","big","request","into","multiple","smaller","ones",":","return",":","a","mapping","from","Wikidata","Ids","to","dictionaries","with","the","label","and","description","of","the","entities"]
code: def query_text(
      cls,
      wikidata_ids: Sequence[str],
      language: str = "en",
      batch_size: int = 256,
  ) -> Mapping[str, Mapping[str, str]]:
      """
      Query the SPARQL endpoints about information for the given IDs.
  
      :param wikidata_ids:
          the Wikidata IDs
      :param language:
          the label language
      :param batch_size:
          the batch size; if more ids are provided, break the big request into multiple smaller ones
  
      :return:
          a mapping from Wikidata Ids to dictionaries with the label and description of the entities
      """
      res_json = cls.query(
          sparql=functools.partial(
              dedent(
                  """
                          SELECT ?item ?itemLabel ?itemDescription WHERE {{{{
                              VALUES ?item {{ {ids} }}
                              SERVICE wikibase:label {{ bd:serviceParam wikibase:language "{language}". }}
                          }}}}
                      """
              ).format,
              language=language,
          ),
          wikidata_ids=wikidata_ids,
          batch_size=batch_size,
      )
      result = {}
      for entry in res_json:
          wikidata_id = nested_get(entry, "item", "value", default="")
          assert isinstance(wikidata_id, str)  # for mypy
          wikidata_id = wikidata_id.rsplit("/", maxsplit=1)[-1]
          label = nested_get(entry, "itemLabel", "value", default="")
          assert isinstance(label, str)  # for mypy
          description = nested_get(
              entry, "itemDescription", "value", default=""
          )
          assert isinstance(description, str)  # for mypy
          result[wikidata_id] = dict(
              label=label, description=description
          )
      return result
  
imports: from __future__ import annotations
  import functools
  import logging
  import pathlib
  import re
  import subprocess
  from abc import ABC, abstractmethod
  from itertools import chain
  from textwrap import dedent
  from typing import Any, Callable, Collection, Dict, Iterable, List, Literal, Mapping, Optional, Sequence, Union, cast
  import more_itertools
  import requests
  import torch
  from tqdm.auto import tqdm
  from ..constants import PYKEEN_MODULE
  from ..typing import OneOrSequence
  from ..utils import nested_get, rate_limited, upgrade_to_sequence
  from ..version import get_version
label_desc: Use image node_id 4 for calling the WikidataCache obj's underlying member method code with example usage: obj.query_text(cls, wikidata_ids, language, batch_size) and returns: result