@muze-nl/simplystore 0.1.2 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/README.md CHANGED
@@ -4,54 +4,112 @@ SimplyStore is an attempt to create a radically simpler backend storage server.
4
4
 
5
5
  [JSONTag](https://github.com/poef/jsontag) is an enhancement over JSON that allows you to tag JSON data with metadata using HTML-like tags.
6
6
  Javascript queries are run in a [VM2](https://www.npmjs.com/package/vm2) sandbox.
7
+ You can query data using the [array-where-select](https://www.npmjs.com/package/array-where-select) extension.
7
8
 
9
+ ## Table of Contents
8
10
 
9
- ## Installation
11
+ - [Background](#background)
12
+ - [Install](#install)
13
+ - [Usage](#usage)
14
+ - [Example Query](#examples)
15
+ - [Goals](#goals)
16
+ - [Roadmap](#roadmap)
17
+ - [License](#license)
10
18
 
11
- SimplyStore is a Node application. Start it by downloading this git repository:
19
+ <a name="background"></a>
20
+ ## Background
21
+
22
+ <a name="install"></a>
23
+ ## Install
24
+
25
+ SimplyStore is a Node library. You can install it in your application like this:
12
26
 
13
27
  ```shell
14
- git clone git@github.com:simplyedit/simplystore
28
+ npm install @muze-nl/simplystore
15
29
  ```
16
30
 
17
- Then install its dependencies:
31
+ <a name="usage"></a>
32
+ ## Usage
18
33
 
19
- ```shell
20
- cd simplystore
21
- npm install
34
+ Import the server in your main file like this:
35
+
36
+ ```javascript
37
+ import simplystore from '@muze-nl/simplystore'
22
38
  ```
23
39
 
24
- And start it up:
40
+ Then configure and start the server, like this:
41
+
42
+ ```javascript
43
+ simplystore.run({
44
+ datafile: process.cwd().'data.json'
45
+ })
46
+ ````
47
+
48
+ Other options are:
49
+
50
+ - port: The port number to use, defaults to 3000
51
+ - dataspace: an object or array with all the data that SimplyStore will serve. Optional, replaces the datafile.
52
+
53
+ If you start your server:
25
54
 
26
55
  ```shell
27
- npm start
56
+ node myApp.js
28
57
  ```
29
58
 
30
- The server comes with a small demo dataset, which you can take a look at here `http://localhost:3000/`:
59
+ You should be able to go http://localhost:3000/query/ and see something like this:
31
60
 
32
- This page will show this:
61
+ ![image](https://github.com/SimplyEdit/SimplyStore/assets/1006453/3bec6b97-ffa1-4114-9ed4-51a68f73476e)
62
+
63
+ <a name="examples"></a>
64
+ ## Example query
65
+
66
+ Given a dataset like this (jsontag):
33
67
 
34
68
  ```
35
69
  {
36
- "persons":<link>"persons/"
70
+ "persons": [
71
+ <object id="john" class="Person">{
72
+ "name": "John",
73
+ "lastName": "Doe",
74
+ "dob": <date>"1972-09-20",
75
+ "foaf": [
76
+ <link>"jane"
77
+ ]
78
+ },
79
+ <object id="jane" class="Person">{
80
+ "name": "Jane",
81
+ "lastName": "Doe",
82
+ "dob": <date>"1986-01-01",
83
+ "foaf": [
84
+ <link>"john"
85
+ ]
86
+ }
87
+ ]
37
88
  }
38
89
  ```
39
90
 
40
- By following the link to `http://localhost:3000/persons/` you get:
91
+ You can post to the /query/ endpoint with javascript queries like these:
41
92
 
42
93
  ```
43
- [
44
- <object class="Person">{
45
- "name":"John",
46
- "dob":<date>"1972-09-20"
47
- },
48
- <object class="Person">{
49
- "name":"Jane",
50
- "dob":<date>"1986-01-01"
94
+ data.persons
95
+ .where({
96
+ name: 'John'
97
+ })
98
+ .select({
99
+ name: _,
100
+ foaf: {
101
+ name: _
51
102
  }
52
- ]
103
+ })
53
104
  ```
54
105
 
106
+ See the [array-where-select](https://www.npmjs.com/package/array-where-select) package for more information about the query possibilities.
107
+
108
+ Remember: it is just javascript, so you can also use filter(), map() and reduce() on arrays. You can use all the default javascript API's, like Math, Array, Object, etc. You can not use any webbrowser API's, and you can't access any NodeJS API's. You do not have network access in your query.
109
+
110
+ Most important: queries cannot change the dataset, it is immutable.
111
+
112
+ <a name="goals"></a>
55
113
  ## Goals of this project
56
114
 
57
115
  SimplyStore is an attemp to see if we can create a more defined and usable REST like service, out of the box. One where all you need to do is change the data and add some access rights and get a self-describing, browseable, working API.
@@ -64,7 +122,7 @@ The SimplyStore design is predicated on the following realisations:
64
122
  4. There is no clear onramp from JSON to Linked Data.
65
123
  5. Linked Data is very good for data / information exchange, but very costly for data manipulation and querying.
66
124
 
67
- So the scope for jsontag-rest-server is:
125
+ So the scope for SimplyStore is:
68
126
 
69
127
  - datasets that will fit comfortably in memory, for now I've set a test goal of about 1GB of data.
70
128
  - usecases that are mostly-read, with sparse updates.
@@ -73,9 +131,9 @@ So the scope for jsontag-rest-server is:
73
131
 
74
132
  In addition, SimplyStore is meant to be a real-world testcase for JSONTag.
75
133
 
134
+ <a name="roadmap"></a>
76
135
  ## Roadmap
77
136
 
78
- - [v] immutable dataset
79
137
  - allow changes to dataset by creating a new root
80
138
  - command handling with crud commands and command log
81
139
  - backup current dataset to JSONTag file
@@ -83,17 +141,11 @@ In addition, SimplyStore is meant to be a real-world testcase for JSONTag.
83
141
 
84
142
  - improved web client with type-specific views and form elements
85
143
 
86
- - Datalog query support
87
- - [v] compile triple store from jsontag data
88
- - [v] add query method
89
- - [v] extend datalog query to allow for custom match functions
90
- - [v] run /query post body in VM2 sandbox
91
- - [v] immutable dataset in query vm
92
- - add indexing and other optimizations
93
- - add standard library of matching functions
94
- - allow vanilla javascript array map/reduce/filter approach
95
-
96
144
  - add support for metadata on each JSON pointer path (or better: each object)
97
145
  - allow custom templates, instead of the default index.html
98
146
  - add support for access control, based on webid / openid connect
99
147
 
148
+ <a name="license"></a>
149
+ ## License
150
+
151
+ [MIT](LICENSE) © Muze.nl
@@ -0,0 +1,11 @@
1
+ curriculum-basis
2
+ curriculum-doelgroepteksten
3
+ curriculum-erk
4
+ curriculum-examenprogramma
5
+ curriculum-examenprogramma-bg
6
+ curriculum-inhoudslijnen
7
+ curriculum-kerndoelen
8
+ curriculum-leerdoelenkaarten
9
+ curriculum-syllabus
10
+ curriculum-referentiekader
11
+ curriculum-niveauhierarchie