# Module: Core

This class defines the public API of the WebGME-Core

Author:
  - kecso / https://github.com/kecso

### Type Definitions

#### Constraint

  An object that represents some additional rule regarding some node of the project.

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `script` | string | The script which checks if the constraint is met.
  `info` | string | Short description of the constraint.
  `priority` | string | Gives instructions on how to deal with violations of the constraint.

#### DataObject

  Inner data of module:Core~Node that can be serialized and saved in the storage.

  ##### Type:

  - object

#### DefinitionInfo

  Contains the owner and the target of the meta-rule that makes the relationship between the given node and related node a valid one. There can be multiple meta-rules that make the relationship valid, but this is the first one that answers the question isValidChildOf, isValidTargetOf etc.

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `ownerNode` | Core~Node | The meta-node where the meta-rule is stored.
  `targetNode` | Core~Node | The meta-node the meta-rule is targeting.

#### GmePersisted

  the result object of a persist which contains information about the newly created data objects.

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rootHash` | module:Core~ObjectHash | Hash of the root node.
  `objects` | object.<module:Core~ObjectHash, module:Core~DataObject> | Hash of the root node.

#### GUID

  Globally unique identifier. A formatted string containing hexadecimal characters. If some projects share some GUIDs that can only be because the node with the given identification represents the same concept.

  ##### Type:

  - string

  ##### Example

      'cd891e7b-e2ea-e929-f6cd-9faf4f1fc045'

#### MixinViolation

  An object that has information about a mixin violation in the given node.

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `severity` | string | <optional> | The severity of the given error ('error','warning').
  `type` | string | <optional> | 'missing', 'attribute collision', 'set collision', 'pointer collision', 'containment collision', 'aspect collision', 'constraint collision'
  `ruleName` | string | undefined | <optional> | The name of the affected rule definition (if available).
  `targetInfo` | string | undefined | <optional> | The path of the target of the violation (if available).
  `targetNode` | module:Core~Node | undefined | <optional> | The target node of the violation (if available).
  `collisionPaths` | Array.<string> | <optional> | The list of paths of colliding nodes (if any).
  `collisionNodes` | Array.<module:Core~Node> | <optional> | The colliding mixin nodes (if any).
  `message` | string | <optional> | The description of the violation.
  `hint` | string | <optional> | Hint on how to resolve the issue.

  ##### Examples

      '{
      'severity': 'error',
      'type': 'missing',
      'targetInfo': '/E/b',
      'message': '[MyObject]: mixin node "E/b" is missing from the Meta',
      'hint': 'Remove mixin or add to the Meta'
      }'

      '{
      'severity': 'warning',
      'type': 'attribute collision',
      'ruleName': 'value',
      'collisionPaths': ['/E/a','/E/Z'],
      'collisionNodes': [Object,Object],
      'message':'[MyObject]: inherits attribute definition "value" from [TypeA] and [TypeB]',
      'hint': 'Remove one of the mixin relations'
      }'

#### Node

  the object that represents the atomic element of the containment hierarchy.

  ##### Type:

  - object

#### ObjectHash

  Unique SHA-1 hash for the node object.

  ##### Type:

  - string

  ##### Example

      '#5496cf226542fcceccf89056f0d27564abc88c99'

#### RelationRule

  An object that represents a relational type rule-set (pointer/set).

  ##### Type:

  - object

  ##### Properties:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `min` | integer | <optional> | The minimum amount of target necessary for the relationship (if not present or '-1' then there is no minimum rule that applies)
  `max` | integer | <optional> | The minimum amount of target necessary for the relationship (if not present or '-1' then there is no minimum rule that applies)
  `absolutePathOfTarget` | object | <optional> | special rules regarding the given type (if the object is empty, it still represents that the type is a valid target of the relationship) ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `min` | integer | <optional> | The minimum amount of target necessary for the relationship from the given type (if not present or '-1' then there is no minimum rule that applies)
  `max` | integer | <optional> | The minimum amount of target necessary for the relationship from the given type (if not present or '-1' then there is no minimum rule that applies)

  ##### Example

      '{
       'min': 1,
       'max': -1,
       'any/path/of/node':{
        'min':-1,
        'max':2
        },
        'any/other/valid/path':{
        }
      }'

#### Search results