code: private String getTypeColumnForSELECT(Term ht, AliasIndex index, Optional<TermType> optionalTermType) {
  
  		if (ht instanceof Variable) {
  	        // Such variable does not hold this information, so we have to look
  	        // at the database metadata.
  			return index.getTypeColumn((Variable) ht)
  					.map(QualifiedAttributeID::getSQLRendering)
  					// By default, we assume that the variable is an IRI.
  					.orElseGet(() -> String.valueOf(OBJECT.getQuestCode()));
  		}
  		else {
  			COL_TYPE colType = optionalTermType
  					.flatMap(this::extractColType)
  					// By default, we apply the "most" general COL_TYPE
  					.orElse(STRING);
  
  			return String.valueOf(colType.getQuestCode());
  		}
  	}
docs: Infers the type of a projected term.
  
  Note this type may differ from the one used for casting the main column (in some special cases).
  This type will appear as the RDF datatype.
  
  @param ht
  @param index Used when the term correspond to a column name
  @param optionalTermType