API Docs for: 1.0.0
Show:

CORE.Entity Class

Constructor

CORE.Entity

(
  • name
)

Parameters:

  • name String

    Name of the entity

Methods

createSubEntity

(
  • name
)
Entity

Creates an entity. Called from another entity object.

Parameters:

  • name String

    Name of the Entity.

Returns:

Entity:

Returns the created Entity object.

Throws:

CreateEntityException:

Cannot create entity.

Example:

var semantics = new Semant();
var people = semantics.createOntology("People", "http://ppl.com");
var male = ont_people.createEntity("Male");
var female = ont_people.createEntity("Femal");

Properties

individuals

Object

Individuals of this entity

name

String

Name of the entity

ontology

Object

The ontology this entity is created under

parent

Object

Parent entity.

relIn

Array

The relationships where this entity is the range. What this variable stores is {relationship, entity}. For example in a relationship like Istanbul -in-> Turkey, the instance Turkey would store this this relationship in relIn as [[in, Istanbul]]

Default: []

relOut

Array

The relationships where this entity is the domain. What this variable stores is {relationship, entity} or {relationship, literal}. For example in a relationship like Istanbul -in-> Turkey, the Istanbul entity would store this relationship in relOut as [[in, Turkey]]

Default: []

subs

Object

Sub entities.

type

String

For identifying an instance

URI

String

URI of the entity

Events

addRelation

Adds a relation from an entity to another entity or literal.

Event Payload:

  • relation Object

    The object of relation to be added.

  • target Object

    The target object. Could be an entity or literal object.

Example:

var semantics = new Semant();
                    var geo = semantics.createOntology("Geo", "http://geo.com");
                    var in = geo.createRelation("in");
                    var turkey = geo.createEntity("Turkey");
                    var istanbul = geo.createEntity("Istanbul");
                    istanbul.addRelation(in, turkey);
                    

makeSubEntity

Makes an entity a sub entity of another.

Event Payload:

  • parentEntity Object

    Parent object of this soon-to-be sub entity

Example:

var semantics = new Semant();
                    var alive = semantics.createOntology("Alive", "http://alive.com");
                    var people = ont_people.createEntity("People");
                    var male = ont_people.createEntity("Male");
                    var female = ont_people.createEntity("Femal");
                    male.makeSubEntity(people);
                    female.makeSubEntity(people);
                    // same as doing this:
                    // people.createSubEntity("Male");
                    // people.createSubEntity("Female");