rdf-ns
v0.1.0 rdf
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>)