# rdf-quad

> A convenience constructor for RDF quads

Latest version **2.0.0** (published 2025-01-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install rdf-quad
pnpm add rdf-quad
yarn add rdf-quad
bun add rdf-quad
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-01-08 |
| First published | 2017-11-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Ruben Taelman |
| Maintainers | rubensworks |
| Keywords | rdf, rdfjs, term, quad, triple, n3 |

## Links

- npm: https://www.npmjs.com/package/rdf-quad
- Repository: https://github.com/rubensworks/rdf-quad.js
- Homepage: https://github.com/rubensworks/rdf-quad.js#readme
- Issues: https://github.com/rubensworks/rdf-quad.js/issues
- npm.io page: https://npm.io/package/rdf-quad

## Dependencies (3)

- [rdf-string](https://npm.io/package/rdf-string.md) ^2.0.0
- [rdf-literal](https://npm.io/package/rdf-literal.md) ^2.0.0
- [rdf-data-factory](https://npm.io/package/rdf-data-factory.md) ^2.0.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-01-08
- 1.5.0 — 2020-08-31
- 1.4.0 — 2019-06-12
- 1.3.0 — 2018-11-08
- 1.2.2 — 2018-08-09
- 1.2.1 — 2018-08-09
- 1.2.0 — 2018-08-06
- 1.1.0 — 2017-12-14
- 1.0.0 — 2017-11-20

## README

# RDF Quad

[![npm version](https://badge.fury.io/js/rdf-quad.svg)](https://www.npmjs.com/package/rdf-quad)

A convenience constructor for RDF quads based on string-based terms, as done by [RDF-String](https://github.com/rubensworks/rdf-string.js).

If the value in the object position is not a string,
then it will be automatically converted to the proper RDF datatype using [RDF Literal](https://github.com/rubensworks/rdf-literal.js).

This produces quads according to the [RDFJS](https://github.com/rdfjs/representation-task-force/) specification.

## Usage

```javascript
const quad = require('rdf-quad');

// Object is an IRI
quad('http://example.org/subject', 'http://example.org/predicate', 'http://example.org/object');

// Object is a variable
quad('http://example.org/subject', 'http://example.org/predicate', '?variable');

// Object is a string literal
quad('http://example.org/subject', 'http://example.org/predicate', '"myString"', 'http://example.org/someGraph');

// Object is an integer
quad('http://example.org/subject', 'http://example.org/predicate', 123);

// Object is a boolean
quad('http://example.org/subject', 'http://example.org/predicate', true);

// Subject is a nested quad
quad('<<ex:s ex:p ex:o>>', 'http://example.org/predicate', 'http://example.org/object');
```

## License
This software is written by [Ruben Taelman](http://rubensworks.net/).

This code is released under the [MIT license](http://opensource.org/licenses/MIT).

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