Ontology

global. Ontology

Represents Ontologies which have been hydrated and streamed-in from a set database. Each Ontology line is formatted like this: <Ontology ID> Object - Where Object is JSON, with the following mandatory options.

  • .date: number - The date the Ontology event happened as a timestamp.
  • .type: string
Constructor:
  • arg0_type="Ontology": string - The Ontology subclass/type to reference.
  • arg1_state_array: Array<{ date: number, data: Object, ...argn_fields }>
    • argn_fields:
      • .add_relations: { id: string, type: string }
      • .add_tags: Array<string>
      • .remove_relations: { id: string, ... }|Array<string>
      • .remove_tags: Array<string>
      • .set_tags: Array<string> - Override.
      • .set_relations: { id: string, type: string } - Override.
  • arg2_options: Object
    • .id=Ontology.getOntologyID(): string - The manual ID to override the default assignment.
    • .worker_type="": string - The worker from which the Ontology originated.
Instance:
  • .options: Object
  • .type: string
  • .id: string
  • .geometries: Array<maptalks.Geometry>
  • .state: Array<Object>
  • .worker_type: string
Methods:
  • _rebuildDiffsFromSnapshots | Object(arg0_snapshots:Array<Object>)
  • _resolveAllSnapshots() | Array<Object>
  • _resolveStateAtIndex(arg0_index:number) | Object
  • _sortState()
  • addKeyframe(arg0_date:Date, arg1_date:Date) | Object
  • addRelation(arg0_date:Date, arg1_relation_obj:Object) | Object
  • deleteKeyframe(arg0_date:Date) | boolean
  • draw() | Array<maptalks.Geometry>
  • getElement() | HTMLElement
  • getFirstKeyframeWithProperty(arg0_property:Object)
  • getLastKeyframeWithProperty(arg0_property:Object)
  • getTimelineElement(arg0_options:Object) | HTMLElement
  • getState(arg0_date:Date) | Object
  • getTimelineElement(arg0_options:Object)
  • jumpToKeyframe(arg0_date:Date) | Object|null
  • mergeState(arg0_state:Array<Object>)
  • moveKeyframe(arg0_date:Date, arg1_date:Date) | boolean
  • remove()
  • removeRelation(arg0_relation:string, arg1_date:Date)
  • removeRelations(arg0_relations:Array<string>, arg1_date:Date)
  • saveToDatabase()
Static Fields:
  • .initialised=false: boolean
  • .instances: Array<Ontology>
  • .ontology_folder_path="": string
  • .queue: Array<Ontology> - Queued Ontologies waiting to be saved and passed into .instances.
Static Methods:
  • applyMutations(arg0_resolved_data:Object, arg1_mutations:Object) | Object
  • fromDatabase()
  • Ontology.getOntologyFromDatabase(arg0_ontology_id:string)
  • getOntologyID() | string
  • initialise()

Constructor

new Ontology()

Source:

Members

initialised :boolean

Source:
Type:
  • boolean

instances :Array.<Ontology>

Source:
Type:

ontology_folder_path :string

Source:
Type:
  • string

Methods

addKeyframe(arg0_date, arg1_data, arg2_optionsopt) → {Object}

Adds a new keyframe/state mutation at the given date, typically the head state. The provided arg1_data and optional relation/tag mutations are merged into the resolved timeline, and the entire diff chain is rebuilt so the head remains the latest full snapshot.

Source:
Parameters:
Name Type Attributes Description
arg0_date Date | any
arg1_data Object
arg2_options Object <optional>
Name Type Attributes Description
add_relations Array.<Object> <optional>
add_tags Array.<string> <optional>
remove_relations Array.<Object> | Array.<string> <optional>
remove_tags Array.<string> <optional>
set_relations Array.<Object> <optional>
set_tags Array.<string> <optional>
Returns:
Type:
Object

addRelation(arg0_date, arg1_relation_obj)

Adds a relation object to the selected date.

Source:
Parameters:
Name Type Description
arg0_date Date | any
arg1_relation_obj Object

deleteKeyframe(arg0_date) → {boolean}

Deletes the keyframe at the given date.

Source:
Parameters:
Name Type Description
arg0_date Date | any
Returns:
Type:
boolean

draw()

Draws the Ontology. Should be overridden by subclasses.

Source:

getElement(arg0_optionsopt) → {HTMLElement}

Returns an HTMLElement representing this Ontology.

Source:
Parameters:
Name Type Attributes Description
arg0_options Object <optional>
Name Type Attributes Default Description
do_not_show_timeline boolean <optional>
false
end_date Date | any <optional>
start_date Date | any <optional>
Returns:
Type:
HTMLElement

getFirstKeyframeWithProperty(arg0_property) → {Object|null}

Returns the first keyframe whose resolved state contains the given property key.

Source:
Parameters:
Name Type Description
arg0_property string
Returns:
Type:
Object | null

getLastKeyframeWithProperty(arg0_property) → {Object|null}

Returns the last keyframe whose resolved state contains the given property key.

Source:
Parameters:
Name Type Description
arg0_property string
Returns:
Type:
Object | null

getState(arg0_date) → {Object}

Returns the fully-resolved state at a given date. If the date fails between two keyframes, the earlier keyframe's resolved state is returned. If the date is past the head, the head snapshot is returned. If before all keyframes, an empty object is returned.

Source:
Parameters:
Name Type Description
arg0_date Date | any
Returns:
Type:
Object

getTimelineElement(arg0_optionsopt) → {HTMLElement}

Returns an HTMLElement representing this Ontology's timeline.

Source:
Parameters:
Name Type Attributes Description
arg0_options Object <optional>
Name Type Attributes Description
start_date Date | any <optional>
end_date Date | any <optional>
Returns:
Type:
HTMLElement

jumpToKeyframe(arg0_date) → {Object|null}

Jumps to a specific keyframe and calls the draw function for the Ontology.

Source:
Parameters:
Name Type Description
arg0_date
Returns:
Type:
Object | null

mergeState(arg0_state_array)

Merges an incoming state array into the current Ontology. Resolves both states to snapshots, merges them, and rebuilds the diff chain.

Source:
Parameters:
Name Type Description
arg0_state_array Array.<Object>

moveKeyframe(arg0_date, arg1_date) → {boolean}

Moves a keyframe from arg0_date to arg1_date.

Source:
Parameters:
Name Type Description
arg0_date Date | any
arg1_date Date | any
Returns:
Type:
boolean

remove()

Removes the Ontology.

Source:

removeRelation(arg0_relation, arg1_date)

Removes a single relation from a specified date.

Source:
Parameters:
Name Type Description
arg0_relation Object | string
arg1_date Date | any

removeRelations(arg0_relations, arg1_date)

Removes multiple relations from a specified date.

Source:
Parameters:
Name Type Description
arg0_relations Object | string
arg1_date Date | any

saveToDatabase(arg0_batch_map)

Collects dirty keyframes into a write-batch map. Does NOT perform I/O itself; called by the logic loop.

Source:
Parameters:
Name Type Description
arg0_batch_map Map.<string, {lines: Array.<string>, keyframes: Array.<Object>}>