private boolean templateContainsVar(Statement listS) {
		if(listS != null && listS.getObject().isResource()) {
			ExtendedIterator<RDFNode> nodes = (listS.getObject().as(RDFList.class)).iterator();
			while(nodes.hasNext()) {
				Resource node = (Resource) nodes.next();
				if(node.hasProperty(RDF.type, SP.NamedGraph)) {
					NamedGraph namedGraph = node.as(NamedGraph.class);
					for(Element element : namedGraph.getElements()) {
						if(element instanceof Triple) {
							if(containsVar((Triple)element)) {
								nodes.close();
								return true;
							}
						}
					}
				}
				else {
					if(containsVar(node.as(TripleTemplate.class))) {
						nodes.close();
						return true;
					}
				}
			}
		}
		return false;
	}