store/Entry

Source:

Methods

add(predicate, object) → {Entry}

Description:
  • Same as entry.getMetadata().add(entry.getResourceURI(), predicate, o) but instead of returning the created statement it returns the entry itself, allowing chained method calls.

Source:
Parameters:
Name Type Description
predicate string

the predicate

object object

the object

Returns:
Type
Entry

addD(predicate, literal, datatype) → {Entry}

Description:
  • Same as entry.getMetadata().addD(entry.getResourceURI(), predicate, literal, lang) but instead of returning the created statement it returns the entry itself, allowing chained method calls.

Source:
Parameters:
Name Type Description
predicate string

the predicate

literal string

the literal value

datatype string

the datatype (should be a string)

Returns:
Type
Entry

addL(predicate, literal, language) → {Entry}

Description:
  • Same as entry.getMetadata().addL(entry.getResourceURI(), predicate, literal, lang) but instead of returning the created statement it returns the entry itself, allowing chained method calls.

Source:
Parameters:
Name Type Description
predicate string

the predicate

literal string

the literal value

language string

an optional language

Returns:
Type
Entry

canAdministerEntry() → {boolean}

Description:
  • Is the current user an owner of this entry?

Source:
Returns:
Type
boolean

canReadMetadata() → {boolean}

Description:
  • Is the current user authorized to read the metadata of this entry?

Source:
Returns:
Type
boolean

canReadResource() → {boolean}

Description:
  • Is the current user authorized to read the resource of this entry?

Source:
Returns:
Type
boolean

canWriteMetadata() → {boolean}

Description:
  • Is the current user authorized to write the metadata of this entry?

Source:
Returns:
Type
boolean

canWriteResource() → {boolean}

Description:
  • Is the current user authorized to write the resource of this entry?

Source:
Returns:
Type
boolean

(async) commitCachedExternalMetadata() → {Promise.<Entry>}

Description:
  • Pushes the current cached external metadata graph for this entry to the repository.

Source:
Returns:

a promise that on success will contain the current updated entry.

Type
Promise.<Entry>

(async) commitMetadata() → {Promise.<Entry>}

Description:
  • Will push the metadata for this entry to the repository. If metadata has been set for an entry with EntryType 'reference' the entry type will change to 'linkreference' upon a successful commit.

Source:
Returns:

a promise that on success will contain the current updated entry.

Type
Promise.<Entry>

(async) del(recursive) → {Promise}

Description:
  • Deletes this entry without any option to recover it.

Source:
Parameters:
Name Type Default Description
recursive boolean false

if true and the entry is a list it will delete the entire tree of lists and all entries that is only contained in the current list or any of its child lists.

Returns:

which on success indicates that the deletion has succeeded.

Type
Promise

getAllMetadata() → {rdfjson/Graph}

Description:
  • Provides all metadata, different behaviour depending on entry type:

    • local - local metadata, i.e. getMetadata()
    • link - local metadata, i.e. getMetadata()
    • reference - cached external metadata, i.e. getCachedExternalMetadata()
    • linkReference - new graph which is a combination of cached external metadata and local metadata
Source:
Returns:
Type
rdfjson/Graph

getCachedExternalMetadata() → {rdfjson/Graph}

Description:
  • Cached external metadata can only be provided for entries with entry type reference or link reference.

Source:
Returns:
  • a RDF graph with cached external metadata, typically containing statements about the resourceURI. The returned graph may be empty but never null or undefined.
Type
rdfjson/Graph

getContext() → {Context}

Source:
Returns:
Type
Context

getEntryInfo() → {EntryInfo}

Source:
Returns:
Type
EntryInfo

getEntryStore() → {EntryStore}

Source:
Returns:
Type
EntryStore

getExtractedMetadata() → {rdfjson/Graph}

Source:
To Do:
  • remains to be supported in repository
Returns:
Type
rdfjson/Graph

getId() → {string}

Description:
  • Convenience method, same as calling entry.getEntryInfo().getId()

Source:
See:
  • EntryInfo#getId
Returns:

the id of the entry

Type
string

getLinkedEntry() → {Promise.<Entry>|undefined}

Description:
  • Is the entry is a link to another entry (as either a link, linkreference or reference) the linked to entry is returned in a promise.

Source:
Returns:

undefined only if the entry does not link to another entry.

Type
Promise.<Entry> | undefined

getMetadata() → {rdfjson/Graph}

Description:
  • Provides an RDF graph as an rdfjson/Graph instance.

