Nocturnally Psychologizing Millipede

npm

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

rdf-ns

0.1.0 • Public • Published

RDF Namespace

Simple helper object for referencing RDF namespaces, library-independent. Inspired by RDFLib.js.

Instead of:

Vocab: {
  'rdfs': {
    'seeAlso': 'http://www.w3.org/2000/01/rdf-schema#seeAlso',
    'subClassOf': 'http://www.w3.org/2000/01/rdf-schema#subClassOf'
  }
}
 
var seeAlso = Vocab.rdfs.seeAlso

Do:

var ns = require('rdf-ns')()
var rdfs = ns.base('http://www.w3.org/2000/01/rdf-schema#')
 
var seeAlso = rdfs('seeAlso')
 
console.log(seeAlso)  // -> 'http://www.w3.org/2000/01/rdf-schema#seeAlso'

You can also inject an RDF library, and get back NamedNode instances.

var rdf = require('rdflib')
var ns = require('rdf-ns')(rdf)
var rdfs = ns.base('http://www.w3.org/2000/01/rdf-schema#')
 
var seeAlso = rdfs('seeAlso')
 
console.log(seeAlso)  
// -> NamedNode(<http://www.w3.org/2000/01/rdf-schema#seeAlso>)

Keywords

install

npm i rdf-ns

Downloadsweekly downloads

157

version

0.1.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability