code: private Term evalLang(Function term) {
  		Term innerTerm = term.getTerm(0);
  
  		// Create a default return constant: blank language with literal type.
  		// TODO: avoid this constant wrapping thing
  		Function emptyString = termFactory.getTypedTerm(
  				termFactory.getConstantLiteral("", XSD.STRING), XSD.STRING);
  
          if (innerTerm instanceof Variable) {
              return term;
          }
  		/*
  		 * TODO: consider the case of constants
  		 */
  		if (!(innerTerm instanceof Function)) {
  			return emptyString;
  		}
  		Function function = (Function) innerTerm;
  
  		if (!function.isDataTypeFunction()) {
  			return null;
  		}
  
  		Predicate predicate = function.getFunctionSymbol();
  		if (predicate instanceof DatatypePredicate) {
  			RDFDatatype datatype = ((DatatypePredicate) predicate).getReturnedType();
  
  			return datatype.getLanguageTag()
  					// TODO: avoid this constant wrapping thing
  					.map(tag -> termFactory.getTypedTerm(
  							termFactory.getConstantLiteral(tag.getFullString(), XSD.STRING),
  							XSD.STRING))
  					.orElse(emptyString);
  
  		}
  		return term;
  	}
docs: /*
  Expression evaluator for lang() function