private static void addQueryResults(List<ConstraintViolation> results, QueryOrTemplateCall qot, Resource resource, boolean matchValue, List<SPINStatistics> stats, SPINModuleRegistry registry) {
		
		QuerySolutionMap arqBindings = new QuerySolutionMap();
		
		String queryString = ARQFactory.get().createCommandString(qot.getQuery(), registry);
		if(resource == null && SPINUtil.containsThis(qot.getQuery(), registry)) {
			queryString = SPINUtil.addThisTypeClause(queryString);
		}
		else {
			arqBindings.add(SPIN.THIS_VAR_NAME, resource);
		}
		
		Query arq = ARQFactory.get().createQuery(queryString);
		Model model = resource.getModel();
		QueryExecution qexec = ARQFactory.get().createQueryExecution(arq, model);
		
		qexec.setInitialBinding(arqBindings);
		
		long startTime = System.currentTimeMillis();
		if(arq.isAskType()) {
			if(qexec.execAsk() != matchValue) {
				String message;
				String comment = qot.getQuery().getComment();
				if(comment == null) {
					message = SPINLabels.get().getLabel(qot.getQuery());
				}
				else {
					message = comment;
				}
				message += "\n(SPIN constraint at " + SPINLabels.get().getLabel(qot.getCls()) + ")";
				List<SimplePropertyPath> paths = getPropertyPaths(resource, qot.getQuery().getWhere(), null, registry);
				Resource source = getSource(qot);
				results.add(createConstraintViolation(paths, NO_FIXES, resource, message, source));
			}
		}
		else if(arq.isConstructType()) {
			Model cm = qexec.execConstruct();
			qexec.close();
			addConstructedProblemReports(cm, results, model, qot.getCls(), resource, qot.getQuery().getComment(), getSource(qot), registry);
		}
		long endTime = System.currentTimeMillis();
		if(stats != null) {
			long duration = startTime - endTime;
			String label = qot.toString();
			String queryText;
			if(qot.getTemplateCall() != null) {
				queryText = SPINLabels.get().getLabel(qot.getTemplateCall().getTemplate(registry).getBody());
			}
			else {
				queryText = SPINLabels.get().getLabel(qot.getQuery());
			}
			Node cls = qot.getCls() != null ? qot.getCls().asNode() : null;
			stats.add(new SPINStatistics(label, queryText, duration, startTime, cls));
		}
	}