docs: protected ExtractFromRow createExtractReferencesFromRow( final String selectorName,
                                                               QueryContext context,
                                                               Columns columns,
                                                               QuerySources sources,
                                                               TypeFactory<?> defaultType ) {
          final NodeCache cache = context.getNodeCache(sources.getWorkspaceName());
          // Find the expected property type of the value ...
          assert columns != null;
          final int indexInRow = columns.getSelectorIndex(selectorName);
          final TypeFactory<?> typeFactory = context.getTypeSystem().getStringFactory();
          final boolean trace = LOGGER.isTraceEnabled();
          return new ExtractFromRow() {
              @Override
              public Object getValueInRow( RowAccessor row ) {
                  CachedNode node = row.getNode(indexInRow);
                  if (node == null) return null;
                  List<Object> values = null;
                  for (Iterator<org.modeshape.jcr.value.Property> iter = node.getProperties(cache); iter.hasNext();) {
                      org.modeshape.jcr.value.Property prop = iter.next();
                      if (prop == null || prop.isEmpty()) continue;
                      if (prop.isReference() || prop.isSimpleReference()) {
                          if (prop.isSingle()) {
                              Object value = prop.getFirstValue();
                              if (value != null) {
                                  if (values == null) values = new LinkedList<>();
                                  values.add(typeFactory.create(value));
                              }
                          } else {
                              assert prop.isMultiple();
                              for (Object value : prop) {
                                  if (value == null) continue;
                                  if (values == null) values = new LinkedList<>();
                                  values.add(typeFactory.create(value));
                              }
                          }
                      }
                  }
                  if (values == null || values.isEmpty()) return null;
                  if (trace) {
                      LOGGER.trace("Found references in '{0}': {1}", node.getPath(cache), values);
                  }
                  return values.toArray();
              }
  
              @Override
              public TypeFactory<?> getType() {
                  return typeFactory;
              }
  
              @Override
              public String toString() {
                  return "(references " + selectorName + ")";
              }
          };
      }