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>)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    7
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    7
  • 0.0.2
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i rdf-ns

Weekly Downloads

8

Version

0.1.0

License

MIT

Last publish

Collaborators

  • codenamedmitri