class_docstr: A cache for requests against Wikidata's SPARQL endpoint.
class_docstr_tok: ["A","cache","for","requests","against","Wikidata","'s","SPARQL","endpoint","."]
docstr: Get the requested component for the given IDs.
  
  .. note ::
      this method uses file-based caching to avoid excessive requests to the Wikidata API.
  
  :param ids:
      the Wikidata IDs
  :param component:
      the selected component
  
  :return:
      the selected component for each Wikidata ID
docstr_tok: ["Get","the","requested","component","for","the","given","IDs",".","..","note",":",":","this","method","uses","file-based","caching","to","avoid","excessive","requests","to","the","Wikidata","API",".",":","param","ids",":","the","Wikidata","IDs",":","param","component",":","the","selected","component",":","return",":","the","selected","component","for","each","Wikidata","ID"]
code: def _get(
      self,
      ids: Sequence[str],
      component: Literal["label", "description"],
  ) -> Sequence[str]:
      """
      Get the requested component for the given IDs.
  
      .. note ::
          this method uses file-based caching to avoid excessive requests to the Wikidata API.
  
      :param ids:
          the Wikidata IDs
      :param component:
          the selected component
  
      :return:
          the selected component for each Wikidata ID
      """
      self.verify_ids(ids=ids)
      # try to load cached first
      result: List[Optional[str]] = [None] * len(ids)
      for i, wikidata_id in enumerate(ids):
          result[i] = self._load(
              wikidata_id=wikidata_id, component=component
          )
      # determine missing entries
      missing = [
          wikidata_id
          for wikidata_id, desc in zip(ids, result)
          if not desc
      ]
      # retrieve information via SPARQL
      entries = self.query_text(wikidata_ids=missing)
      # save entries
      self._save(entries=entries)
      # fill missing descriptions
      w_to_i = {wikidata_id: i for i, wikidata_id in enumerate(ids)}
      for wikidata_id, entry in entries.items():
          result[w_to_i[wikidata_id]] = entry[component]
      # for mypy
      for item in result:
          assert isinstance(item, str)
      return cast(Sequence[str], 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 7 for calling the WikidataCache obj's underlying member method code with example usage: obj._get(ids, component) and returns: cast