Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-31 Thread Martynas Jusevičius
Doesn't RIOT and IRI code both share a common core component, to which both
BadURIException and IRIException could be pushed and then unified?

And why couldn't ErrorHandler methods take Exceptions? Given that those
Exception subclasses carry all the necessary error information, the handler
code could decide what to do with them.

On Sun, 31 Jul 2016 at 16:09, Andy Seaborne  wrote:

> On 30/07/16 15:43, Martynas Jusevičius wrote:
> > Andy,
> >
> > why does ErrorHandlerStd throw RiotException?
> >
> https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/system/ErrorHandlerFactory.java#L128
> >
> > It fails to pass on URI violations that way, because RiotException is
> > too general. I guess this is the outcome of the ErrorHandler interface
> > methods.
>
> Yes.  ErrorHandler is general.
>
> > Turns out there is already IRIException that captures the violations
> > (but unfortunately does not extend RiotException):
>
> History but also not tying independent subsystems together into a big
> dependency tangle.
>
> >
> https://github.com/apache/jena/blob/master/jena-iri/src/main/java/org/apache/jena/iri/IRIException.java#L43
> >
> > Couldnt ErrorHandler (re)use the IRIException? Maybe the interface
> > should be refactored based on logging (Riot)Exceptions instead of
> > String messages:
>
> The parsers call the error handler when they find a structural parse
> error - that's what gives the line and column number and also means the
> error message is hand-crafted to the specific error. Some are warnings -
> the parsing continues.
>
> The role of CheckerIRI.iriViolations is to convert IRI problems into the
> ErrorHandler framework.  It can't provide line/column as it's too late -
> the ParserProfile can do so and can call an ErrorHandler.
>
> For more precise control, that is probably the way to go for Jena 3.1.0
> (3.0.1).  RDF/XML is different because the parser is not RIOT based -
> it's Jena original ARP parser in an adapter. The adapter does extract
> line and column information when it can.  Maybe being liberal with IRI
> creation and checking in a specific NodeChecker for the RDFStream driven
> checking process might be better for you.
>
> This is a general framework for the parsing process - there is only so
> much the normal components provided for the framework can do.
> Eventually, precise control needs components to capture the specific
> requirements.
>
> org.apache.jena.riot.system.IRIResolver does throw RiotExceptions.
>
> Adding Errorhandler.errorIRI(IRIViolation, line, col) and
> Errorhandler.warningIRI(IRIViolation, line, col) is possible with
> investigation - need to go back through the parsers (just
> ParserProfilebase and LangRDFXML ??) to make sure it is actually going
> to work as required.  The parsing lifecycle may not fit it.
>
> Andy
>
> >
> >   public class IRIException extends RiotException
> >   {
> >
> > public final Violation violation;
> >
> > public IRIException(Violation violation)
> > {
> >   this.violation = violation;
> > }
> >
> > public Violation getViolation()
> > {
> >   return violation;
> > }
> >
> >   }
> >
> >   public interface ErrorHandler
> >   {
> >
> > public void exception(RiotException rex, int level, long line, long
> col);
> >
> >   }
> >
> >   public class CheckerIRI implements NodeChecker
> >   {
> >
> > public static void iriViolations(IRI iri, ErrorHandler errorHandler,
> ...)
> > {
> >   ...
> >
> >   Violation v = iter.next();
> >   ...
> >   if ( isError )
> >   // IRI errors are warning at the level of parsing - they got
> > through syntax checks.
> >   errorHandler.exception(new IRIException(v), Level.WARNING, line,
> col);
> >   ...
> > }
> >
> >   }
> >
> > After this, IRI violations could be analyzed by ErrorHandler:
> >
> > public class ErrorHandlerCustom implements ErrorHandler
> > {
> >
> >   public void exception(RiotException rex, int level, long line, long
> col)
> >   {
> > if (rex instanceof IRIException)
> > {
> >   IRIException iex = (IRIException)rex;
> >   Violation v = iex.getViolation();
> >   ...
> >   if (level == Level.ERROR) throw rex; // throw exception like
> > error() does now
> > }
> > ...
> >   }
> >
> > }
> >
> > On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:
> >> On 08/07/16 18:57, A. Soroka wrote:
> >>>
> >>> This may or may not be close to what you are looking for, but you might
> >>> try something like oaj.riot.RDFDataMgr::parse with a wrapper around
> >>> oaj.riot.system.StreamRDFLib::graph. You can subclass
> >>> oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level
> control
> >>> over the process and can throw exceptions or execute side-effects as
> >>> desired.
> >>>
> >>> ---
> >>> A. Soroka
> >>> The University of Virginia Library
> >>>
>  On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius <
> 

Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-31 Thread Andy Seaborne

