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).
You can use this library in two ways.
- With a RDF JS library to get NamedNodes
- Without a library to get url strings
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>)
const ns = require('solid-namespace')();
console.log(ns.foaf('name')); // -> "http://xmlns.com/foaf/0.1/name"