Source:
Returns:

a RDF graph with metadata, typically containing statements about the resourceURI. The returned graph may be empty but never null or undefined.

Type
rdfjson/Graph

getParentGroups() → {Array.<string>}

Description:
  • a list of entry URIs corresponding to groups where this user entry is member.

Source:
Returns:
Type
Array.<string>

getParentLists() → {Array.<string>}

Description:
  • a list of entry URIs corresponding to list entries where this entry is contained.

Source:
Returns:
Type
Array.<string>

getReferrers(prop) → {Array.<string>}

Description:
  • a list of URIs that has referred to this Entry using various properties.

Source:
Parameters:
Name Type Description
prop string
Returns:
Type
Array.<string>

getReferrersGraph() → {rdfjson/Graph}

Source:
Returns:
Type
rdfjson/Graph

getResource() → {Resource|Promise.<Resource>}

Description:
  • Provides the resource for this entry if it exists in a promise, e.g. if the graph-type is not none. It is also possible to request the resource directly, i.e. get the resource rather than a promise. This is achieved by specifying the "direct" parameter as true. This always work for Lists, Groups, and Context resources. For all other resources it will work if the resource, e.g. a Graph, a String etc. is already loaded. If it is not loaded null will be returned.

Source:
Returns:
Type
Resource | Promise.<Resource>

getResourceURI() → {string}

Description:
  • Convenience method, same as calling entry.getEntryInfo().getResourceURI()

Source:
Returns:

a URI to the resource of this entry.

Type
string

getURI() → {string}

Description:
  • Convenience method, same as calling entry.getEntryInfo().getEntryURI()

Source:
See:
  • EntryInfo#getEntryURI
Returns:

the entry uri.

Type
string

isContext() → {boolean}

Description:
  • Is the resource of this entry of the GraphType context?

Source:
Returns:
Type
boolean

isExternal() → {boolean}

Description:
  • Is the entry of the EntryType link, linkreference or reference? That is, the resource can be controlled via EntryInfo#setResourceURI.

Source:
Returns:

true if entrytype is NOT local.

Type
boolean

isGraph() → {boolean}

Description:
  • Is the resource of this entry of the GraphType graph?

Source:
Returns:
Type
boolean

isGroup() → {boolean}

Description:
  • Is the resource of this entry of the GraphType group?

Source:
Returns:
Type
boolean

isInformationResource() → {boolean}

Description:
  • Is the entry an information resource?

Source:
Returns:
Type
boolean
Description:
  • Is this entry of the EntryType link?

Source:
Returns:
Type
boolean

isLinkReference() → {boolean}

Description:
  • Is this entry of the EntryType linkreference?

Source:
Returns:
Type
boolean

isLinkToEntry() → {boolean}

Description:
  • Is the entry a local link/linkreference/reference to another entry in the repository. That is, true if the entry is a link, linkreference or reference AND the resource URI belongs to another entry in the same repository.

Source:
Returns:
Type
boolean

isList() → {boolean}

Description:
  • Is the resource of this entry of the GraphType list?

Source:
Returns:
Type
boolean

isLocal() → {boolean}

Description:
  • Is the EntryType local, i.e. the resources URI is maintained automatically by the repository for this entry. Opposite to Entry#isLinkLike.

Source:
Returns:
Type
boolean

isNamedResource() → {boolean}

Description:
  • Is the entry a named resource?

Source:
Returns:
Type
boolean

isNone() → {boolean}

Description:
  • Is the resource of this entry of the GraphType none?

Source:
Returns:
Type
boolean

isPipeline() → {boolean}

Description:
  • Is the resource of this entry of the GraphType pipeline?

Source:
Returns:
Type
boolean

isPipelineResult() → {boolean}

Description:
  • Is the resource of this entry of the GraphType pipelineresult?

Source:
Returns:
Type
boolean

isPrivateTo() → {boolean|undefined}

