How to use the rdflib.Namespace function in rdflib

To help you get started, we’ve selected a few rdflib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github solid / solid-ui / src / ns.js View on Github external
//
var thisModule = {}

module.exports = thisModule

var $rdf = require('rdflib')

// This used to be a faw function (no ".expand" but that caused the module exports all to be dropped)
thisModule.expand = function (prefixed) {
  var pair = prefixed.split(':')
  if (pair.length === 0) throw new Error('Prefixed name has no colon: ' + prefixed)
  if (!(pair[0] in thisModule)) throw new Error('Unregistered namespace prefix in: ' + prefixed)
  return thisModule[pair[0]](pair[1])
}

thisModule.auth = $rdf.Namespace('http://www.w3.org/ns/auth/acl#') // @@ obsolete - use acl:
thisModule.acl = $rdf.Namespace('http://www.w3.org/ns/auth/acl#')
thisModule.arg = $rdf.Namespace('http://www.w3.org/ns/pim/arg#')
thisModule.cal = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#')
thisModule.contact = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/contact#')
thisModule.dc = $rdf.Namespace('http://purl.org/dc/elements/1.1/')
thisModule.dct = $rdf.Namespace('http://purl.org/dc/terms/')
thisModule.doap = $rdf.Namespace('http://usefulinc.com/ns/doap#')
thisModule.foaf = $rdf.Namespace('http://xmlns.com/foaf/0.1/')
thisModule.http = $rdf.Namespace('http://www.w3.org/2007/ont/http#')
thisModule.httph = $rdf.Namespace('http://www.w3.org/2007/ont/httph#')
thisModule.icalTZ = $rdf.Namespace('http://www.w3.org/2002/12/cal/icaltzd#') // Beware: not cal:
thisModule.ldp = $rdf.Namespace('http://www.w3.org/ns/ldp#')
thisModule.link = thisModule.tab = thisModule.tabont = $rdf.Namespace('http://www.w3.org/2007/ont/link#')
thisModule.log = $rdf.Namespace('http://www.w3.org/2000/10/swap/log#')
thisModule.meeting = $rdf.Namespace('http://www.w3.org/ns/pim/meeting#')
thisModule.mo = $rdf.Namespace('http://purl.org/ontology/mo/')
github solid / solid-ui / src / ns.js View on Github external
module.exports = thisModule

var $rdf = require('rdflib')

// This used to be a faw function (no ".expand" but that caused the module exports all to be dropped)
thisModule.expand = function (prefixed) {
  var pair = prefixed.split(':')
  if (pair.length === 0) throw new Error('Prefixed name has no colon: ' + prefixed)
  if (!(pair[0] in thisModule)) throw new Error('Unregistered namespace prefix in: ' + prefixed)
  return thisModule[pair[0]](pair[1])
}

