npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

solid-namespace

0.2.0 • Public • Published

Solid Namespace

NPM Version

A collection of common RDF namespaces used in the Solid project.

solid-namespace can be used with any RDF/JS-compatible library (e.g. rdflib.js).

Usage

You can use this library in two ways.

  1. With a RDF JS library to get NamedNodes
  2. Without a library to get url strings

With a rdf library

If a rdf library is provided then the map of namespaces given will be the result of calling rdflib.Namespace on the namespace urls.

const $rdf = require('rdflib');
const ns = require('solid-namespace')($rdf);
const store = $rdf.graph();
    
let me = ...;
let name = store.any(me, ns.vcard('fn')) || store.any(me, ns.foaf('name'));
 
console.log(ns.foaf('name')); // -> NamedNode(<http://xmlns.com/foaf/0.1/name>)

Without a rdf library

const ns = require('solid-namespace')();
console.log(ns.foaf('name')); // -> "http://xmlns.com/foaf/0.1/name"

install

npm i solid-namespace

Downloadsweekly downloads

257

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability