Literals can have annoying errors like "Illegal escape sequence value" .
These errors create exceptions by Turtle parser.
But the API does not check anything:
NodeFactory.createLiteral("ggg\\<br")

Event the org.apache.jena.riot.checker.CheckerLiterals is silent:

val handler =
org.apache.jena.riot.system.ErrorHandlerFactory.errorHandlerStrict
val checker = new org.apache.jena.riot.checker.CheckerLiterals(handler)
val obj = "ggg\\<br"
import org.apache.jena.graph._
val lit = NodeFactory.createLiteral(obj)
checker.check(lit, 1L, 1L)
res28: Boolean = true

So, is there a way to check a plain literal by API, other than creating a
fake triple and parse it ?

Note: the code samples are in Scala command line (REPL), but I think it's
easy to understand for Javaists ...

Jean-Marc Vanel
<http://semantic-forms.cc:9112/display?displayuri=http://jmvanel.free.fr/jmv.rdf%23me>
+33 (0)6 89 16 29 52
Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui
 Chroniques jardin
<http://semantic-forms.cc:1952/history?uri=http%3A%2F%2Fdbpedia.org%2Fresource%2FChronicle>

Reply via email to