-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstorage.js
135 lines (121 loc) · 4.34 KB
/
storage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
* Copyright 2014 IBM Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* storage.js is an abstract implementation of the storage services required by
* ldp-service and oslc-service. This module is intended to be implemented on
* different data sources such as Apache Jena, the file system, MongoDB, or
* any other data source in order to provide LDP access to those resources.
*
* The abstraction of data storage services is of a container of resources that
* represent RDF graphs.
*
*/
/*
* Initialize the database. This could be done using
* the facilities of the DBMS and may not need to be implemented
* in all cases. It does provide a way to specify the env.dbName
* for the database you want to use, and makes sure the database
* exists and is initialized, possibly with at least one root
* container graph.
*
* @param {config} env - provides the environment parameters
* @param {callback} callback()
*/
exports.init = function init(env, callback) {
console.log("storage method init(env, callback) not implemented")
}
/*
* Drop an initialized database. This could be done using
* the facilities of the DBMS and may not need to be implemented
* in all cases. Implement this if you want init/drop to be able
* to dynamically create and remove databases. Don't implement
* it if you want the database to be already implemented outside
* the app.
*
* @param {callback} callback()
*/
exports.drop = function drop(callback) {
console.log("storage method drop(callback) not implemented")
}
/*
* Used in create methods to reserve a URI for subsequent update.
* Simply creates an empty graph.
*
* @param {URI} uri - The URI to reserve
* @param {callback} callback(status)
*/
exports.reserveURI = function reserveURI(uri, callback) {
throw "storage method reserveURI(uri, callback) not implemented"
}
/*
* Releases a reserved URI that is no longer needed (i.e., the update
* will never be done)
*
* @param {URI} uri - The URI to reserve
* @param {callback} callback(status)
*/
exports.releaseURI = function releaseURI(uri) {
throw "storage method releaseURI(uri) not implemented"
}
/*
* read a resource given its URI.
*
* @param {URI} uri - The URI to read/GET
* @param {callback} callback(status, IndexedFormula)
*/
exports.read = function read(uri, callback) {
throw "storage method read(uri, callback) not implemented"
}
/*
* Update a resource (an IndexedFormula).
*
* @param {IndexedFormula} resource - The resource content to update (includes its uri)
* @param {callback} callback(status)
*/
exports.update = function update(resource, callback) {
throw "storage method uptate(resource, callback) not implemented"
}
/*
* Insert data (an IndexedFormula) into an existing resource.
* Could be useful to implement HTTP PATCH.
*
* @param {IndexedFormula} data - the triples to insert
* @param {URI} uri - URI of the resource to insert the triples into
* @param {callback} callback(status)
*/
exports.insertData = function insertData(data, uri, callback) {
throw "storage method insertData(data, intoURI, callback) not implemented"
}
/*
* Remove or delete a resource given its URI.
*
* @param {URI} uri - The URI of the resource to remove/delete
* @param {callback} callback(status)
*/
exports.remove = function remove(uri, callback) {
throw "storage method remove(uri, callback) not implemented"
}
/*
* Get the membershipTriples of a DirectContainer a resource given its URI.
* These are calculated based on its membershipResource and the hasMembershipRelation
* or isMemberOfRelation properties of the DirectContainer.
*
* @param {URI} container - the URI of the container to whose members are being accessed
* @param {callback} callback(status, [URI])
*/
exports.getMembershipTriples = function getMembershipTriples(container, callback) {
throw "storage method getMembershipTriples(container, callback) not implemented"
}