Skip to content

weaverplatform/weaver-commons-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Mohamad Alamili
Aug 10, 2016
fafb01a · Aug 10, 2016

History

49 Commits
Jul 12, 2016
Aug 10, 2016
Jul 18, 2016
Jun 24, 2016
Jun 23, 2016
Jun 27, 2016
Jul 5, 2016
May 19, 2016
Jun 30, 2016
Jul 12, 2016
May 22, 2016
Aug 10, 2016

Repository files navigation

Build Statuscodecov

weaver-commons-js

Elementary components.

Those are the basic elements that is possible to add at graphDatabase. At this moment the graphDatabases supported are Virtuoso via weaver-server-virtuoso and Neo4j via weaver-server-neo4j

The principal aim of weaver-commons-js is to make easy interact with this objects at the moment of transaction and querys on our weaver javascript code. It let you do things like create a $INDIVIDUAL and test if it is valid:

WeaverCommons = require('weaver-commons-js')
Individual = WeaverCommons.Individual

Individual r2d2 = new Individual(individual_payload)

if r2d2.isValid()
	### do stuff like a transaction

At the moment we count with 3:

  • 🔵 $INDIVIDUAL
  • 🔷 $INDIVIDUAL_PROPERTY
  • 🔲 $VALUE_PROPERTY

💲INDIVIDUAL

An $INDIVIDUAL object in json looks like this:

"payload": {
      "type": "$INDIVIDUAL",
      "id": "cipy1yeeh00023k6kboj6rzrh",
      "attributes": {
        "name": "Unnamed",
        "type": "$INDIVIDUAL"
      },
      "relations": {}
 	}

💲INDIVIDUAL_PROPERTY

An $INDIVIDUAL_PROPERTY object in json looks like this:

"payload": {
      "type": "$INDIVIDUAL_PROPERTY",
      "id": "cipy1zfnm000i3k6klvlzjfql",
      "attributes": {
        "predicate": "eats",
        "type": "$INDIVIDUAL_PROPERTY"
      },
      "relations": {
        "subject": "cipy1yeeh00023k6kboj6rzrh",
        "object": "cipy1yt7l00073k6k3fusc8cg"
      }
    }

💲VALUE_PROPERTY

An $VALUE_PROPERTY object in json looks like this:

"payload": {
      "type": "$VALUE_PROPERTY",
      "id": "cipy1zs5x000l3k6khveg0qqh",
      "attributes": {
        "predicate": "replaces",
        "object": "eats",
        "type": "$VALUE_PROPERTY"
      },
      "relations": {
        "subject": "cipy1yeeh00023k6kboj6rzrh"
      }