Description:
  • Whether this entry is available to the specified user. To make sure this method returns a boolean and not undefined, make sure that the contexts entry is loaded, e.g. via:

    entry.getContext().getEntry().then(function() { //And then do you check, e.g.: entry.getEntryStore().getUserEntry().then(function(currentUserEntry) { if (entry.isPrivateTo(currentUserEntry) {...} }) }

Source:
Returns:

undefined if the contexts entry which specifies the default access is not cached, otherwise a boolean is returned.

Type
boolean | undefined

isPublic() → {boolean|undefined}

Description:
  • Whether this entry is available publically or not. To make sure this method returns a boolean make sure the contexts entry is loaded, e.g. via: entry.getContext().getEntry().then(function() { if (entry.isPublic()) {...} //Or whatever you need to do with the isPublic method. }

Source:
Returns:

undefined only if the entry has no ACL and the contexts entry which specifies the default access is not cached, otherwise a boolean is returned.

Type
boolean | undefined

isReference() → {boolean}

Description:
  • Is this entry of the EntryType reference?

Source:
Returns:
Type
boolean

isResultList() → {boolean}

Description:
  • Is the resource of this entry of the Graphtype resultlist?

Source:
Returns:
Type
boolean

isString() → {boolean}

Description:
  • Is the resource of this entry of the GraphType string?

Source:
Returns:
Type
boolean

isSystemContext() → {boolean}

Description:
  • Is the resource of this entry of the GraphType systemcontext?

Source:
Returns:
Type
boolean

isUser() → {boolean}

Description:
  • Is the resource of this entry of the GraphType user?

Source:
Returns:
Type
boolean

needRefresh() → {boolean}

Description:
  • Tells whether an entry needs to be refreshed.

Source:
See:
  • Entry#refresh.
Returns:

true if the entry need to be refreshed before used.

Type
boolean

projection(mappings, multipleValueStyle) → {Object}

Description:
  • Retrieves a projection, a plain object with simple attribute value pairs given mapping. The subject will always be the resource uri of the entry. The mapping is an object where the same attributes appear but with the predicates are values. Hence, each attribute gives rise to a search for all statements with the given subject and the predicate specified by the attribute. The result object will contain the mapping attributes with values from the the first matched statements object value if there are any. To access additional information like multiple statement or the statements (type, language, datatype) a "*" prepended version of each attribute can be provided that contains a list of matching Statements if so indicated by the multipleValueStyle parameter.

Source:
See:
  • rdfjson/Graph
Example
var proj = entry.projection({
    "title":       "http://purl.org/dc/terms/title",
    "description": "http://purl.org/dc/terms/description"
});
// The object proj now has the attributes title, *title, description, and *description.

// Accessing the title of http://example.com
console.log(proj.title);

// To get hold of additional information available in the statement,
// for instance the language of a literal:
console.log(proj["*title"][0].getLanguage())
Parameters:
Name Type Default Description
mappings Object

the mapping configuration

multipleValueStyle String none

if provided an array is provided for that property prefixed with "*", the array should be indicated to be either "statements", "values" or "objects".

Returns:
Type
Object

refresh(silentlyopt, forceopt)

Description:
  • Refreshes an entry if needed, that is, if it has been marked as invalid.

Source:
Parameters:
Name Type Attributes Default Description
silently boolean <optional>
true

the cache will send out a refresh message for this entry if a refresh was needed AND if the value of silently is false or undefined. If force is true it will send out a refresh message anyhow.

force boolean <optional>
false

If true the entry will be refreshed independent if it was marked in need of a refresh or not.

setCachedExternalMetadata(graph)

Description:
  • Sets a new cached external metadata graph for this entry without pushing it to the repository.

Source:
Parameters:
Name Type Description
graph rdfjson/Graph

is an RDF graph with metadata.

Returns:

Entry - to allow chaining with other methods, e.g. with commitCachedExternalMetadata.

setMetadata(graph)

Description:
  • Sets a new metadata graph for this entry without pushing it to the repository. In many cases this method is not needed since you can get the metadata graph, modify it and then commit the changes directly.

    However, in some cases you need to set a new metadata graph, e.g. you want to overwrite the metadata with a new graph retrieved from another source or the entry have been refreshed with new information and you want to commit the merged results. In these cases you need to discard the current metadata graph with help of this method.

Source:
Parameters:
Name Type Description
graph rdfjson/Graph

is an RDF graph with metadata, if it is not provided the current metadata graph is saved (there is currently no check whether it has been modified or not).

Returns:

Entry - to allow chaining with other methods, e.g. with commitMetadata.

setRefreshNeeded(silentlyopt)

Description:
  • That an entry needs to be refreshed typically means that it contains stale data (with respect to what is available in the store). The entry should be refresh before it is further used.

Source:
See:
  • store.Entry#refresh.
Parameters:
Name Type Attributes Default Description
silently boolean <optional>
true

the cache will send out a stale message (to all registered listeners of the cache) for this entry if the value is false or undefined.