# rdf-dataset-ext

> Util functions for easier RDF/JS DatasetCore handling

Latest version **1.1.0** (published 2023-09-12) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install rdf-dataset-ext
pnpm add rdf-dataset-ext
yarn add rdf-dataset-ext
bun add rdf-dataset-ext
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-09-12 |
| First published | 2019-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/rdf-dataset-ext) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Thomas Bergwinkl |
| Maintainers | bergos |
| Keywords | dataset, datasetcore, rdf, rdfjs, rdf-ext |

## Links

- npm: https://www.npmjs.com/package/rdf-dataset-ext
- Repository: https://github.com/rdf-ext/rdf-dataset-ext
- Issues: https://github.com/rdf-ext/rdf-dataset-ext/issues
- npm.io page: https://npm.io/package/rdf-dataset-ext

## Dependencies (2)

- [rdf-canonize](https://npm.io/package/rdf-canonize.md) ^3.0.0
- [readable-stream](https://npm.io/package/readable-stream.md) 3 - 4

## Recent versions

- 1.1.0 (latest) — 2023-09-12
- 1.0.1 — 2022-02-16
- 1.0.0 — 2019-06-06

## README

# rdf-dataset-ext

[![build status](https://img.shields.io/github/actions/workflow/status/rdf-ext/rdf-dataset-ext/test.yaml?branch=master)](https://github.com/rdf-ext/rdf-dataset-ext/actions/workflows/test.yaml)
[![npm version](https://img.shields.io/npm/v/rdf-dataset-ext.svg)](https://www.npmjs.com/package/rdf-dataset-ext)

Util functions for easier RDF/JS DatasetCore handling.

## Usage

All provided functions can be imported as properties of the package or directly from the file matching the function name.

Import `addAll` from property:

```
const { addAll } = require('rdf-dataset-ext')
```

Import `addAll` from file:

```
const addAll = require('rdf-dataset-ext/addAll')
```

### addAll(dataset, iterable)

Iterates over `iterable` and adds all quads to `dataset` by calling `.add` for each quad.
Returns the given `dataset`.

### deleteMatch(dataset, subject, predicate, object, graph)

Deletes all quads in the given `dataset` which match the given `subject`, `predicate`, `object`, `graph` pattern.
`.match` of `dataset` is used to find the matches and `.delete` to delete all matches.
Returns the given `dataset`.

### equals(a, b)

Tests if the datasets `a` and `b` contain the same quads without doing a normalization step beforehand.
That means Blank Node labels must also match.
The comparison is done by testing `.size` of both dataset for equality and by looping over all quads of `a` and check if `b` contains it using the `.has` method.
Returns `true` if both datasets are equal.
Otherwise `false` is returned. 

### async fromStream(dataset, stream)

Adds all quads from `stream` till the stream is finished.
Errors emitted by the stream are forwarded as Promise rejects.
Returns the given `dataset`.

### toCanonical(dataset)

Returns the canonical representation of the `dataset` as string.

### toStream(dataset)

Creates a Stream which emits all quads of the given `dataset`.
Returns the created stream.

---
_Source: https://npm.io/package/rdf-dataset-ext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
