entity-network

0.3.6 • Public • Published

EntityNetwork.js

EntityNetwork.js is a small framework to work with data. You can use it as a Node.js module and as JS-library in browser. Here you can find its code repository. Feel free to ask me any questions by email yolziii@gmail.com

Version numbers

This project is in active development stage, so its API could be chang before I release first version. For now every new version that compatible with previous versions increments third number (Z) of version number X.Y.Z. And versions which not compatible with previous version increments second number (Y).

Documentation state

Documentation isn't finished yet, but you can read unit tests sources to figure out how this framework works.

IDE support

In future I'm planning to make plugin for JetBrains products (WebStorm, IDEA, etc.) which will support all framework's features (like values conditions, refactoring, etc.). But I will start to make it after I will realise first version of framework, so if you want to help - please join.

How to install:

To install it in your Node.js project, use this command:

npm install entity-network

You can find all [useful] versions for browser in this folder of repository. Or you can build it by yourself from sources by using this gulp-script:

gulp --gulpfile gulp_web_deploy.js

What is EntityNetwork.js?

This framework allows you to describe semantic data like RDF, but in much more simpler and useful way. It shares two classes:

Entity

Use it to directly create entities and find them:

var cardEntity = Entity.create('card');
var intEntity = Entity.get(CoreId.INT);

EntityLoader

Use this to load entities from JSON file or create entities from any object:

var dataObject = JSON.parse(dataJSON);
EntityLoader.proceedDocumentObject(dataObject);

EntityNetwork.js implements data structure that I called (surprise!) "entity network" which similar to "neural network", because this data structure implements something similar on concept of neuron of grandmother.

In simple words this means the following. Each significant part of data is represented by unique entity, like this:

{
  "my_grandmother": {"is": "entity"}
}

In this example JSON document defines entity with unique identifier "my_grandmother" that inherit root entity with ID "entity". On this diagram this "is" relation is shown by black arrow with triangle.

my_mother-1

Root entity "entity" is using by default, so you can rewrite previous JSON code to create the same grandmother entity:

{
    "my_grandmother": {}
}

When you load this file via EntityLoader, you can find this entity via Entity.get() method:

var grandma = Entity.get('my_grandmother');

Each entity in network connected to other entities via properties and inherit relation. For example:

{
  "my_grandmother": {
    "age": 85,
    "first_name": "Anna"
  },
  
  "age" : {"is": "int"},
  "first_name" : {"is": "string", "min_length": 1}
}

This diagram shows relations and properties between entities: my_mother-2

Relation "is"

In entity network data structure there is an one type of relation and it calls "is". This relation defines ralations between parents and children. Each child inherit all properties and relations from it's parent, like as classes inherit their behaviour from their super classes in OOP paradigm.

Readme

Keywords

Package Sidebar

Install

npm i entity-network

Weekly Downloads

0

Version

0.3.6

License

MIT

Last publish

Collaborators

  • yolziii