Class 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate final classNested classes/interfaces inherited from interface RDFParser
RDFParser.ParseResult -
Field Summary
FieldsFields inherited from class AbstractRDFParser
threadGroup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RDF4JCreate a newRDFfor a parse session.org.eclipse.rdf4j.rio.ParserConfigGet the RDF4JParserConfigto use.protected org.eclipse.rdf4j.rio.RDFHandlerprotected voidprotected RDF4JParserPrepare a clone of this RDFParser which have been checked and completed.voidsetParserConfig(org.eclipse.rdf4j.rio.ParserConfig parserConfig) Set an RDF4JParserConfigto useMethods inherited from class AbstractRDFParser
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
-
Field Details
-
rdf4jTermFactory
-
parserConfig
private org.eclipse.rdf4j.rio.ParserConfig parserConfig
-
-
Constructor Details
-
RDF4JParser
public RDF4JParser()
-
-
Method Details
-
createRDFTermFactory
Description copied from class:AbstractRDFParserCreate a newRDFfor a parse session.This is called by
AbstractRDFParser.parse()to setAbstractRDFParser.rdfTermFactory(RDF)if it isOptional.empty().As parsed blank nodes might be made with
RDF.createBlankNode(String), each call to this method SHOULD return a new RDF instance.- Overrides:
createRDFTermFactoryin classAbstractRDFParser<RDF4JParser>- Returns:
- A new
RDF
-
prepareForParsing
Description copied from class:AbstractRDFParserPrepare a clone of this RDFParser which have been checked and completed.The returned clone will always have
AbstractRDFParser.getTarget()andAbstractRDFParser.getRdfTermFactory()present.If the
AbstractRDFParser.getSourceFile()is present, but theAbstractRDFParser.getBase()is not present, the base will be set to thefile:///IRI for the Path's real path (e.g. resolving any symbolic links).- Overrides:
prepareForParsingin classAbstractRDFParser<RDF4JParser>- Returns:
- A completed and checked clone of this RDFParser
- Throws:
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)
-
parseSynchronusly
Description copied from class:AbstractRDFParserParseAbstractRDFParser.sourceInputStream,AbstractRDFParser.sourceFileorAbstractRDFParser.sourceIri.One of the source fields MUST be present, as checked by
AbstractRDFParser.checkSource().AbstractRDFParser.checkBaseRequired()is called to verify ifAbstractRDFParser.getBase()is required.- Specified by:
parseSynchronuslyin classAbstractRDFParser<RDF4JParser>- Throws:
IOException- If the source could not be read
-
getParserConfig
public org.eclipse.rdf4j.rio.ParserConfig getParserConfig()Get the RDF4JParserConfigto 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
ParserConfigand setsetParserConfig(ParserConfig).- Returns:
- The RDF4J
ParserConfig
-
setParserConfig
public void setParserConfig(org.eclipse.rdf4j.rio.ParserConfig parserConfig) Set an RDF4JParserConfigto use- Parameters:
parserConfig- Parser configuration
-
makeRDFHandler
protected org.eclipse.rdf4j.rio.RDFHandler makeRDFHandler()
-