code: private Function simplifyIsNullorNotNullUriTemplate(Function uriTemplate, boolean isNull) {
  		Set<Variable> variables = uriTemplate.getVariables();
  		if (isNull) {
  			switch (variables.size()) {
  				case 0:
  					return termFactory.getFunctionIsNull(uriTemplate);
  				case 1:
  					return termFactory.getFunctionIsNull(variables.iterator().next());
  				default:
  					return variables.stream()
  							.reduce(null,
  									(e, v) -> e == null
  											? termFactory.getFunctionIsNull(v)
  											: termFactory.getFunctionOR(e, termFactory.getFunctionIsNull(v)),
  									(e1, e2) -> e1 == null
  											? e2
  											: (e2 == null) ? e1 : termFactory.getFunctionOR(e1, e2));
  			}
  		}
  		else {
  			if (variables.isEmpty())
  				return termFactory.getFunctionIsNotNull(uriTemplate);
  			else
  				return datalogTools.foldBooleanConditions(
  						variables.stream()
  								.map(termFactory::getFunctionIsNotNull)
  								.collect(Collectors.toList()));
  		}
  	}
docs: TODO: make it stronger (in case someone uses complex sub-terms such as IS_NULL(x) inside the URI template...)