thisModule.auth = $rdf.Namespace('http://www.w3.org/ns/auth/acl#') // @@ obsolete - use acl:
thisModule.acl = $rdf.Namespace('http://www.w3.org/ns/auth/acl#')
thisModule.arg = $rdf.Namespace('http://www.w3.org/ns/pim/arg#')
thisModule.cal = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#')
thisModule.contact = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/contact#')
thisModule.dc = $rdf.Namespace('http://purl.org/dc/elements/1.1/')
thisModule.dct = $rdf.Namespace('http://purl.org/dc/terms/')
thisModule.doap = $rdf.Namespace('http://usefulinc.com/ns/doap#')
thisModule.foaf = $rdf.Namespace('http://xmlns.com/foaf/0.1/')
thisModule.http = $rdf.Namespace('http://www.w3.org/2007/ont/http#')
thisModule.httph = $rdf.Namespace('http://www.w3.org/2007/ont/httph#')
thisModule.icalTZ = $rdf.Namespace('http://www.w3.org/2002/12/cal/icaltzd#') // Beware: not cal:
thisModule.ldp = $rdf.Namespace('http://www.w3.org/ns/ldp#')
thisModule.link = thisModule.tab = thisModule.tabont = $rdf.Namespace('http://www.w3.org/2007/ont/link#')
thisModule.log = $rdf.Namespace('http://www.w3.org/2000/10/swap/log#')
thisModule.meeting = $rdf.Namespace('http://www.w3.org/ns/pim/meeting#')
thisModule.mo = $rdf.Namespace('http://purl.org/ontology/mo/')
thisModule.owl = $rdf.Namespace('http://www.w3.org/2002/07/owl#')
thisModule.pad = $rdf.Namespace('http://www.w3.org/ns/pim/pad#')
thisModule.patch = $rdf.Namespace('http://www.w3.org/ns/pim/patch#')
github solid / solid-ui / src / ns.js View on Github external
thisModule.auth = $rdf.Namespace('http://www.w3.org/ns/auth/acl#') // @@ obsolete - use acl:
thisModule.acl = $rdf.Namespace('http://www.w3.org/ns/auth/acl#')
thisModule.arg = $rdf.Namespace('http://www.w3.org/ns/pim/arg#')
thisModule.cal = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#')
thisModule.contact = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/contact#')
thisModule.dc = $rdf.Namespace('http://purl.org/dc/elements/1.1/')
thisModule.dct = $rdf.Namespace('http://purl.org/dc/terms/')
thisModule.doap = $rdf.Namespace('http://usefulinc.com/ns/doap#')
thisModule.foaf = $rdf.Namespace('http://xmlns.com/foaf/0.1/')
thisModule.http = $rdf.Namespace('http://www.w3.org/2007/ont/http#')
thisModule.httph = $rdf.Namespace('http://www.w3.org/2007/ont/httph#')
thisModule.icalTZ = $rdf.Namespace('http://www.w3.org/2002/12/cal/icaltzd#') // Beware: not cal:
thisModule.ldp = $rdf.Namespace('http://www.w3.org/ns/ldp#')
thisModule.link = thisModule.tab = thisModule.tabont = $rdf.Namespace('http://www.w3.org/2007/ont/link#')
thisModule.log = $rdf.Namespace('http://www.w3.org/2000/10/swap/log#')
thisModule.meeting = $rdf.Namespace('http://www.w3.org/ns/pim/meeting#')
thisModule.mo = $rdf.Namespace('http://purl.org/ontology/mo/')
thisModule.owl = $rdf.Namespace('http://www.w3.org/2002/07/owl#')
thisModule.pad = $rdf.Namespace('http://www.w3.org/ns/pim/pad#')
thisModule.patch = $rdf.Namespace('http://www.w3.org/ns/pim/patch#')
thisModule.qu = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
thisModule.trip = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')
thisModule.rdf = $rdf.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
thisModule.rdfs = $rdf.Namespace('http://www.w3.org/2000/01/rdf-schema#')
thisModule.rss = $rdf.Namespace('http://purl.org/rss/1.0/')
thisModule.sched = $rdf.Namespace('http://www.w3.org/ns/pim/schedule#')
thisModule.schema = $rdf.Namespace('http:/schema.org/') // @@ beware confusion with documents no 303
thisModule.sioc = $rdf.Namespace('http://rdfs.org/sioc/ns#')
// was - thisModule.xsd = $rdf.Namespace('http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-')
thisModule.solid = $rdf.Namespace('http://www.w3.org/ns/solid/terms#')
thisModule.space = $rdf.Namespace('http://www.w3.org/ns/pim/space#')
thisModule.stat = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
github solid / solid-panes / src / attach / attachPane.js View on Github external
label: function (subject, context) {
    var kb = context.session.store
    var t = kb.findTypeURIs(subject)
    var QU = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
    var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
    if (
      t['http://www.w3.org/ns/pim/trip#Trip'] || // If in any subclass
      subject.uri === 'http://www.w3.org/ns/pim/trip#Trip' ||
      t['http://www.w3.org/2005/01/wf/flow#Task'] ||
      t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] ||
      // subject.uri == 'http://www.w3.org/2000/10/swap/pim/qif#Transaction' ||
      QU('Transaction') in kb.findSuperClassesNT(subject) ||
      kb.holds(subject, WF('attachment'))
    ) {
      return 'attachments'
    }
    return null
  },
github solid / solid-ui / src / ns.js View on Github external
thisModule.httph = $rdf.Namespace('http://www.w3.org/2007/ont/httph#')
thisModule.icalTZ = $rdf.Namespace('http://www.w3.org/2002/12/cal/icaltzd#') // Beware: not cal:
thisModule.ldp = $rdf.Namespace('http://www.w3.org/ns/ldp#')
thisModule.link = thisModule.tab = thisModule.tabont = $rdf.Namespace('http://www.w3.org/2007/ont/link#')
thisModule.log = $rdf.Namespace('http://www.w3.org/2000/10/swap/log#')
thisModule.meeting = $rdf.Namespace('http://www.w3.org/ns/pim/meeting#')
thisModule.mo = $rdf.Namespace('http://purl.org/ontology/mo/')
thisModule.owl = $rdf.Namespace('http://www.w3.org/2002/07/owl#')
thisModule.pad = $rdf.Namespace('http://www.w3.org/ns/pim/pad#')
thisModule.patch = $rdf.Namespace('http://www.w3.org/ns/pim/patch#')
thisModule.qu = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
thisModule.trip = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')
thisModule.rdf = $rdf.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
thisModule.rdfs = $rdf.Namespace('http://www.w3.org/2000/01/rdf-schema#')
thisModule.rss = $rdf.Namespace('http://purl.org/rss/1.0/')
thisModule.sched = $rdf.Namespace('http://www.w3.org/ns/pim/schedule#')
thisModule.schema = $rdf.Namespace('http:/schema.org/') // @@ beware confusion with documents no 303
thisModule.sioc = $rdf.Namespace('http://rdfs.org/sioc/ns#')
// was - thisModule.xsd = $rdf.Namespace('http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-')
thisModule.solid = $rdf.Namespace('http://www.w3.org/ns/solid/terms#')
thisModule.space = $rdf.Namespace('http://www.w3.org/ns/pim/space#')
thisModule.stat = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
thisModule.ui = $rdf.Namespace('http://www.w3.org/ns/ui#')
thisModule.vcard = $rdf.Namespace('http://www.w3.org/2006/vcard/ns#')
thisModule.wf = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
thisModule.xsd = $rdf.Namespace('http://www.w3.org/2001/XMLSchema#')

//  ends
github solid / solid-ui / src / ns.js View on Github external
thisModule.icalTZ = $rdf.Namespace('http://www.w3.org/2002/12/cal/icaltzd#') // Beware: not cal:
thisModule.ldp = $rdf.Namespace('http://www.w3.org/ns/ldp#')
thisModule.link = thisModule.tab = thisModule.tabont = $rdf.Namespace('http://www.w3.org/2007/ont/link#')
thisModule.log = $rdf.Namespace('http://www.w3.org/2000/10/swap/log#')
thisModule.meeting = $rdf.Namespace('http://www.w3.org/ns/pim/meeting#')
thisModule.mo = $rdf.Namespace('http://purl.org/ontology/mo/')
thisModule.owl = $rdf.Namespace('http://www.w3.org/2002/07/owl#')
thisModule.pad = $rdf.Namespace('http://www.w3.org/ns/pim/pad#')
thisModule.patch = $rdf.Namespace('http://www.w3.org/ns/pim/patch#')
thisModule.qu = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
thisModule.trip = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')
thisModule.rdf = $rdf.Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
thisModule.rdfs = $rdf.Namespace('http://www.w3.org/2000/01/rdf-schema#')
thisModule.rss = $rdf.Namespace('http://purl.org/rss/1.0/')
thisModule.sched = $rdf.Namespace('http://www.w3.org/ns/pim/schedule#')
thisModule.schema = $rdf.Namespace('http:/schema.org/') // @@ beware confusion with documents no 303
thisModule.sioc = $rdf.Namespace('http://rdfs.org/sioc/ns#')
// was - thisModule.xsd = $rdf.Namespace('http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#dt-')
thisModule.solid = $rdf.Namespace('http://www.w3.org/ns/solid/terms#')
thisModule.space = $rdf.Namespace('http://www.w3.org/ns/pim/space#')
thisModule.stat = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
thisModule.ui = $rdf.Namespace('http://www.w3.org/ns/ui#')
thisModule.vcard = $rdf.Namespace('http://www.w3.org/2006/vcard/ns#')
thisModule.wf = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#')
thisModule.xsd = $rdf.Namespace('http://www.w3.org/2001/XMLSchema#')