On 30/07/16 15:43, Martynas Jusevičius wrote:

Andy,

why does ErrorHandlerStd throw RiotException?
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/system/ErrorHandlerFactory.java#L128

It fails to pass on URI violations that way, because RiotException is
too general. I guess this is the outcome of the ErrorHandler interface
methods.


Yes.  ErrorHandler is general.


Turns out there is already IRIException that captures the violations
(but unfortunately does not extend RiotException):


History but also not tying independent subsystems together into a big 
dependency tangle.



https://github.com/apache/jena/blob/master/jena-iri/src/main/java/org/apache/jena/iri/IRIException.java#L43

Couldnt ErrorHandler (re)use the IRIException? Maybe the interface
should be refactored based on logging (Riot)Exceptions instead of
String messages:


The parsers call the error handler when they find a structural parse 
error - that's what gives the line and column number and also means the 
error message is hand-crafted to the specific error. Some are warnings - 
the parsing continues.


The role of CheckerIRI.iriViolations is to convert IRI problems into the 
ErrorHandler framework.  It can't provide line/column as it's too late - 
the ParserProfile can do so and can call an ErrorHandler.


For more precise control, that is probably the way to go for Jena 3.1.0 
(3.0.1).  RDF/XML is different because the parser is not RIOT based - 
it's Jena original ARP parser in an adapter. The adapter does extract 
line and column information when it can.  Maybe being liberal with IRI 
creation and checking in a specific NodeChecker for the RDFStream driven 
checking process might be better for you.


This is a general framework for the parsing process - there is only so 
much the normal components provided for the framework can do. 
Eventually, precise control needs components to capture the specific 
requirements.


org.apache.jena.riot.system.IRIResolver does throw RiotExceptions.

Adding Errorhandler.errorIRI(IRIViolation, line, col) and 
Errorhandler.warningIRI(IRIViolation, line, col) is possible with 
investigation - need to go back through the parsers (just 
ParserProfilebase and LangRDFXML ??) to make sure it is actually going 
to work as required.  The parsing lifecycle may not fit it.


Andy



  public class IRIException extends RiotException
  {

public final Violation violation;

public IRIException(Violation violation)
{
  this.violation = violation;
}

public Violation getViolation()
{
  return violation;
}

  }

  public interface ErrorHandler
  {

public void exception(RiotException rex, int level, long line, long col);

  }

  public class CheckerIRI implements NodeChecker
  {

public static void iriViolations(IRI iri, ErrorHandler errorHandler, ...)
{
  ...

  Violation v = iter.next();
  ...
  if ( isError )
  // IRI errors are warning at the level of parsing - they got
through syntax checks.
  errorHandler.exception(new IRIException(v), Level.WARNING, line, col);
  ...
}

  }

After this, IRI violations could be analyzed by ErrorHandler:

public class ErrorHandlerCustom implements ErrorHandler
{

  public void exception(RiotException rex, int level, long line, long col)
  {
if (rex instanceof IRIException)
{
  IRIException iex = (IRIException)rex;
  Violation v = iex.getViolation();
  ...
  if (level == Level.ERROR) throw rex; // throw exception like
error() does now
}
...
  }

}

On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:

On 08/07/16 18:57, A. Soroka wrote:


This may or may not be close to what you are looking for, but you might
try something like oaj.riot.RDFDataMgr::parse with a wrapper around
oaj.riot.system.StreamRDFLib::graph. You can subclass
oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level control
over the process and can throw exceptions or execute side-effects as
desired.

---
A. Soroka
The University of Virginia Library


On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius 
wrote:

Hey,

I have implemented an RDF/POST parser which extends ReaderRIOTBase:

https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java

It silently accepts broken URIs, so I want the behavior to depend on
ParserProfile, and throw exceptions in case of strict error handler.

I'm reading Model using Model.read(InputStream in, String base, String
lang), so the question is: how do I set the (strict) error handler
before reading it?



Model.read does not expose

See ExRIOT_2 which sets the ErrorHandler.

https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java

Create a ReaderRIOT, set the error handler.

See also:
ErrorHandlerFactory.setDefaultErrorHandler

Or, for specifically IRIs, you might want to use 

Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-25 Thread Martynas Jusevičius
OK nevermind, that was a bad idea. Throwing an exception (after the
parse errors are collected) solves this.

On Mon, Jul 25, 2016 at 7:43 PM, Martynas Jusevičius
 wrote:
