Skip to content

Migrating to Version 3.x

Will Webberley edited this page Feb 1, 2017 · 2 revisions

CENode Version 3.x Migration Information

CENode v3.x introduces some breaking changes to those using v2.x. If you are using v1.x still, then please follow the version 2.x migration guide first.

Property naming

Version 3 properties now conform to standard JavaScript style camelCasing as opposed to the previously-used snake_case.

All functions and fields that before used snake-casing have been translated exactly to camel-case. For example, CENode's add_sentence(sentence) function should now be called using addSentence(sentence).

Please note that CEConcepts and CEInstances still use snake-casing for property names. For example, accessing relationships of a card declared using the CE ... and is to the agent Moira ... can still be done using node.instances.card1.is_to.

Property removals / additions

In 3.x node.getConcepts() has been removed. To obtain an array of CEConcepts, instead use node.concepts directly.

CEAgent

Instantiation

By default, CENode instantiation no longer automatically spawns and attaches an agent (instance of CEAgent) to itself. This is in case the application in question does not require use of the CE card protocol or interactions using policies.

If your application requires use of CE cards, policies, or anything else that requires an agent, then one should be attached to a CENode instance. For example:

const node = new CENode();
node.attachAgent();

In most cases, this should be sufficient since the node instance will now automatically create a new CEAgent. However, in advanced cases, you might like to attach your own version of an agent (which should be extended from the CEAgent class):

const agent = new MyAgentClass();
const node = new CENode();
node.attachAgent(agent);

In general

The standard CEAgent class has been simplified and some of its fields have been removed. Please refer to the relevant section of the API reference for more information.

Clone this wiki locally