//  ends
github jolocom / smartwallet-app / src / js / stores / node.js View on Github external
import Reflux from 'reflux'
import nodeActions from 'actions/node'
import GraphAgent from 'lib/agents/graph.js'
import rdf from 'rdflib'
let FOAF = rdf.Namespace('http://xmlns.com/foaf/0.1/')
let SCHEMA = rdf.Namespace('https://schema.org/')

export default Reflux.createStore({
  listenables: nodeActions,

  init() {
    this.gAgent = new GraphAgent()
  },

  getInitialState() {
    return null
  },

  create(user, node, title, description, image, type) {
    this.gAgent.createNode(user, node, title, description, image, type)
  },
github jolocom / smartwallet-app / src / js / stores / node.js View on Github external
import Reflux from 'reflux'
import nodeActions from 'actions/node'
import GraphAgent from 'lib/agents/graph.js'
import rdf from 'rdflib'
let FOAF = rdf.Namespace('http://xmlns.com/foaf/0.1/')
let SCHEMA = rdf.Namespace('https://schema.org/')

export default Reflux.createStore({
  listenables: nodeActions,

  init() {
    this.gAgent = new GraphAgent()
  },

  getInitialState() {
    return null
  },

  create(user, node, title, description, image, type) {
    this.gAgent.createNode(user, node, title, description, image, type)
  },
github jolocom / smartwallet-app / src / js / lib / agents / chat.js View on Github external
_writeConversationAcl({url, initiator, participants = []}) {
    const writer = new Writer()
    const ACL = $rdf.Namespace('http://www.w3.org/ns/auth/acl#')
    const aclUri = `${url}.acl`
    const owner = $rdf.sym(`${url}#owner`)
    const participant = $rdf.sym(`${url}#participant`)
    const headers = {
      'Content-Type': 'text/turtle'
    }

    writer.addTriple(owner, PRED.type, ACL('Authorization'))
    writer.addTriple(owner, ACL('accessTo'), $rdf.sym(url))
    writer.addTriple(owner, ACL('accessTo'), $rdf.sym(aclUri))
    writer.addTriple(owner, ACL('agent'), $rdf.sym(initiator))
    writer.addTriple(owner, ACL('mode'), ACL('Control'))
    writer.addTriple(owner, ACL('mode'), ACL('Read'))
    writer.addTriple(owner, ACL('mode'), ACL('Write'))

    writer.addTriple(participant, PRED.type, ACL('Authorization'))
github solid / solid-panes / src / transaction / pane.js View on Github external
render: function (subject, context) {
    const dom = context.dom
    var kb = context.session.store
    var fetcher = kb.fetcher
    var Q = $rdf.Namespace('http://www.w3.org/2000/10/swap/pim/qif#')
    var TRIP = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')

    var div = dom.createElement('div')
    div.setAttribute('class', 'transactionPane')

    var mention = function mention (message, style) {
      if (style === undefined) style = 'color: grey'
      var pre = dom.createElement('pre')
      pre.setAttribute('style', style)
      div.appendChild(pre)
      pre.appendChild(dom.createTextNode(message))
    }
    var complain = function complain (message) {
      return mention(message, 'color: #100; background-color: #fee')
    }

    /*