1.0.0 • Published 6 months ago

@rdfjs/io v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

@rdfjs/io

build status npm version

This package provides I/O operations for RDF/JS streams and datasets.

Usage

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'

Factory Argument

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.

Examples

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 })