docs: boolean isNodeTypeInUse( Name nodeTypeName ) throws InvalidQueryException {
  
          String nodeTypeString = nodeTypeName.getString(context.getNamespaceRegistry());
          String expression = "SELECT * from [" + nodeTypeString + "] LIMIT 1";
          TypeSystem typeSystem = context.getValueFactories().getTypeSystem();
          // Parsing must be done now ...
          QueryCommand command = queryParser.parseQuery(expression, typeSystem);
          assert command != null : "Could not parse " + expression;
  
          Schemata schemata = getRepositorySchemata();
  
          // Now query the entire repository for any nodes that use this node type ...
          RepositoryCache repoCache = repository.repositoryCache();
          RepositoryQueryManager queryManager = repository.queryManager();
          Set<String> workspaceNames = repoCache.getWorkspaceNames();
          Map<String, NodeCache> overridden = null;
          NodeTypes nodeTypes = repository.nodeTypeManager().getNodeTypes();
          RepositoryIndexes indexDefns = repository.queryManager().getIndexes();
          CancellableQuery query = queryManager.query(context, repoCache, workspaceNames, overridden, command, schemata,
                                                      indexDefns, nodeTypes, null, null);
          try {
              QueryResults result = query.execute();
              if (result.isEmpty()) return false;
              if (result.getRowCount() < 0) {
                  // Try to get the first row ...
                  NodeSequence seq = result.getRows();
                  Batch batch = seq.nextBatch();
                  while (batch != null) {
                      if (batch.hasNext()) return true;
                      // It's not common for the first batch may be empty, but it's possible. So try the next batch ...
                      batch = seq.nextBatch();
                  }
                  return false;
              }
              return result.getRowCount() > 0;
          } catch (RepositoryException e) {
              logger.error(e, JcrI18n.errorCheckingNodeTypeUsage, nodeTypeName, e.getLocalizedMessage());
              return true;
          }
      }