This package provides I/O operations for RDF/JS streams and datasets.
Depending on which kind of objects should be used for the I/O operations, there are three different options to import this package:
To import both, streams and datasets operations, use the main entrypoint:
import * as io from '@rdfjs/io'
If only dataset operations are required:
import * as datasetIo from '@rdfjs/io/dataset.js'
And, if only stream operations are required:
import * as streamIo from '@rdfjs/io/stream.js'
All operations require a factory argument. The factory must be an Environment that bundles multiple other factories. FetchFactory and FormatsFactory are required for the stream operations. Additionally, the DatasetFactory is required for dataset operations.
The following example loads a dataset from the given URL:
import * as io from '@rdfjs/io'
import factory from './factory.js'
const url = 'https://housemd.rdf-ext.org/person/gregory-house'
const dataset = await io.dataset.fromURL(url, { factory })
The following example loads the quads of the given URL as a stream of quads:
import * as io from '@rdfjs/io'
import factory from './factory.js'
const url = 'https://housemd.rdf-ext.org/person/gregory-house'
const stream = io.stream.fromURL(url, { factory })