code: public static String getOrGenerateMatchLabel(QuerySolution row, boolean operationDiscovery) {
          String label;
          if (operationDiscovery) {
              label = getOrGenerateOperationLabel(row);
          } else {
              label = getOrGenerateServiceLabel(row);
          }
          return label;
      }
docs: Obtain or generate a label for the match result given a row resulting
  from a query.
  
  @param row                the result from a SPARQL query
  @param operationDiscovery true if we are doing operation discovery
  @return