Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.rdf.arp.test
Class NTripleTestSuite.TestHandler  view NTripleTestSuite.TestHandler download NTripleTestSuite.TestHandler.java

java.lang.Object
  extended bycom.hp.hpl.jena.rdf.arp.ARPSaxErrorHandler
      extended bycom.hp.hpl.jena.rdf.arp.test.NTripleTestSuite.TestHandler
All Implemented Interfaces:
com.hp.hpl.jena.rdf.arp.ARPEventHandler, org.xml.sax.ErrorHandler, com.hp.hpl.jena.rdf.arp.ExtendedHandler, com.hp.hpl.jena.rdf.arp.NamespaceHandler, com.hp.hpl.jena.rdf.arp.StatementHandler
Enclosing class:
NTripleTestSuite

static class NTripleTestSuite.TestHandler
extends com.hp.hpl.jena.rdf.arp.ARPSaxErrorHandler
implements com.hp.hpl.jena.rdf.arp.ARPEventHandler, org.xml.sax.ErrorHandler


Field Summary
(package private)  java.util.Set anon
           
(package private)  int countDown
           
(package private)  boolean hasErrors
           
(package private)  java.util.Set oldAnon
           
(package private)  int state
           
(package private)  int xCountDown
           
 
Fields inherited from class com.hp.hpl.jena.rdf.arp.ARPSaxErrorHandler
errorHandler
 
Constructor Summary
(package private) NTripleTestSuite.TestHandler(com.hp.hpl.jena.rdf.model.RDFErrorHandler eh)
           
(package private) NTripleTestSuite.TestHandler(com.hp.hpl.jena.rdf.model.RDFErrorHandler eh, int cnt)
           
 
Method Summary
 void atEndOfFile()
           
 boolean discardNodesWithNodeID()
          This method is used to modify the behaviour of ARP concerning its reporting of bnode scope endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource) 55 .
 void endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource bnode)
          After this call, no more triples will be reported which use bnode.
 void endPrefixMapping(java.lang.String prefix)
          A namespace prefix is going out of scope.
 void endRDF()
          Called when the </rdf:RDF> tag is seen.
 void error(org.xml.sax.SAXParseException exception)
          Receive notification of a recoverable error.
 void fatalError(org.xml.sax.SAXParseException exception)
          Receive notification of a non-recoverable error.
 int getCount()
           
private  void seeing(com.hp.hpl.jena.rdf.arp.AResource subj)
           
private  void seen(com.hp.hpl.jena.rdf.arp.AResource subj)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          A namespace prefix is being defined..
 void startRDF()
          Called when the <rdf:RDF> tag is seen.
 void statement(com.hp.hpl.jena.rdf.arp.AResource subj, com.hp.hpl.jena.rdf.arp.AResource pred, com.hp.hpl.jena.rdf.arp.ALiteral lit)
          A triple in the file.
 void statement(com.hp.hpl.jena.rdf.arp.AResource subj, com.hp.hpl.jena.rdf.arp.AResource pred, com.hp.hpl.jena.rdf.arp.AResource obj)
          A triple in the file.
 
Methods inherited from class com.hp.hpl.jena.rdf.arp.ARPSaxErrorHandler
warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ErrorHandler
warning
 

Field Detail

xCountDown

final int xCountDown

anon

java.util.Set anon

oldAnon

java.util.Set oldAnon

state

int state

countDown

int countDown

hasErrors

boolean hasErrors
Constructor Detail

NTripleTestSuite.TestHandler

NTripleTestSuite.TestHandler(com.hp.hpl.jena.rdf.model.RDFErrorHandler eh)

NTripleTestSuite.TestHandler

NTripleTestSuite.TestHandler(com.hp.hpl.jena.rdf.model.RDFErrorHandler eh,
                             int cnt)
Method Detail

statement

public void statement(com.hp.hpl.jena.rdf.arp.AResource subj,
                      com.hp.hpl.jena.rdf.arp.AResource pred,
                      com.hp.hpl.jena.rdf.arp.AResource obj)
Description copied from interface: com.hp.hpl.jena.rdf.arp.StatementHandler
A triple in the file.

Specified by:
statement in interface com.hp.hpl.jena.rdf.arp.StatementHandler

seeing

private void seeing(com.hp.hpl.jena.rdf.arp.AResource subj)

seen

private void seen(com.hp.hpl.jena.rdf.arp.AResource subj)

statement

public void statement(com.hp.hpl.jena.rdf.arp.AResource subj,
                      com.hp.hpl.jena.rdf.arp.AResource pred,
                      com.hp.hpl.jena.rdf.arp.ALiteral lit)
