public class JsonLdParser extends AbstractRDFParser<JsonLdParser>
RDFParser.ParseResult
threadGroup
Constructor and Description |
---|
JsonLdParser() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkSource()
Check that one and only one source is present and valid.
|
JsonLdParser |
contentType(RDFSyntax rdfSyntax)
Specify the content type of the RDF syntax to parse.
|
JsonLdParser |
contentType(String contentType)
Specify the content type of the RDF syntax to parse.
|
protected JsonLdRDF |
createRDFTermFactory()
Create a new
RDF for a parse session. |
protected void |
parseSynchronusly()
|
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
public JsonLdParser()
protected JsonLdRDF 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<JsonLdParser>
RDF
public JsonLdParser contentType(RDFSyntax rdfSyntax) throws IllegalArgumentException
RDFParser
This option can be used to select the RDFSyntax of the source, overriding
any Content-Type
headers or equivalent.
The character set of the RDFSyntax is assumed to be
StandardCharsets.UTF_8
unless overridden within the document
(e.g. <?xml version="1.0" encoding="iso-8859-1"?>
in
RDFSyntax.RDFXML
).
This method will override any contentType set with
RDFParser.contentType(String)
.
contentType
in interface RDFParser
contentType
in class AbstractRDFParser<JsonLdParser>
rdfSyntax
- An RDFSyntax
to parse the source according to, e.g.
RDFSyntax.TURTLE
.RDFParser
that will use the specified content type.IllegalArgumentException
- If this RDFParser does not support the specified RDFSyntax.RDFParser.contentType(String)
public JsonLdParser contentType(String contentType) throws IllegalArgumentException
RDFParser
This option can be used to select the RDFSyntax of the source, overriding
any Content-Type
headers or equivalent.
The content type MAY include a charset
parameter if the RDF
media types permit it; the default charset is
StandardCharsets.UTF_8
unless overridden within the document.
This method will override any contentType set with
RDFParser.contentType(RDFSyntax)
.
contentType
in interface RDFParser
contentType
in class AbstractRDFParser<JsonLdParser>
contentType
- A content-type string, e.g. application/ld+json
or text/turtle;charset="UTF-8"
as specified by
RFC7231.RDFParser
that will use the specified content type.IllegalArgumentException
- If the contentType has an invalid syntax, or this RDFParser
does not support the specified contentType.RDFParser.contentType(RDFSyntax)
protected void checkSource() throws IOException
AbstractRDFParser
Used by AbstractRDFParser.parse()
.
Subclasses might override this method, e.g. to support other source combinations, or to check if the sourceIri is resolvable.
checkSource
in class AbstractRDFParser<JsonLdParser>
IOException
- If a source file can't be readprotected 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<JsonLdParser>
IOException
- If the source could not be readCopyright © 2015–2018 The Apache Software Foundation. All rights reserved.