Exhibit/API/2.2.0/Data/Database

From SIMILE Widgets
Jump to: navigation, search

Exhibit's underlying data store.

Code: http://api.simile-widgets.org/exhibit/2.2.0/scripts/data/database.js

Back to Exhibit API

Contents

Properties

Exhibit.Database.TimestampPropertyName

"addedOn"

Exhibit.Database.defaultIgnoredProperties

['uri', 'modified']

Methods

Exhibit.Database.create

Returns: Exhibit.Database._Impl
Description: Instantiate an Exhibit database object

Exhibit.Database.handleAuthentication

Description: One-off method for Google, does not belong here.

Exhibit.Database.makeISO8601DateString

Description: One-off, should use date utility instead.

Exhibit.Database._indexPut

Arguments:
index: Object
x: String
y: String
z: String
Description: Add or initialize an array entry in a two-level hash, such that index[x][y].push(z), given z isn't already in index[x][y].

Exhibit.Database._indexPutList

Arguments:
index: Object
x: String
y: String
list: Array
Description: Add or initialize an array entry in a two-level hash, such that index[x][y] = list if undefined or index[x][y].concat(list) if already defined.

Exhibit.Database._indexRemove

Arguments:
index: Array
x: String
y: String
z: String
Returns: Boolean, if z existed and was removed.
Description: Remove the element z from the array index[x][y]; also remove index[x][y] if the array becomes empty and index[x] if the hash becomes empty.

Exhibit.Database._indexRemoveList

Arguments:
index: Array
x: String
y: String
Returns: Array that was removed
Description: Removes index[x][y] (does not remove index[x] if it becomes empty, it probably should).

Classes

Exhibit.Database._Impl

Implementation of database.

Exhibit.Database._Impl.prototype.createDatabase

Returns: Exhibit.Database
Description: Generator

Exhibit.Database._Impl.prototype.addListener

Description: Add a listener to the database SimileAjax.ListenerQueue

Exhibit.Database._Impl.prototype.removeListener

Description: Remove a listener from the database SimileAjax.ListenerQueue

Exhibit.Database._Impl.prototype.loadDataLinks

Description: Load all data from the document's head listed as a link element with rel="exhibit/data".

Exhibit.Database._Impl.prototype.loadSubmissionLinks

Description: Undocumented feature. Like above, but rel="exhibit/submission", with some extra work to differentiate submission items from other ways of loading. Unclear what this was meant for.

Exhibit.Database._Impl.prototype.loadData

Description: Given an object with the appropriate keys, load types, properties, and items into the database.

Exhibit.Database._Impl.prototype.loadTypes

Description: Load just the types from the data.

Exhibit.Database._Impl.prototype.loadProperties

Description: Load just the properties from the data. Valid property valueType: text, html, number, date, boolean, item, url.

Exhibit.Database._Impl.prototype.loadItems

Description: Load just the items from the data.

Exhibit.Database._Impl.prototype.getType

Returns: Exhibit.Database._Type
Description: Retrieve an Exhibit.Database._Type given an ID.

Exhibit.Database._Impl.prototype.getProperty

Returns: Exhibit.Database._Property
Description: Retrieve an Exhibit.Database._Property given an ID, or null if no such property exists.

Exhibit.Database._Impl.prototype.getAllProperties

Returns: Array
Description: Retrieve all Exhibit.Databse._Property properties in an array.

Exhibit.Database._Impl.prototype.isSubmission

Returns: Boolean
Description: Boolean if an ID is a submission. Unclear what this was meant for.

Exhibit.Database._Impl.prototype.getAllItems

Returns: Exhibit.Set
Description: Retrieve all items in the database as an Exhibit.Set. Does not include submissions.

Exhibit.Database._Impl.prototype.getAllSubmissions

Returns: Exhibit.Set
Description: Retrieve all items that are submissions from the database as an Exhibit.Set.

Exhibit.Database._Impl.prototype.getAllItemsCount

Returns: Integer
Description: Returns a count of all items in the database, including submissions.

Exhibit.Database._Impl.prototype.containsItem

Returns: Boolean
Description: If an ID is in the item database.

Exhibit.Database._Impl.prototype.getNamespaces

Description: Work through URIs of database properties and algorithmically extract the best guess at all URI namespaces used in the data. Modifies arguments, does not return anything.

Exhibit.Database._Impl.prototype.getObjects

Description: Fill an Exhibit.Set with all objects for a given subject-predicate pair.

