code: protected InternalQName[] getSelectProperties() throws RepositoryException
     {
        // get select properties
        List<InternalQName> selectProps = new ArrayList<InternalQName>();
        selectProps.addAll(Arrays.asList(root.getSelectProperties()));
        if (selectProps.size() == 0)
        {
           // use node type constraint
           LocationStepQueryNode[] steps = root.getLocationNode().getPathSteps();
           final InternalQName[] ntName = new InternalQName[1];
           steps[steps.length - 1].acceptOperands(new DefaultQueryNodeVisitor()
           {
  
              public Object visit(AndQueryNode node, Object data) throws RepositoryException
              {
                 return node.acceptOperands(this, data);
              }
  
              public Object visit(NodeTypeQueryNode node, Object data)
              {
                 ntName[0] = node.getValue();
                 return data;
              }
           }, null);
           if (ntName[0] == null)
           {
              ntName[0] = Constants.NT_BASE;
           }
           NodeTypeData nt = session.getWorkspace().getNodeTypesHolder().getNodeType(ntName[0]);
           PropertyDefinitionData[] propDefs = nt.getDeclaredPropertyDefinitions();
  
           for (int i = 0; i < propDefs.length; i++)
           {
              PropertyDefinitionData propDef = propDefs[i];
              if (!propDef.isResidualSet() && !propDef.isMultiple())
              {
                 selectProps.add(propDef.getName());
              }
           }
        }
  
        // add jcr:path and jcr:score if not selected already
        if (!selectProps.contains(Constants.JCR_PATH))
        {
           selectProps.add(Constants.JCR_PATH);
        }
        if (!selectProps.contains(Constants.JCR_SCORE))
        {
           selectProps.add(Constants.JCR_SCORE);
        }
  
        return (InternalQName[])selectProps.toArray(new InternalQName[selectProps.size()]);
     }
docs: Returns the select properties for this query.
  
  @return array of select property names.
  @throws RepositoryException
  if an error occurs.