public class RDFParser extends org.xml.sax.helpers.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 uri)
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 conditon b is true, throw an exception with provided message
|
void |
warning(SAXParseException e) |
endPrefixMapping, ignorableWhitespace, notationDecl, resolveEntity, skippedEntity, startPrefixMapping, unparsedEntityDeclpublic void parse(@Nonnull InputSource source, @Nonnull RDFConsumer inputConsumer) throws SAXException, IOException
source - specifies where RDF comes frominputConsumer - receives notifications about RDF parsing eventsSAXException - SAXExceptionIOException - IOExceptionpublic void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandlerpublic void setErrorHandler(@Nonnull ErrorHandler errorHandler)
errorHandler - the error handlerpublic void warning(SAXParseException e) throws SAXException
warning in interface ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void error(SAXParseException e) throws SAXException
error in interface ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void fatalError(SAXParseException e) throws SAXException
fatalError in interface ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void startDocument()
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerpublic void endDocument()
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerpublic void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void endElement(String uri, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerSAXExceptionpublic void processingInstruction(String target, String data)
processingInstruction in interface ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlerpublic void pushState(State s)
s - new statepublic void popState()
@Nonnull public String resolveIRI(@Nonnull String uri)
uri - the IRI being resolvedpublic void statementWithResourceValue(@Nonnull String subject, @Nonnull String predicate, @Nonnull 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 wold
the reified statementpublic void statementWithLiteralValue(@Nonnull String subject, @Nonnull String predicate, @Nonnull 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 wold
the reified statement@Nonnull public IRI getIRI(@Nonnull String s)
getIRI in interface IRIProviders - input Stringpublic void verify(boolean b,
@Nonnull
String message)
b - condition to verifymessage - message for the exceptionRDFParserException - exception thrownCopyright © 2015 The University of Manchester. All Rights Reserved.