Package Exports
- solid-namespace
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (solid-namespace) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Solid Namespace
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.
- With a RDF JS library to get NamedNodes
- 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"