> Isn't there a way to do this uniformly, for any Reader? That would be
> much preferred.
>
> I think I might be able to do what I need with a custom ErrorHandler.
> The downside is that it exposes only error message, and not the raw
> URI value.
>
> Couldn't the violations be passed to Model and then exposed as
> List getParseViolations() or smth? That is probably not
> clean from the abstraction point of view, but where Model is the only
> contract, passing other information along gets complicated.
>
> On Sun, Jul 24, 2016 at 7:56 PM, Andy Seaborne  wrote:
>> On 24/07/16 10:35, Martynas Jusevičius wrote:
>>>
>>> Let me put it that way: can I successfully parse a Model with invalid URI
>>> values and also get a report saying which values were invalid and why? So
>>> that it could be presented to the user as error messages.
>>
>>
>> ParserProfile is closer to the parsing process (not for RDF/XML for JSON-LD)
>>
>> It is ParserProfileChecker that does the URI checking and error reporting.
>>
>> URI nodes are made by a FactoryRDF in ParserProfileBase.  It has the string
>> and the line/column information.
>>
>> You'll need to look at makeIRI/resolveIRI as well (used in prefix handling).
>>
>> For RDF/XML see LangRDFXML.HandlerSink
>>
>> For JSON-LD is is hard to get the line/colun because the parser does all
>> JSON parsing, forms an intermediate form then hands it over to RIOT.
>>
>> Andy
>>
>>
>>>
>>> On Sat, 23 Jul 2016 at 01:37, Martynas Jusevičius 
>>> wrote:
>>>
 Is it possible to let the Model parse silently and afterwards somehow
 retrieve org.apache.jena.iri.Violation instances from the
 ErrorHandler?

 Currently I'm implementing a custom ErrorHandler that would collect
 violations instead of logging them. But ErrorHandler only provides
 String message, long line, long col and doesn't know which IRI value
 caused the violation (which I would like to get).

 On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:
>
> On 08/07/16 18:57, A. Soroka wrote:
>>
>>
>> This may or may not be close to what you are looking for, but you might
>> try something like oaj.riot.RDFDataMgr::parse with a wrapper around
>> oaj.riot.system.StreamRDFLib::graph. You can subclass
>> oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level

 control
>>
>> over the process and can throw exceptions or execute side-effects as
>> desired.
>>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>>> On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius 
>
>>> wrote:
>>>
>>> Hey,
>>>
>>> I have implemented an RDF/POST parser which extends ReaderRIOTBase:
>>>
>>>

 https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java
>>>
>>>
>>> It silently accepts broken URIs, so I want the behavior to depend on
>>> ParserProfile, and throw exceptions in case of strict error handler.
>>>
>>> I'm reading Model using Model.read(InputStream in, String base, String
>>> lang), so the question is: how do I set the (strict) error handler
>>> before reading it?
>
>
>
> Model.read does not expose
>
> See ExRIOT_2 which sets the ErrorHandler.
>
>

 https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java
>
>
> Create a ReaderRIOT, set the error handler.
>
> See also:
> ErrorHandlerFactory.setDefaultErrorHandler
>
> Or, for specifically IRIs, you might want to use ParserProfileBase or a
> derivative rather than ParserProfileChecker
>
>
>>>
>>> Also, what is the difference/connection between ErrorHandler and
>>> RDFErrorHandler?
>>>
>>>

 https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/ErrorHandler.html
>>>
>>>
>>>

 https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFErrorHandler.html
>
>
>
> RDFErrorHandler is used the ARP, for RDF/XML parsing.
>
> It is adapted to ErrorHandler by RIOT.
>
>>>
>>> Thanks,
>>>
>>> Martynas
>>> atomgraph.com
>>
>>
>>
>

>>>
>>


Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-25 Thread Martynas Jusevičius
Isn't there a way to do this uniformly, for any Reader? That would be
much preferred.

I think I might be able to do what I need with a custom ErrorHandler.
The downside is that it exposes only error message, and not the raw
URI value.

Couldn't the violations be passed to Model and then exposed as
List getParseViolations() or smth? That is probably not
clean from the abstraction point of view, but where Model is the only
contract, passing other information along gets complicated.

