module:store/Graph

module:store/Graph

Graph is a resource for handling RDF graphs relying on the rdfjson/Graph API.

Constructor

new (require("store/Graph"))(entryURI, resourceURI, entryStore, data)

Source:
Parameters:
Name Type Description
entryURI string

URI to an entry where this resource is contained.

resourceURI string

URI to the resource.

entryStore EntryStore

the API's repository instance.

data rdfjson/Graph | Object

is an RDF graph of some sort

Methods

commit(graph) → {Promise}

Source:
To Do:
  • fix ifModifiedSince.

Pushes the current graph back to repository.

Parameters:
Name Type Description
graph rdfjson/Graph
Returns:
Type
Promise

getGraph() → {rdfjson/Graph}

Source:

Get the rdf Graph. The returned graph is not a copy, subsequent getGraph calls will return the same instance as long as the entry has not been refreshed or a new instance set via setGraph.

Returns:

will never be null or undefined, although the graph may be empty.

Type
rdfjson/Graph

getSource() → {Object}

Source:

Provides a JSON representation of the graph as rdf/json.

Returns:
Type
Object

setGraph(graph) → {Graph}

Source:

Set the rdf Graph. To update the graph in the repository call the commit.

Parameters:
Name Type Description
graph rdfjson/Graph

the new graph, if null or undefined a new empty graph will be set.

Returns:
  • to allow chaining with commit.
Type
Graph