Class JsonLdParser
-
Nested Class Summary
Nested classes/interfaces inherited from interface RDFParser
RDFParser.ParseResult -
Field Summary
Fields inherited from class AbstractRDFParser
threadGroup -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static URLprotected voidCheck that one and only one source is present and valid.contentType(String contentType) Specify the content type of the RDF syntax to parse.contentType(RDFSyntax rdfSyntax) Specify the content type of the RDF syntax to parse.protected JsonLdRDFCreate a newRDFfor a parse session.private JsonLdRDFprotected voidprivate ObjectMethods inherited from class AbstractRDFParser
asT, base, base, checkBaseRequired, checkContentType, checkIsAbsolute, checkTarget, clone, getBase, getContentType, getContentTypeSyntax, getRdfTermFactory, getSourceFile, getSourceInputStream, getSourceIri, getTarget, getTargetDataset, getTargetGraph, guessRDFSyntax, parse, prepareForParsing, rdfTermFactory, resetSource, resetTarget, source, source, source, source, target, target, target
-
Constructor Details
-
JsonLdParser
public JsonLdParser()
-
-
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<JsonLdParser>- Returns:
- A new
RDF
-
contentType
Description copied from interface:RDFParserSpecify the content type of the RDF syntax to parse.This option can be used to select the RDFSyntax of the source, overriding any
Content-Typeheaders or equivalent.The character set of the RDFSyntax is assumed to be
StandardCharsets.UTF_8unless overridden within the document (e.g.<?xml version="1.0" encoding="iso-8859-1"?>inRDFSyntax.RDFXML).This method will override any contentType set with
RDFParser.contentType(String).- Specified by:
contentTypein interfaceRDFParser- Overrides:
contentTypein classAbstractRDFParser<JsonLdParser>- Parameters:
rdfSyntax- AnRDFSyntaxto parse the source according to, e.g.RDFSyntax.TURTLE.- Returns:
- An
RDFParserthat will use the specified content type. - Throws:
IllegalArgumentException- If this RDFParser does not support the specified RDFSyntax.- See Also:
-
contentType
Description copied from interface:RDFParserSpecify the content type of the RDF syntax to parse.This option can be used to select the RDFSyntax of the source, overriding any
Content-Typeheaders or equivalent.The content type MAY include a
charsetparameter if the RDF media types permit it; the default charset isStandardCharsets.UTF_8unless overridden within the document.This method will override any contentType set with
RDFParser.contentType(RDFSyntax).- Specified by:
contentTypein interfaceRDFParser- Overrides:
contentTypein classAbstractRDFParser<JsonLdParser>- Parameters:
contentType- A content-type string, e.g.application/ld+jsonortext/turtle;charset="UTF-8"as specified by RFC7231.- Returns:
- An
RDFParserthat will use the specified content type. - Throws:
IllegalArgumentException- If the contentType has an invalid syntax, or this RDFParser does not support the specified contentType.- See Also:
-
asURL
- Throws:
IllegalStateException
-
checkSource
Description copied from class:AbstractRDFParserCheck that one and only one source is present and valid.Used by
AbstractRDFParser.parse().Subclasses might override this method, e.g. to support other source combinations, or to check if the sourceIri is resolvable.
- Overrides:
checkSourcein classAbstractRDFParser<JsonLdParser>- Throws:
IOException- If a source file can't be read
-
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<JsonLdParser>- Throws:
IOException- If the source could not be read
-
getJsonLdFactory
-
readSource
- Throws:
IOException
-