On 26/07/16 16:14, Martynas Jusevičius wrote:
But the assumption obviously doesn't hold? Illegal Models exist
because they can be parsed.

No - because someone turned the checking off or created them them with code, not a parser.

Wouldn't it make sense for the Writers check URIs just like the
Readers do? URI validity does not depend on syntax, does it?

Checking URIs is expensive. Sometimes it matters (NTriples, NQuads).

To check them, process the model first which is something possible for writers and not for readers.

The rules for different syntaxes are different anyway - RDF/XMl has special rules for properties.

> What do you mean with "keep the original user input"?
You said:
[[
If the user provided invalid
URI values, they need to be presented back to the user with an error
message, giving him/her a chance to correct the errors.
]]

        Andy


On Tue, Jul 26, 2016 at 11:32 AM, Andy Seaborne <a...@apache.org> wrote:
On 26/07/16 10:23, Martynas Jusevičius wrote:

Andy,

"allowBadURIs" was my next move, I will try that later today and report
back.

Any reason why this cannot be exposed uniformly on the WriterRIOT
level? Like it is on ReaderRIOT.


RDF/XML is the only case that checks IIRC.

Writers output what they can.  They assume the model is legal RDF and do
their best.  There is a myriad of "illegal RDF" cases and what they can and
can't write depends on the syntax.

If you want to round trip user input - why not keep the original user input?

        Andy



On Tue, Jul 26, 2016 at 11:15 AM, Andy Seaborne <a...@apache.org> wrote:

Turtle-class syntaxes print bad URIs.

For RDF/XML, does setting "allowBadURIs" work?


https://jena.apache.org/documentation/io/rdfxml_howto.html#advanced-rdfxml-output

    Andy


On 26/07/16 09:34, Martynas Jusevičius wrote:


RDF/XML (plain) in this case. I would of course prefer a
format-agnostic solution.

On Tue, Jul 26, 2016 at 10:21 AM, Andy Seaborne <a...@apache.org> wrote:


Which serialization format are you working with?

    Andy


On 25/07/16 22:44, Martynas Jusevičius wrote:



Hey,

I was planning to set an ErrorHandler on WriterGraphRIOT instance, but
it turns such setter does not exist.

My ErrorHandler allows invalid URIs to be read without throwing
exceptions. However model.write() throws BadURIException when writing
them. So round-tripping such Model currently does not work. How do I
handler writer errors?

I think it would make sense to reuse the error handler between RIOT
readers and writers.
For example, if it is set to strict, both throw exceptions on invalid
URIs.
If it is set to lax, invalid URIs are allowed during both during
parsing and writing.
That would make round-tripping easy.

Martynas
atomgraph.com





Reply via email to