public class RDFParser extends DefaultHandler implements IRIProvider
Constructor and Description |
---|
RDFParser() |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
endDocument() |
void |
endElement(String uri,
String localName,
String qName) |
void |
error(SAXParseException e) |
void |
fatalError(SAXParseException e) |
IRI |
getIRI(String s) |
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 |
pushState(State s)
Pushes a new state on the state stack.
|
String |
resolveIRI(String iri)
Resolves an IRI with the current base.
|
void |
setDocumentLocator(Locator locator) |
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the error handler.
|
void |
startDocument() |
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 |
verify(boolean b,
String message)
If condition b is true, throw an exception with provided message.
|
void |
warning(SAXParseException e) |
endPrefixMapping, ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDecl
public void setDocumentLocator(@Nullable Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public void parse(InputSource source, RDFConsumer inputConsumer) throws SAXException, IOException
source
- specifies where RDF comes frominputConsumer
- receives notifications about RDF parsing eventsSAXException
- SAX exceptionIOException
- if there was a problem reading from the output streampublic void setErrorHandler(ErrorHandler errorHandler)
errorHandler
- the error handlerpublic void warning(@Nullable SAXParseException e) throws SAXException
warning
in interface ErrorHandler
warning
in class DefaultHandler
SAXException
public void error(@Nullable SAXParseException e) throws SAXException
error
in interface ErrorHandler
error
in class DefaultHandler
SAXException
public void fatalError(@Nullable SAXParseException e) throws SAXException
fatalError
in interface ErrorHandler
fatalError
in class DefaultHandler
SAXException
public void startDocument()
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
public void endDocument()
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
public void startElement(@Nullable String uri, @Nullable String localName, @Nullable String qName, @Nullable Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(@Nullable String uri, @Nullable String localName, @Nullable String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void characters(@Nullable char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void processingInstruction(@Nullable String target, @Nullable String data)
processingInstruction
in interface ContentHandler
processingInstruction
in class DefaultHandler
public void pushState(State s)
s
- new statepublic void popState()
public String resolveIRI(String iri)
iri
- the IRI being resolvedpublic void statementWithResourceValue(String subject, String predicate, String object, @Nullable String reificationID)
subject
- IRI of the subject resourcepredicate
- IRI of the predicate resourceobject
- IRI of the object resourcereificationID
- if not null
, contains IRI of the resource that will hold the
reified statementpublic void statementWithLiteralValue(String subject, String predicate, String object, @Nullable String dataType, @Nullable String reificationID)
subject
- IRI of the subject resourcepredicate
- IRI of the predicate resourceobject
- literal object valuedataType
- the IRI of the literal's datatype (may be null
)reificationID
- if not null
, contains IRI of the resource that will hold the
reified statementpublic IRI getIRI(String s)
getIRI
in interface IRIProvider
s
- input Stringpublic void verify(boolean b, String message)
b
- condition to verifymessage
- message for the exceptionRDFParserException
- exception thrownCopyright © 2020 The University of Manchester. All rights reserved.