weaver-connector

0.1.2 • Public • Published

weaver-connector

Blueprint for any weaver-connector

API

Object: WeaverConnector

  • connector = new WeaverConnector({ops})
  • connector.getServerName()
  • connector.getServerVersion()
  • connector.transaction()
  • connector.query()

Object: Transaction

  • connector.transaction().then(function (trx) { ... })
  • trx.createObject({obj}, [props]).then(...
  • trx.createProperty({prop}).then(...
  • trx.readObject(id).then(function (object) { ... })
  • trx.readProperty(id).then(function (property) { ... })
  • trx.updateObject({obj}, [props]).then(...
  • trx.updateProperty({prop}).then(...
  • trx.deleteObject(id).then(...
  • trx.deleteProperty(id).then(...
  • trx.commit().then(...
  • trx.rollback().then(...

Object: Query

  • connector.query().then(function (query) { ... })
  • query.select('rel1', 'rel2')
  • query.filter([filters])
  • query.equalTo('rel1', 'value')
  • query.linksTo('rel1', 'toId')
  • query.ascending('rel1')
  • query.descending('rel1')
  • query.limit(limit)
  • query.skip(skip)
  • query.find().then(function (result) { ... })
  • query.first().then(function (row) { ... })
  • query.count().then(function (number) { ... })

Examples

Creating a Virtuoso connection and creating an object
var virtuoso = new Virtuoso({host: 'http://192.168.99.100', port: 1111, user: 'dba', passwd: 'dba' });
virtuoso.transaction().then(function (trx) {
  trx.createObject({id: 'cim6eepaw00003j6gcjo236lm', 
                    dataset: 'cim6ef9tk00003j6g5udpgi4l',
                    created: '1458831225'},
                   [])
  .then(function() {
    trx.commit();
  });
});

Package Sidebar

Install

npm i weaver-connector

Weekly Downloads

0

Version

0.1.2

License

GPL-3.0

Last publish

Collaborators