Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

linked-data-box

rm3web29BSD-2-Clause0.0.6

A lightweight data structure for linked data (RDF / JSON-LD style)

rdf, jsonld, hypermedia, linked-data, json-ld, semantic

readme

Linked Data Box

Greenkeeper badge

Build StatusDependency Statusnpm version

This is a lightweight data structure to convey RDF / JSON-LD styled "linked" or "semantic" metadata around. Very specifically and concretely, from a metadata editor on the browser to the server side.

Example usage

On the server side, you might run something like this:

var v = new LinkedDataBox();
v.addTag("http://schema.org/name", { "@id": "https://github.com/wirehead"});

And then when you want to send it to the server side, either as a hidden form value or as a AJAX JSON request, you can just use JSON.stringify() on the LinkedDataBox -- Don't worry about turning it into JSON, the toJSON method has already been implemented.

var vstr = JSON.stringify(v);

And then on the server side, you might run something like this:

var v = new LinkedDataBox(req.body.metadata);
var arr = [];
v.iterateTags((pred, tag) => {
  arr.push({pred,tag});
});

So that you can add the tags to your favorite triple-store or SQL database.

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

Unreleased

0.0.6 - 2016-02-14

Changed

  • Removed Node 0.12 support
  • Updated dependencies.

0.0.5 - 2016-02-14

Fixed

  • LinkedDataBox#hasTagId() and LinkedDataBox#hasTag() were broken with a missing predicate.

Changed

  • Updated dependencies.

0.0.4 - 2016-01-18

Added

  • LinkedDataBox#getTagId(), LinkedDataBox#hasTagId(), and LinkedDataBox#deleteTagId() have been added for when you are working with JSON-LD.

0.0.3 - 2016-01-16

Fixed

  • LinkedDataBox#mapTags() and LinkedDataBox#iterateTags() now return plain JS objects

Added

  • LinkedDataBox#mapTags() for when you want to make a new array

0.0.2 - 2015-12-20

Added

  • LinkedDataBox#iterateTags() now gives an index paramater

0.0.1 - 2015-12-19

Added

  • New project