Exhibit.Database._Impl.prototype.countDistinctObjects

Description: Count the distinct, unique objects (any repeated objects count as one) for a subject-predicate pair.

Exhibit.Database._Impl.prototype.getObjectsUnion

Description: Fill in an Exhibit.Set with all objects for all subject-predicate pairs from a set of subjects.

Exhibit.Database._Impl.prototype.countDistinctObjectsUnion

Description: Count the distinct, unique objects for subject-predicate pairs for all subjects in an Exhibit.Set. Objects that repeat across subject-predicate pairs are counted for each appearance.

Exhibit.Database._Impl.prototype.getSubjects

Description: Fill an Exhibit.Set with all the subjects with the matching object-predicate pair.

Exhibit.Database._Impl.prototype.countDistinctSubjects

Description: Count the distinct, unique subjects (any repeated subjects count as one) for a object-predicate pair

Exhibit.Database._Impl.prototype.getSubjectsUnion

Description: Fill in an Exhibit.Set with all subjects for all object-predicate pairs from a set of objects.

Exhibit.Database._Impl.prototype.countDistinctSubjectsUnion

Description: Count the distinct, unique subjects for object-predicate pairs for all objects in an Exhibit.Set.

Exhibit.Database._Impl.prototype.getObject

Description: Return one (and only one) object given a subject-predicate pair.

Exhibit.Database._Impl.prototype.getSubject

Description: Return one (and only one) subject from an object-predicate pair.

Exhibit.Database._Impl.prototype.getForwardProperties

Description: Return an array of properties from triples for which the argument is the subject.

Exhibit.Database._Impl.prototype.getBackwardProperties

Description: Return an array of properties from triples for which the argument is the subject.

Exhibit.Database._Impl.prototype.getSubjectsInRange

Description: Fill an Exhibit.Set with subjects whose property values for the given property fall within the min, max range.

Exhibit.Database._Impl.prototype.getTypeIDs

Description: Fill an Exhibit.Set with all objects in the database of property "type".

Exhibit.Database._Impl.prototype.addStatement

Description: Add a triple to the database.

Exhibit.Database._Impl.prototype.removeStatement

Description: Remove a statement from the database, returning either the object or the subject that was removed.

Exhibit.Database._Impl.prototype.removeObjects

Description: Remove all objects associated with a subject-predicate pair, returning a boolean for success.

Exhibit.Database._Impl.prototype.removeSubjects

Description: Remove all subjects associated with an object-predicate pair, returning a boolean for success.

Exhibit.Database._Impl.prototype.removeAllStatements

Description: Reset the entire database to its empty state.

Exhibit.Database._Impl.prototype.isNewItem

Description: If an item via its identifier is known to have been added during an editing session without being committed back to the data origin source.

Exhibit.Database._Impl.prototype.getItem

Returns: Object, in Exhibit database item format.
Description: Retrieve an item from the database given its identifier, with all its properties and values.

Exhibit.Database._Impl.prototype.addItem

Description: Insert a set of triples into the database in Exhibit database item format.

Exhibit.Database._Impl.prototype.editItem

Description: Propagates an edit to an existing item into the database, updating indices, and cloning a backup, with the intent to commit changes to a data source. Notes indicate this is not a production level method.

Exhibit.Database._Impl.prototype.removeItem

Description: Delete an item from the database with the intent to commit changes to a data source.

Exhibit.Database._Impl.prototype.fixAllChanges

Description: After receiving notification all changes have been committed to the data source, remove all indications locally that modifications were made.

Exhibit.Database._Impl.prototype.fixChangesForItem

Description: After receiving notification changes for one item have been committed to the data source, remove all indications locally that modifications were made.

Exhibit.Database._Impl.prototype.collectChangesForItem

Description: Form all additions and modifications into a new object that contains information on what the old and new (or just new) values are.

Exhibit.Database._Impl.prototype.collectAllChanges

Description: Run collectChangesForItem over all items.

Exhibit.Database._Impl.prototype.mergeSubmissionIntoItem

Description: Call editItem to merge a submission item in the database with the master item.

Exhibit.Database._Impl.prototype._loadLinks

Description: Use corresponding registered importers to load a link based on its stated MIME type.

Exhibit.Database._Impl.prototype._loadItem

Description: Called by data loading methods for each item being loaded. Checks viability and indexes when adding the item's triples to the database.

Exhibit.Database._Impl.prototype._ensureTypeExists

Description: Called during data load to make sure the schema for any types being added exists, adding it if not.

