By providing an object conforming to the Parser interface, you can handle
RDF serialisations other than text/turtle, which @inrupt/solid-client
supports by default. This can be useful to retrieve RDF data from sources
other than a Solid Pod.
A Parser has the following properties:
onQuad: Registers the callback with which parsed
Quads can be provided to
@inrupt/solid-client.
onError: Registers the callback with which @inrupt/solid-client can be
notified of errors parsing the input.
onComplete: Registers the callback with which @inrupt/solid-client can
be notified that parsing is complete.
parse: Accepts the serialised input string and an object containing the
input Resource's metadata.
The input metadata can be read using functions like [[getSourceUrl]] and
[[getContentType]].
For example, the following defines a parser that reads an RDFa serialisation
using the
rdfa-streaming-parser
library:
A Parser takes a string and generates Quads.
By providing an object conforming to the
Parser
interface, you can handle RDF serialisations other thantext/turtle
, which@inrupt/solid-client
supports by default. This can be useful to retrieve RDF data from sources other than a Solid Pod.A Parser has the following properties:
onQuad
: Registers the callback with which parsed Quads can be provided to@inrupt/solid-client
.onError
: Registers the callback with which@inrupt/solid-client
can be notified of errors parsing the input.onComplete
: Registers the callback with which@inrupt/solid-client
can be notified that parsing is complete.parse
: Accepts the serialised input string and an object containing the input Resource's metadata. The input metadata can be read using functions like [[getSourceUrl]] and [[getContentType]].For example, the following defines a parser that reads an RDFa serialisation using the rdfa-streaming-parser library: