public class RDF4JParser extends AbstractRDFParser<RDF4JParser>
This can handle the RDF syntaxes RDFSyntax.JSONLD
,
RDFSyntax.NQUADS
, RDFSyntax.NTRIPLES
,
RDFSyntax.RDFXML
, RDFSyntax.TRIG
and RDFSyntax.TURTLE
- additional syntaxes can be supported by including the corresponding
rdf4j-rio-* module on the classpath.
RDFParser.ParseResult
threadGroup
Constructor and Description |
---|
RDF4JParser() |
Modifier and Type | Method and Description |
---|---|
protected RDF4J |
createRDFTermFactory()
Create a new
RDF for a parse session. |
org.eclipse.rdf4j.rio.ParserConfig |
getParserConfig()
Get the RDF4J
ParserConfig to use. |
protected org.eclipse.rdf4j.rio.RDFHandler |
makeRDFHandler() |
protected void |
parseSynchronusly()
|
protected RDF4JParser |
prepareForParsing()
Prepare a clone of this RDFParser which have been checked and completed.
|
void |
setParserConfig(org.eclipse.rdf4j.rio.ParserConfig parserConfig)
Set an RDF4J
ParserConfig to use |
asT, base, base, checkBaseRequired, checkContentType, checkIsAbsolute, checkSource, checkTarget, clone, contentType, contentType, getBase, getContentType, getContentTypeSyntax, getRdfTermFactory, getSourceFile, getSourceInputStream, getSourceIri, getTarget, getTargetDataset, getTargetGraph, guessRDFSyntax, parse, rdfTermFactory, resetSource, resetTarget, source, source, source, source, target, target, target
public RDF4JParser()
protected RDF4J createRDFTermFactory()
AbstractRDFParser
RDF
for a parse session.
This is called by AbstractRDFParser.parse()
to set AbstractRDFParser.rdfTermFactory(RDF)
if
it is Optional.empty()
.
As parsed blank nodes might be made with
RDF.createBlankNode(String)
, each call to this method SHOULD
return a new RDF instance.
createRDFTermFactory
in class AbstractRDFParser<RDF4JParser>
RDF
protected RDF4JParser prepareForParsing() throws IOException, IllegalStateException
AbstractRDFParser
The returned clone will always have AbstractRDFParser.getTarget()
and
AbstractRDFParser.getRdfTermFactory()
present.
If the AbstractRDFParser.getSourceFile()
is present, but the AbstractRDFParser.getBase()
is
not present, the base will be set to the file:///
IRI for
the Path's real path (e.g. resolving any symbolic links).
prepareForParsing
in class AbstractRDFParser<RDF4JParser>
IOException
- If the source was not accessible (e.g. a file was not found)IllegalStateException
- If the parser was not in a compatible setting (e.g.
contentType was an invalid string)protected void parseSynchronusly() throws IOException
AbstractRDFParser
AbstractRDFParser.sourceInputStream
, AbstractRDFParser.sourceFile
or
AbstractRDFParser.sourceIri
.
One of the source fields MUST be present, as checked by
AbstractRDFParser.checkSource()
.
AbstractRDFParser.checkBaseRequired()
is called to verify if AbstractRDFParser.getBase()
is
required.
parseSynchronusly
in class AbstractRDFParser<RDF4JParser>
IOException
- If the source could not be readpublic org.eclipse.rdf4j.rio.ParserConfig getParserConfig()
ParserConfig
to use.
If no parser config is set, the default configuration is provided.
Note: The parser config is mutable - changes in the
returned config is reflected in this instance of the parser. To avoid
mutation, create a new ParserConfig
and set
setParserConfig(ParserConfig)
.
ParserConfig
public void setParserConfig(org.eclipse.rdf4j.rio.ParserConfig parserConfig)
ParserConfig
to useparserConfig
- Parser configurationprotected org.eclipse.rdf4j.rio.RDFHandler makeRDFHandler()
Copyright © 2015–2018 The Apache Software Foundation. All rights reserved.