Class RDFParser
java.lang.Object
org.xml.sax.helpers.DefaultHandler
org.semanticweb.owlapi.rdf.rdfxml.parser.RDFParser
- All Implemented Interfaces:
IRIProvider
,ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
This class parses the RDF according to the syntax specified in
http://www.w3.org/TR/rdf-
syntax-grammar/.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
void
endElement
(String uri, String localName, String qName) void
void
void
parse
(InputSource source, RDFConsumer inputConsumer) Parses RDF from given input source.void
popState()
Pops a state from the stack.void
processingInstruction
(String target, String data) void
Pushes a new state on the state stack.resolveIRI
(String iri) Resolves an IRI with the current base.void
setDocumentLocator
(Locator locator) void
setErrorHandler
(ErrorHandler errorHandler) Sets the error handler.void
void
startElement
(String uri, String localName, String qName, Attributes attributes) void
statementWithLiteralValue
(String subject, String predicate, String object, String dataType, String reificationID) Called when a statement with literal value is added to the model.void
statementWithResourceValue
(String subject, String predicate, String object, String reificationID) Called when a statement with resource value is added to the model.void
If condition b is true, throw an exception with provided message.void
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
RDFParser
public RDFParser()
-
-
Method Details
-
setDocumentLocator
- Specified by:
setDocumentLocator
in interfaceContentHandler
- Overrides:
setDocumentLocator
in classDefaultHandler
-
parse
Parses RDF from given input source.- Parameters:
source
- specifies where RDF comes frominputConsumer
- receives notifications about RDF parsing events- Throws:
SAXException
- SAX exceptionIOException
- if there was a problem reading from the output stream
-
setErrorHandler
Sets the error handler.- Parameters:
errorHandler
- the error handler
-
warning
- Specified by:
warning
in interfaceErrorHandler
- Overrides:
warning
in classDefaultHandler
- Throws:
SAXException
-
error
- Specified by:
error
in interfaceErrorHandler
- Overrides:
error
in classDefaultHandler
- Throws:
SAXException
-
fatalError
- Specified by:
fatalError
in interfaceErrorHandler
- Overrides:
fatalError
in classDefaultHandler
- Throws:
SAXException
-
startDocument
public void startDocument()- Specified by:
startDocument
in interfaceContentHandler
- Overrides:
startDocument
in classDefaultHandler
-
endDocument
public void endDocument()- Specified by:
endDocument
in interfaceContentHandler
- Overrides:
endDocument
in classDefaultHandler
-
startElement
public void startElement(@Nullable String uri, @Nullable String localName, @Nullable String qName, @Nullable Attributes attributes) throws SAXException - Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(@Nullable String uri, @Nullable String localName, @Nullable String qName) throws SAXException - Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
characters
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstruction
in interfaceContentHandler
- Overrides:
processingInstruction
in classDefaultHandler
-
pushState
Pushes a new state on the state stack.- Parameters:
s
- new state
-
popState
public void popState()Pops a state from the stack. -
resolveIRI
Resolves an IRI with the current base.- Parameters:
iri
- the IRI being resolved- Returns:
- the resolved IRI
-
statementWithResourceValue
public void statementWithResourceValue(String subject, String predicate, String object, @Nullable String reificationID) Called when a statement with resource value is added to the model.- Parameters:
subject
- IRI of the subject resourcepredicate
- IRI of the predicate resourceobject
- IRI of the object resourcereificationID
- if notnull
, contains IRI of the resource that will hold the reified statement
-
statementWithLiteralValue
public void statementWithLiteralValue(String subject, String predicate, String object, @Nullable String dataType, @Nullable String reificationID) Called when a statement with literal value is added to the model.- Parameters:
subject
- IRI of the subject resourcepredicate
- IRI of the predicate resourceobject
- literal object valuedataType
- the IRI of the literal's datatype (may benull
)reificationID
- if notnull
, contains IRI of the resource that will hold the reified statement
-
getIRI
- Specified by:
getIRI
in interfaceIRIProvider
- Parameters:
s
- input String- Returns:
- iri
-
verify
If condition b is true, throw an exception with provided message.- Parameters:
b
- condition to verifymessage
- message for the exception- Throws:
RDFParserException
- exception thrown
-