Members
bnodes
Our identified blank nodes @private
- Source:
(constant) DataFactory
Full RDFLib.js Data Factory
- Source:
(constant) ExtendedTermFactory
Data factory which also supports Collections
Necessary for preventing circular dependencies.
- Source:
RDFParser
Standard namespaces that we know how to handle @final
- Source:
RDFParser
DOM Level 2 node type magic numbers @final
- Source:
reify
Reification flag
- Source:
store
Our triple store reference @private
- Source:
uri
Legacy getter and setter alias, node.uri
- Source:
why
A context for context-aware stores @private
- Source:
Methods
addArc()
Add an arc or property to this frame
- Source:
addBNode()
Add a bnode to this frame
- Source:
addCollection()
Add a collection node to this frame
- Source:
addCollectionArc()
Add a collection arc to this frame
- Source:
addLiteral()
Add a literal to this frame
- Source:
addNode()
Add a symbolic node to this frame
- Source:
addStatus(req, statusMessage)
Records a status message (as a literal node) by appending it to the
request's metadata status collection.
Parameters:
Name | Type | Description |
---|---|---|
req |
BlankNode | |
statusMessage |
string |
- Source:
addSymbol()
Add a symbol of a certain type to the this frame
- Source:
clearUpstreamCount()
We want to start counting websocket notifications
to distinguish the ones from others from our own.
- Source:
createContainer(parentURI, folderNameopt, dataopt) → {Promise.<Response>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
parentURI |
string | URI of parent container | |
folderName |
string |
<optional> |
Optional folder name (slug) |
data |
string |
<optional> |
Optional folder metadata |
- Source:
Returns:
- Type
- Promise.<Response>
(async) createIfNotExists(doc) → {Promise}
Create an empty resource if it really does not exist
Be absolutely sure something does not exist before creating a new empty file
as otherwise existing could be deleted.
Parameters:
Name | Type | Description |
---|---|---|
doc |
NamedNode | The resource |
- Source:
Returns:
- Type
- Promise
delete(uri, optionsopt) → {Promise.<Response>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
uri |
string | ||
options |
Object |
<optional> |
- Source:
Returns:
- Type
- Promise.<Response>
dir()
Returns an $rdf node for the containing directory, ending in slash.
- 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
failFetch(options, errorMessage, statusCode, response) → {Promise.<Object>}
Records errors in the system on failure:
- Adds an entry to the request status collection
- Adds an error triple with the fail message to the metadata
- Fires the 'fail' callback
- Rejects with an error result object, which has a response object if any
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | |
errorMessage |
string | |
statusCode |
number | |
response |
Response | // when an fetch() error |
- Source:
Returns:
- Type
- Promise.<Object>
fetchUri(docuri, options) → {Promise.<Object>}
(The promise chain ends in either a `failFetch()` or a `doneFetch()`)
Parameters:
Name | Type | Description |
---|---|---|
docuri |
string | |
options |
Object |
- Source:
Returns:
fetch() result or an { error, status } object
- Type
- Promise.<Object>
(static) fromBoolean(value) → {Literal}
Parameters:
Name | Type | Description |
---|---|---|
value |
Boolean |
- Source:
Returns:
- Type
- Literal
(static) fromDate(value) → {Literal}
Parameters:
Name | Type | Description |
---|---|---|
value |
Date |
- Source:
Returns:
- Type
- Literal
(static) fromNumber(value) → {Literal}
Parameters:
Name | Type | Description |
---|---|---|
value |
Number |
- Source:
Returns:
- Type
- Literal
fromValue(value) → {Literal}
Parameters:
Name | Type | Description |
---|---|---|
value |
- Source:
Returns:
- Type
- Literal
(static) fromValue(value) → {Node|Collection}
Creates an RDF Node from a native javascript value.
RDF Nodes are returned unchanged, undefined returned as itself.
Parameters:
Name | Type | Description |
---|---|---|
value |
Node | Date | String | Number | Boolean | Undefined |
Returns:
- Type
- Node | Collection
getHeader(doc, header) → {Array|undefined}
Looks up response header.
Parameters:
Name | Type | Description |
---|---|---|
doc |
||
header |
- Source:
Returns:
a list of header values found in a stored HTTP
response, or [] if response was found but no header found,
or undefined if no response is available.
Looks for { [] link:requestedURI ?uri; link:response [ httph:header-name ?value ] }
- Type
- Array | undefined
guessContentType(uri) → {string}
Parameters:
Name | Type | Description |
---|---|---|
uri |
string |
- Source:
Returns:
- Type
- string
handleError(response, docuri, options) → {Promise}
Called when there's a network error in fetch(), or a response
with status of 0.
Parameters:
Name | Type | Description |
---|---|---|
response |
Response | Error | |
docuri |
string | |
options |
Object |
- Source:
Returns:
- Type
- Promise
handleResponse(response, docuri, options)
Handle fetch() response
Parameters:
Name | Type | Description |
---|---|---|
response |
Response | fetch() response object |
docuri |
string | |
options |
Object |
- Source:
handlerForContentType(contentType) → {Handler|null}
Parameters:
Name | Type | Description |
---|---|---|
contentType |
string |
- Source:
Returns:
- Type
- Handler | null
id()
Generates a unique identifier for the object.
Equivalent to {Term.hashString}
- Source:
indexedFormulaQuery(myQuery, callback, fetcher, onDone)
This function will match a pattern to the current kb
The callback function is called whenever a match is found
When fetcher is supplied this will be called to satisfy any resource requests
currently not in the kb. The fetcher function needs to be defined manualy and
should call $rdf.Util.AJAR_handleNewTerm to process the requested resource.
Parameters:
Name | Type | Description |
---|---|---|
myQuery |
a knowledgebase containing a pattern to use as query | |
callback |
whenever the pattern in myQuery is met this is called with the new bindings as parameter | |
fetcher |
IGNORED OBSOLETE f.fetecher is used as a Fetcher instance to do this. | |
onDone |
callback when query finished |
initFetchOptions(uri, options) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
uri |
string | |
options |
Object |
- Source:
Returns:
- Type
- Object
isCrossSite(uri) → {boolean}
Tests whether a request is being made to a cross-site URI (for purposes
of retrying with a proxy)
Parameters:
Name | Type | Description |
---|---|---|
uri |
string |
- Source:
Returns:
- Type
- boolean
isTripleToLoad()
Check if it's OK to load a triple
- Source:
jsonldObjectToTerm(kb, obj) → {Literal|NamedNode|BlankNode|Collection}
Parses json-ld formatted JS objects to a rdf Term.
Parameters:
Name | Type | Description |
---|---|---|
kb |
The DataFactory to use. | |
obj |
The json-ld object to process. |
- Source:
Returns:
- Type
- Literal | NamedNode | BlankNode | Collection
listToStatements()
Adds the statements in a json-ld list object to {kb}.
- Source:
load(uri, options=opt) → {Promise.<Result>}
Promise-based load function
Loads a web resource or resources into the store.
A resource may be given as NamedNode object, or as a plain URI.
an arrsy of resources will be given, in which they will be fetched in parallel.
By default, the HTTP headers are recorded also, in the same store, in a separate graph.
This allows code like editable() for example to test things about the resource.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
uri |
Array.<NamedNode> | Array.<string> | NamedNode | string | |||
options= |
<optional> |
{Object} | ||
options.fetch |
function |
<optional> |
||
options.referringTerm |
NamedNode |
<optional> |
Referring term, the resource which referred to this (for tracking bad links) | |
options.contentType |
string |
<optional> |
Provided content type (for writes) | |
options.forceContentType |
string |
<optional> |
Override the incoming header to force the data to be treated as this content-type (for reads) | |
options.force |
boolean |
<optional> |
Load the data even if loaded before. Also sets the `Cache-Control:` header to `no-cache` | |
options.baseURI |
Node | string |
<optional> |
docuri | Original uri to preserve through proxying etc (`xhr.original`). |
options.proxyUsed |
boolean |
<optional> |
Whether this request is a retry via a proxy (generally done from an error handler) | |
options.withCredentials |
boolean |
<optional> |
flag for XHR/CORS etc | |
options.clearPreviousData |
boolean |
<optional> |
Before we parse new data, clear old, but only on status 200 responses | |
options.noMeta |
boolean |
<optional> |
Prevents the addition of various metadata triples (about the fetch request) to the store | |
options.noRDFa |
boolean |
<optional> |
- Source:
Returns:
- Type
- Promise.<Result>
loadTriple()
Load any constructed triples into the store
- Source:
lookUpThing(term, rterm) → {Promise}
Looks up something.
Looks up all the URIs a things has.
Parameters:
Name | Type | Description |
---|---|---|
term |
NamedNode | canonical term for the thing whose URI is to be dereferenced |
rterm |
NamedNode | the resource which referred to this (for tracking bad links) |
- Source:
Returns:
- Type
- Promise
normalizedContentType(options, headers) → {string}
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | |
headers |
Headers |
- Source:
Returns:
- Type
- string
nowKnownAs()
Note two nodes are now smushed
If only one was flagged as looked up, then the new node is looked up again,
which will make sure all the URIs are dereferenced
- Source:
nowOrWhenFetched()
Asks for a doc to be loaded if necessary then calls back
Calling methods:
nowOrWhenFetched (uri, userCallback)
nowOrWhenFetched (uri, options, userCallback)
nowOrWhenFetched (uri, referringTerm, userCallback, options) <-- old
nowOrWhenFetched (uri, referringTerm, userCallback) <-- old
Options include:
referringTerm The document in which this link was found.
this is valuable when finding the source of bad URIs
force boolean. Never mind whether you have tried before,
load this from scratch.
forceContentType Override the incoming header to force the data to be
treated as this content-type.
Callback function takes:
ok True if the fetch worked, and got a 200 response.
False if any error happened
errmessage Text error message if not OK.
response The fetch Response object (was: XHR) if there was was one
includes response.status as the HTTP status if any.
- Source:
offlineOverride(uri) → {string}
Parameters:
Name | Type | Description |
---|---|---|
uri |
string |
- Source:
Returns:
- Type
- string
parse(document, base, why)
Build our initial scope frame and parse the DOM into triples
Parameters:
Name | Type | Description |
---|---|---|
document |
DOMTree | The DOM to parse |
base |
String | The base URL to use |
why |
Object | The context to which this resource belongs |
- Source:
pendingFetchPromise(uri, originalUri, options) → {Promise.<Result>}
Parameters:
Name | Type | Description |
---|---|---|
uri |
string | |
originalUri |
string | |
options |
Object |
- Source:
Returns:
- Type
- Promise.<Result>
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
putBack(uri, options=opt) → {Promise}
Writes back to the web what we have in the store for this uri
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
uri |
Node | string | ||
options= |
<optional> |
- Source:
Returns:
- Type
- Promise
redirectToProxy(newURI, options) → {Promise.<Response>}
Sends a new request to the specified uri. (Extracted from `onerrorFactory()`)
Parameters:
Name | Type | Description |
---|---|---|
newURI |
string | |
options |
Object |
- Source:
Returns:
- Type
- Promise.<Response>
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:
saveRequestMetadata(docuri, options)
Parameters:
Name | Type | Description |
---|---|---|
docuri |
||
options |
- 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
setCredentials(requestedURI, options)
Decide on credentials using old XXHR api or new fetch() one
Parameters:
Name | Type | Description |
---|---|---|
requestedURI |
string | |
options |
Object |
- Source:
Returns:
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
site()
Returns an NN for the whole web site, ending in slash.
Contrast with the "origin" which does NOT have a trailing slash
- Source:
terminateFrame()
Terminate the frame and notify the store that we're done
- Source:
unsupportedProtocol(uri) → {boolean}
Tests whether the uri's protocol is supported by the Fetcher.
Parameters:
Name | Type | Description |
---|---|---|
uri |
string |
- 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:
webOperation(method, uri, options) → {Promise.<Response>}
A generic web opeation, at the fetch() level.
does not invole the quadstore.
Returns promise of Response
If data is returned, copies it to response.responseText before returning
Parameters:
Name | Type | Description |
---|---|---|
method |
||
uri |
or NamedNode | |
options |
- Source:
Returns:
- Type
- Promise.<Response>