On Sun, Jul 24, 2016 at 7:56 PM, Andy Seaborne  wrote:
> On 24/07/16 10:35, Martynas Jusevičius wrote:
>>
>> Let me put it that way: can I successfully parse a Model with invalid URI
>> values and also get a report saying which values were invalid and why? So
>> that it could be presented to the user as error messages.
>
>
> ParserProfile is closer to the parsing process (not for RDF/XML for JSON-LD)
>
> It is ParserProfileChecker that does the URI checking and error reporting.
>
> URI nodes are made by a FactoryRDF in ParserProfileBase.  It has the string
> and the line/column information.
>
> You'll need to look at makeIRI/resolveIRI as well (used in prefix handling).
>
> For RDF/XML see LangRDFXML.HandlerSink
>
> For JSON-LD is is hard to get the line/colun because the parser does all
> JSON parsing, forms an intermediate form then hands it over to RIOT.
>
> Andy
>
>
>>
>> On Sat, 23 Jul 2016 at 01:37, Martynas Jusevičius 
>> wrote:
>>
>>> Is it possible to let the Model parse silently and afterwards somehow
>>> retrieve org.apache.jena.iri.Violation instances from the
>>> ErrorHandler?
>>>
>>> Currently I'm implementing a custom ErrorHandler that would collect
>>> violations instead of logging them. But ErrorHandler only provides
>>> String message, long line, long col and doesn't know which IRI value
>>> caused the violation (which I would like to get).
>>>
>>> On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:

 On 08/07/16 18:57, A. Soroka wrote:
>
>
> This may or may not be close to what you are looking for, but you might
> try something like oaj.riot.RDFDataMgr::parse with a wrapper around
> oaj.riot.system.StreamRDFLib::graph. You can subclass
> oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level
>>>
>>> control
>
> over the process and can throw exceptions or execute side-effects as
> desired.
>
> ---
> A. Soroka
> The University of Virginia Library
>
>> On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius > wrote:
>>
>> Hey,
>>
>> I have implemented an RDF/POST parser which extends ReaderRIOTBase:
>>
>>
>>>
>>> https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java
>>
>>
>> It silently accepts broken URIs, so I want the behavior to depend on
>> ParserProfile, and throw exceptions in case of strict error handler.
>>
>> I'm reading Model using Model.read(InputStream in, String base, String
>> lang), so the question is: how do I set the (strict) error handler
>> before reading it?



 Model.read does not expose

 See ExRIOT_2 which sets the ErrorHandler.


>>>
>>> https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java


 Create a ReaderRIOT, set the error handler.

 See also:
 ErrorHandlerFactory.setDefaultErrorHandler

 Or, for specifically IRIs, you might want to use ParserProfileBase or a
 derivative rather than ParserProfileChecker


>>
>> Also, what is the difference/connection between ErrorHandler and
>> RDFErrorHandler?
>>
>>
>>>
>>> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/ErrorHandler.html
>>
>>
>>
>>>
>>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFErrorHandler.html



 RDFErrorHandler is used the ARP, for RDF/XML parsing.

 It is adapted to ErrorHandler by RIOT.

>>
>> Thanks,
>>
>> Martynas
>> atomgraph.com
>
>
>

>>>
>>
>


Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-24 Thread Martynas Jusevičius
Let me put it that way: can I successfully parse a Model with invalid URI
values and also get a report saying which values were invalid and why? So
that it could be presented to the user as error messages.

On Sat, 23 Jul 2016 at 01:37, Martynas Jusevičius 
wrote:

> Is it possible to let the Model parse silently and afterwards somehow
> retrieve org.apache.jena.iri.Violation instances from the
> ErrorHandler?
>
> Currently I'm implementing a custom ErrorHandler that would collect
> violations instead of logging them. But ErrorHandler only provides
> String message, long line, long col and doesn't know which IRI value
> caused the violation (which I would like to get).
>
> On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:
> > On 08/07/16 18:57, A. Soroka wrote:
> >>
> >> This may or may not be close to what you are looking for, but you might
> >> try something like oaj.riot.RDFDataMgr::parse with a wrapper around
> >> oaj.riot.system.StreamRDFLib::graph. You can subclass
> >> oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level
> control
> >> over the process and can throw exceptions or execute side-effects as
> >> desired.
> >>
> >> ---
> >> A. Soroka
> >> The University of Virginia Library
> >>
> >>> On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius  >
> >>> wrote:
> >>>
> >>> Hey,
> >>>
> >>> I have implemented an RDF/POST parser which extends ReaderRIOTBase:
> >>>
> >>>
> https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java
> >>>
> >>> It silently accepts broken URIs, so I want the behavior to depend on
> >>> ParserProfile, and throw exceptions in case of strict error handler.
> >>>
> >>> I'm reading Model using Model.read(InputStream in, String base, String
> >>> lang), so the question is: how do I set the (strict) error handler
> >>> before reading it?
> >
> >
> > Model.read does not expose
> >
> > See ExRIOT_2 which sets the ErrorHandler.
> >
> >
> https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java
> >
> > Create a ReaderRIOT, set the error handler.
> >
> > See also:
> > ErrorHandlerFactory.setDefaultErrorHandler
> >
> > Or, for specifically IRIs, you might want to use ParserProfileBase or a
> > derivative rather than ParserProfileChecker
> >
> >
> >>>
> >>> Also, what is the difference/connection between ErrorHandler and
> >>> RDFErrorHandler?
> >>>
> >>>
> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/ErrorHandler.html
> >>>
> >>>
> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFErrorHandler.html
> >
> >
> > RDFErrorHandler is used the ARP, for RDF/XML parsing.
> >
> > It is adapted to ErrorHandler by RIOT.
> >
> >>>
> >>> Thanks,
> >>>
> >>> Martynas
> >>> atomgraph.com
> >>
> >>
> >
>


Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-22 Thread Martynas Jusevičius
Is it possible to let the Model parse silently and afterwards somehow
retrieve org.apache.jena.iri.Violation instances from the
ErrorHandler?

Currently I'm implementing a custom ErrorHandler that would collect
violations instead of logging them. But ErrorHandler only provides
String message, long line, long col and doesn't know which IRI value
caused the violation (which I would like to get).

On Fri, Jul 8, 2016 at 11:28 PM, Andy Seaborne  wrote:
> On 08/07/16 18:57, A. Soroka wrote:
>>
>> This may or may not be close to what you are looking for, but you might
>> try something like oaj.riot.RDFDataMgr::parse with a wrapper around
>> oaj.riot.system.StreamRDFLib::graph. You can subclass
>> oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level control
>> over the process and can throw exceptions or execute side-effects as
>> desired.
>>
>> ---
>> A. Soroka
>> The University of Virginia Library
>>
>>> On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius 
>>> wrote:
>>>
>>> Hey,
>>>
>>> I have implemented an RDF/POST parser which extends ReaderRIOTBase:
>>>
>>> https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java
>>>
>>> It silently accepts broken URIs, so I want the behavior to depend on
>>> ParserProfile, and throw exceptions in case of strict error handler.
>>>
>>> I'm reading Model using Model.read(InputStream in, String base, String
>>> lang), so the question is: how do I set the (strict) error handler
>>> before reading it?
>
>
> Model.read does not expose
>
> See ExRIOT_2 which sets the ErrorHandler.
>
> https://github.com/apache/jena/blob/master/jena-arq/src-examples/arq/examples/riot/ExRIOT_2.java
>
> Create a ReaderRIOT, set the error handler.
>
> See also:
> ErrorHandlerFactory.setDefaultErrorHandler
>
> Or, for specifically IRIs, you might want to use ParserProfileBase or a
> derivative rather than ParserProfileChecker
>
>
>>>
>>> Also, what is the difference/connection between ErrorHandler and
>>> RDFErrorHandler?
>>>
>>> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/ErrorHandler.html
>>>
>>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFErrorHandler.html
>
>
> RDFErrorHandler is used the ARP, for RDF/XML parsing.
>
> It is adapted to ErrorHandler by RIOT.
>
>>>
>>> Thanks,
>>>
>>> Martynas
>>> atomgraph.com
>>
>>
>


Re: Setting (strict) error handler before before reading Model (Jena 2.11.0)

2016-07-08 Thread A. Soroka
This may or may not be close to what you are looking for, but you might try 
something like oaj.riot.RDFDataMgr::parse with a wrapper around 
oaj.riot.system.StreamRDFLib::graph. You can subclass 
oaj.riot.system.StreamRDFWrapper for that. Then you have tuple-level control 
over the process and can throw exceptions or execute side-effects as desired.

---
A. Soroka
The University of Virginia Library

> On Jul 8, 2016, at 1:46 PM, Martynas Jusevičius  wrote:
> 
> Hey,
> 
> I have implemented an RDF/POST parser which extends ReaderRIOTBase:
> https://github.com/AtomGraph/Core/blob/master/src/main/java/org/graphity/core/riot/lang/RDFPostReader.java
> 
> It silently accepts broken URIs, so I want the behavior to depend on
> ParserProfile, and throw exceptions in case of strict error handler.
> 
> I'm reading Model using Model.read(InputStream in, String base, String
> lang), so the question is: how do I set the (strict) error handler
> before reading it?
> 
> Also, what is the difference/connection between ErrorHandler and
> RDFErrorHandler?
> https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/system/ErrorHandler.html
> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/RDFErrorHandler.html
> 
> Thanks,
> 
> Martynas
> atomgraph.com