code: private function getItemLabel(RunnerServiceContext $context, $itemUri, $useTitle = false)
      {
          $label = '';
  
          if ($useTitle) {
              $label = $context->getItemIndexValue($itemUri, 'title');
          }
  
          if (!$label) {
              $label = $context->getItemIndexValue($itemUri, 'label');
          }
  
          if (!$label) {
              $item = new \core_kernel_classes_Resource($itemUri);
              $label = $item->getLabel();
          }
          return $label;
      }
docs: Get the label of a Map item
  
  @param RunnerServiceContext $context
  @param string $itemUri
  @param int $useTitle
  @return string the title