String dt = reader.getAttributeValue(null, DATATYPE);
URI datatype = (dt == null) ? null : new URI(dt);
String lang = reader.getAttributeValue(XML_NS, LANG);
if (reader.next() != CHARACTERS) throw new SparqlException("Unexpected data in Literal binding");
String lex = reader.getText();
return (datatype != null) ? new TypedLiteralImpl(lex, datatype) : new PlainLiteralImpl(lex, lang);
default:
throw new SparqlException("Unexpected binding value: " + reader.getLocalName());
}
} catch (URISyntaxException e) {
e.printStackTrace();