Description copied from interface: com.hp.hpl.jena.rdf.arp.StatementHandler
A triple in the file.

Specified by:
statement in interface com.hp.hpl.jena.rdf.arp.StatementHandler

endBNodeScope

public void endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource bnode)
Description copied from interface: com.hp.hpl.jena.rdf.arp.ExtendedHandler
After this call, no more triples will be reported which use bnode. This is called exactly once for each blank nodes. Whether this includes nodes with an rdf:nodeID is controlled by ExtendedHandler.discardNodesWithNodeID()>ExtendedHandler.discardNodesWithNodeID() 55 .

The contract is robust against syntax errors in input, and exceptions being thrown by the StatementHandler.

Specified by:
endBNodeScope in interface com.hp.hpl.jena.rdf.arp.ExtendedHandler

startRDF

public void startRDF()
Description copied from interface: com.hp.hpl.jena.rdf.arp.ExtendedHandler
Called when the <rdf:RDF> tag is seen. (Also called when there is an implicit start of RDF content when the file consists only of RDF but omits the rdf:RDF tag).

Specified by:
startRDF in interface com.hp.hpl.jena.rdf.arp.ExtendedHandler

endRDF

public void endRDF()
Description copied from interface: com.hp.hpl.jena.rdf.arp.ExtendedHandler
Called when the </rdf:RDF> tag is seen. (Also called when there is an implicit end of RDF content e.g. when the file consists only of RDF but omits the rdf:RDF tag, or if there is an unrecoverable syntax error mid-file).

Robust against syntax errors in input, and exceptions being thrown by the StatementHandler.

Specified by:
endRDF in interface com.hp.hpl.jena.rdf.arp.ExtendedHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Description copied from interface: com.hp.hpl.jena.rdf.arp.NamespaceHandler
A namespace prefix is being defined..

Specified by:
startPrefixMapping in interface com.hp.hpl.jena.rdf.arp.NamespaceHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Description copied from interface: com.hp.hpl.jena.rdf.arp.NamespaceHandler
A namespace prefix is going out of scope. There is no guarantee that start and end PrefixMapping calls nest.

Specified by:
endPrefixMapping in interface com.hp.hpl.jena.rdf.arp.NamespaceHandler

atEndOfFile

public void atEndOfFile()

error

public void error(org.xml.sax.SAXParseException exception)
           throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ErrorHandler
Receive notification of a recoverable error.

This corresponds to the definition of "error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a validating parser would use this callback to report the violation of a validity constraint. The default behaviour is to take no action.

The SAX parser must continue to provide normal parsing events after invoking this method: it should still be possible for the application to process the document through to the end. If the application cannot do so, then the parser should report a fatal error even if the XML recommendation does not require it to do so.

Filters may use this method to report other, non-XML errors as well.

Specified by:
error in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException exception)
                throws org.xml.sax.SAXException
Description copied from interface: org.xml.sax.ErrorHandler
Receive notification of a non-recoverable error.

There is an apparent contradiction between the documentation for this method and the documentation for ContentHandler.endDocument()>ContentHandler.endDocument() 55 . Until this ambiguity is resolved in a future major release, clients should make no assumptions about whether endDocument() will or will not be invoked when the parser has reported a fatalError() or thrown an exception.

This corresponds to the definition of "fatal error" in section 1.2 of the W3C XML 1.0 Recommendation. For example, a parser would use this callback to report the violation of a well-formedness constraint.

The application must assume that the document is unusable after the parser has invoked this method, and should continue (if at all) only for the sake of collecting additional error messages: in fact, SAX parsers are free to stop reporting any other events once this method has been invoked.

Specified by:
fatalError in interface org.xml.sax.ErrorHandler

getCount

public int getCount()

discardNodesWithNodeID

public boolean discardNodesWithNodeID()
Description copied from interface: com.hp.hpl.jena.rdf.arp.ExtendedHandler
This method is used to modify the behaviour of ARP concerning its reporting of bnode scope ExtendedHandler.endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource)>ExtendedHandler.endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource) 55 .

If this returns true then blank nodes with an rdf:nodeID are not reported as they go out of scope at the end of file. This eliminates the unbounded memory cost of remembering such nodes.

If this returns false then the contract of ExtendedHandler.endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource)>ExtendedHandler.endBNodeScope(com.hp.hpl.jena.rdf.arp.AResource) 55 is honoured uniformly independent of whether a blank node has a nodeID or not.

If this method returns different values during the parsing of a single file, then the behaviour is undefined.

Specified by:
discardNodesWithNodeID in interface com.hp.hpl.jena.rdf.arp.ExtendedHandler