Exhibit.Database._Impl.prototype._ensurePropertyExists

Description: Called during data load to make sure the schema for any property being added exists, adding it if not.

Exhibit.Database._Impl.prototype._indexFillSet

Description: Fills an Exhibit.Set with any values that are contained in the two-level index, index[x][y], only including those in the filter if the filter is provided.

Exhibit.Database._Impl.prototype._indexCountDistinct

Description: Like _indexFillSet but returns a count of the number of objects instead of filling a result with items.

Exhibit.Database._Impl.prototype._get

Description: Passes through to _indexFillSet.

Exhibit.Database._Impl.prototype._getUnion

Description: Given an Exhibit.Set of items, return values of index[x][y] for all values of x in an Exhibit.Set.

Exhibit.Database._Impl.prototype._countDistinctUnion

Description: Count all distinct values in index[x][y] for all x in an Exhibit.Set. Uniqueness is for x-y-value triples; common values across triples will still be counted.

Exhibit.Database._Impl.prototype._countDistinct

Description: Passes through to _indexCountDistinct.

Exhibit.Database._Impl.prototype._getProperties

Description: Given an index, return all properties associated with index[x].

Exhibit.Database._Type

Represents a type in the database.

Exhibit.Database._Type

Arguments:
id: String, Type identifier
Returns: Exhibit.Database._Type
Description: Constructor

Exhibit.Database._Type.prototype.getID

Description: Getter for a type ID, an Exhibit database identifier.

Exhibit.Database._Type.prototype.getURI

Description: Getter for a type's URI.

Exhibit.Database._Type.prototype.getLabel

Description: Getter for a type's label.

Exhibit.Database._Type.prototype.getOrigin

Description: Getter for a type's provenance.

Exhibit.Database._Type.prototype.getProperty

Description: Returns a custom property-value pair's value for the type.

Exhibit.Database._Property

Exhibit.Database._Property

Description: Constructor

Exhibit.Database._Property.prototype.getID

Description: Getter

Exhibit.Database._Property.prototype.getURI

Description: Getter

Exhibit.Database._Property.prototype.getValueType

Description: Getter

Exhibit.Database._Property.prototype.getLabel

Description: Getter

Exhibit.Database._Property.prototype.getPluralLabel

Description: Getter

Exhibit.Database._Property.prototype.getReverseLabel

Description: Getter

Exhibit.Database._Property.prototype.getReversePluralLabel

Description: Getter

Exhibit.Database._Property.prototype.getGroupingLabel

Description: Getter

Exhibit.Database._Property.prototype.getGroupingPluralLabel

Description: Getter

Exhibit.Database._Property.prototype.getOrigin

Description: Getter

Exhibit.Database._Property.prototype.getRangeIndex

Description: Returns this property's index of range values, or calls _buildRangeIndex if not already built.

Exhibit.Database._Property.prototype._onNewData

Description: Called when new data is added, removing the previously constructed range index.

Exhibit.Database._Property.prototype._buildRangeIndex

Description: Builds the range index of this property's values depending on its value type.

Exhibit.Database._RangeIndex

Represents an index of value ranges for a property in the database.

Exhibit.Database._RangeIndex

Arguments:
items: Exhibit.Set, A set of database subjects
getter: Function, A function that takes parameters (item, fn) where item comes from the items argument and fn takes the value as an argument. getter will probably call getObjects(item, property, null, null) as part of its execution.
Returns: Exhibit.Database._RangeIndex
Description: Constructor, builds and sorts an index on a property's values based on the initial set of items.

Exhibit.Database._RangeIndex.prototype.getCount

Description: A count of all elements in this index.

Exhibit.Database._RangeIndex.prototype.getMin

Description: The smallest element in this index, or infinity if empty.

Exhibit.Database._RangeIndex.prototype.getMax

Description: The largest element in this index, or negative infinity if empty.

Exhibit.Database._RangeIndex.prototype.getRange

Description: Using a visitor function, provide it as an argument every item in this index that falls in the provided open or closed range.

Exhibit.Database._RangeIndex.prototype.getSubjectsInRange

Description: Build a visitor function to construct a set to hand to getRange, optionally with a filter of acceptable subjects.

Exhibit.Database._RangeIndex.prototype.countRange

Description: Count the number of elements in this range between the specified open or closed range of values.

Exhibit.Database._RangeIndex.prototype._indexOf

Description: Find and return the closest preceding numeric index for a given value if it falls inside this range.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox