Class: UpdateManager

UpdateManager(store)

Update Manager The update manager is a helper object for a store. Just as a Fetcher provides the store with the ability to read and write, the Update Manager provides functionality for making small patches in real time, and also looking out for concurrent updates from other agents

Constructor

new UpdateManager(store)

Parameters:
Name Type Description
store IndexedFormula the quadstore to store data and metadata. Created if not passed.f
Source:

Methods

clearUpstreamCount()

We want to start counting websocket notifications to distinguish the ones from others from our own.
Source:

editable(uri, kb) → {string|boolean|undefined}

Tests whether a file is editable. Files have to have a specific annotation that they are machine written, for safety. We don't actually check for write access on files.
Parameters:
Name Type Description
uri string
kb IndexedFormula
Source:
Returns:
The method string SPARQL or DAV or LOCALFILE or false if known, undefined if not known.
Type
string | boolean | undefined

put(doc, data, contentType, callbackFunction) → {Promise}

This is suitable for an initial creation of a document
Parameters:
Name Type Description
doc Node
data string | Array.<Statement>
contentType string
callbackFunction function callbackFunction(uri, ok, message, response)
Source:
Throws:
On unsupported content type (via serialize())
Type
Error
Returns:
Type
Promise

reload(kb, doc, callbackFunction)

Reloads a document. Fast and cheap, no metadata. Measure times for the document. Load it provisionally. Don't delete the statements before the load, or it will leave a broken document in the meantime.
Parameters:
Name Type Description
kb
doc NamedNode
callbackFunction
Source:

requestDownstreamAction(doc, action)

Requests a now or future action to refresh changes coming downstream This is designed to allow the system to re-request the server version, when a websocket has pinged to say there are changes. If the websocket, by contrast, has sent a patch, then this may not be necessary.
Parameters:
Name Type Description
doc
action
Source:

serialize(uri, data, contentType) → {string}

Parameters:
Name Type Description
uri string
data string | Array.<Statement>
contentType string
Source:
Throws:
On unsupported content type
Type
Error
Returns:
Type
string

setRefreshHandler(doc, handler) → {boolean}

Sets up websocket to listen on There is coordination between upstream changes and downstream ones so that a reload is not done in the middle of an upstream patch. If you use this API then you get called when a change happens, and you have to reload the file yourself, and then refresh the UI. Alternative is addDownstreamChangeListener(), where you do not have to do the reload yourself. Do mot mix them. kb contains the HTTP metadata from previous operations
Parameters:
Name Type Description
doc
handler
Source:
Returns:
Type
boolean

update(deletions, insertions, callbackFunction) → {*}

Update This high-level function updates the local store iff the web is changed successfully. Deletions, insertions may be undefined or single statements or lists or formulae (may contain bnodes which can be indirectly identified by a where clause). The `why` property of each statement must be the same and give the web document to be updated
Parameters:
Name Type Description
deletions Statement or statments to be deleted.
insertions Statement or statements to be inserted
callbackFunction function called as callbackFunction(uri, success, errorbody) OR returns a promise
Source:
Returns:
Type
*

update_statement()

return a statemnet updating function This does NOT update the statement. It returns an object which includes function which can be used to change the object of the statement.
Source:

updateLocalFile(doc, ds, is, callbackFunction)

Likely deprecated, since this lib no longer deals with browser extension
Parameters:
Name Type Description
doc
ds
is
callbackFunction
Source: