public void print(PrintContext p, SPINModuleRegistry registry) {
		printComment(p);
		printPrefixes(p, registry);
		p.printIndentation(p.getIndentation());
		p.printKeyword("SELECT");
		p.print(" ");
		if(isDistinct()) {
			p.printKeyword("DISTINCT");
			p.print(" ");
		}
		if(isReduced()) {
			p.printKeyword("REDUCED");
			p.print(" ");
		}
		List<Resource> vars = getResultVariables();
		if(vars.isEmpty()) {
			p.print("*");
		}
		else {
			for(Iterator<Resource> vit = vars.iterator(); vit.hasNext(); ) {
				Resource var = vit.next();
				if(var instanceof Variable) {
					if(var.hasProperty(SP.expression)) {
						printProjectExpression(p, (Variable) var, registry);
					}
					else {
						((Variable)var).print(p, registry);
					}
				}
				else if(var instanceof Aggregation) {
					((Printable)var).print(p, registry);
				}
				else {
					p.print("(");
					((Printable)var).print(p, registry);
					p.print(")");
				}
				if(vit.hasNext()) {
					p.print(" ");
				}
			}
		}
		printStringFrom(p);
		p.println();
		printWhere(p, registry);
		printGroupBy(p, registry);
		printHaving(p, registry);
		printSolutionModifiers(p, registry);
	}