You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+44-7
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,9 @@ Table of contents:
20
20
*[Custom queries](#custom-queries)
21
21
*[Representation Mapper](#representation-mapper)
22
22
*[Using the local pods](#using-the-local-pods)
23
+
*[Advanced topics](#advanced-topics)
24
+
*[Adapting this project to your needs](#adapting-this-project-to-your-needs)
25
+
*[Converting custom queries into common queries](#converting-custom-queries-into-common-queries)
23
26
*[Testing](#testing)
24
27
*[Testing the production version](#testing-the-production-version)
25
28
*[Testing the development version](#testing-the-development-version)
@@ -137,7 +140,7 @@ The configuration file `main/src/config.json` follows a simple structure.
137
140
"description": "Description of the query",
138
141
"icon": "The key to the icon for the query. This is optional and a default menu icon will be used when left empty.",
139
142
"comunicaContext": {
140
-
"sources": "Initial list of sources over which the query should be executed",
143
+
"sources": "Initial array of sources over which the query should be executed",
141
144
"useProxy": "True or false, whether the query should be executed through the proxy or not. This field is optional and defaults to false.",
142
145
... any other field that can be used in the Comunica query engine https://comunica.dev/docs/query/advanced/context/
143
146
},
@@ -207,10 +210,10 @@ If all possible values for the template variables are fixed and hence can be wri
207
210
* In the config file:
208
211
* Add a `variables` object in the query's entry in the configuration file.
209
212
* In the `variables` object, for each template variable, add a property with name equal to the template variable's identifier.
210
-
* Set each such property's value to an array strings, where each string is a possible value for the corresponding template variable.
213
+
* Set each such property's value to an array of strings, where each string is a possible value for the corresponding template variable.
211
214
212
215
Note that template variables' values are not restricted to strings: URIs for example are also possible.
213
-
As a consequence, for strings the surround double quotes `"` must be added to the values in the list.
216
+
As a consequence, for strings the surround double quotes `"` must be added to the values in the array.
214
217
For URIs you must add surrounding angle brackets `<>`.
215
218
Other literals (integers for example) don't have to be surrounded with extra delimiters.
216
219
This is shown in the configuration structure above.
@@ -264,12 +267,16 @@ In addition, a user can create and edit custom queries, either from scratch or b
264
267
* Click "CLONE AS CUSTOM QUERY" (in a normal query) or "CLONE" (in a custom query).
265
268
* Make the desired changes in the form and click the "CREATE QUERY" button when ready. The new custom query behaves as if it were created from scratch.
266
269
267
-
* To reproduce a custom query later, a "SAVE QUERY LINK" button is provided.
270
+
* To share a custom query, a "SHARE QUERY" button is provided.
268
271
Use it to generate a unique URL for this custom query.
269
272
Visiting that URL any time later, recreates a custom query with the same specifications.
270
-
This may be useful to forward a custom query to another user.
273
+
This may be useful to share a custom query to another user or to save it for yourself.
271
274
272
-
* To clean up an unwanted custom query, there is always a button "DELETE QUERY"...
275
+
* To clean up an unwanted custom query, there is always a button "DELETE QUERY"...
276
+
277
+
**Warning**: custom queries are stored in your browser's memory and will disappear if the browser page is refreshed or when switching logins.
278
+
279
+
Logged in users however have the possibility to save/load their custom queries to/from a selectable location in their Solid pod, via the buttons in the Dashboard.
273
280
274
281
## Representation Mapper
275
282
@@ -314,9 +321,39 @@ You can make use of these for your own tests. Follow these steps:
314
321
These files will be available in the pod relative to `http://localhost:8080/example/`.
315
322
* Prepare the pods by executing `npm run reset:pods` in directory `test`.
316
323
324
+
## Advanced topics
325
+
326
+
### Adapting this project to your needs
327
+
328
+
The easiest way to adapt this project to your needs is:
329
+
330
+
1. Make your own fork on github.
331
+
2. Concentrate on the files in the `main` subdirectory.
332
+
3. Add your own queries in the `main/public/queries` directory and in general, your own resources in the `main/public` directory.
333
+
4. Write your own `main/src/config.json` file, following the [configuration file documentation above](#configuration-file).
334
+
5. Run or build as documented above.
335
+
336
+
### Converting custom queries into common queries
337
+
338
+
Once you have your basic configuration working, you may extend it with custom queries interactively with the query editor
339
+
and save these to a file in a pod.
340
+
You can convert such custom queries into common queries, by adding them to `main/src/config.json`.
341
+
Follow these steps to get started:
342
+
343
+
1.**Open and view the file with custom queries** using a tool, such as [Penny](https://penny.vincenttunru.com/). The file has JSON syntax and contains an array of query objects.
344
+
2.**Copy the query objects of interest** to the `"queries"` array in `main/src/config.json`.
345
+
Note that the various queries that were documented in the [configuration file documentation above](#configuration-file) in `"queryLocation"` properties,
346
+
appear here as `"queryString"` variants, with inline contents rather than references to query files (`*.rq`).
347
+
Leave as is or convert to query files as you like.
348
+
Inline queries may be hard to read due to the difficult newline coding in JSON syntax.
349
+
3.**Update the `"queryGroupId"` property** in all these queries, to separate them from the custom queries. Ensure the group exists in the `"queryGroups"` array, or create a new group if you prefer.
350
+
4.**Update the `"id"` property**, to avoid conflicts with remaining custom queries: the id must be unique and it also defines the position in the query group.
351
+
5.**Adapt any other properties** according to your preferences.
352
+
6.**Save `main/src/config.json`**, rerun or rebuild and refresh your browser to test.
353
+
317
354
## Testing
318
355
319
-
For testing we use [Cypress](https://www.cypress.io/).
356
+
For testing with the provided configuration file, we use [Cypress](https://www.cypress.io/).
320
357
321
358
> It is important to test the production version at least at the end of a development cycle.
0 commit comments