Skip to content

Commit 5dce378

Browse files
committed
Updated README (Advanced topics)
1 parent 57e2146 commit 5dce378

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

README.md

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ Table of contents:
2020
* [Custom queries](#custom-queries)
2121
* [Representation Mapper](#representation-mapper)
2222
* [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)
2326
* [Testing](#testing)
2427
* [Testing the production version](#testing-the-production-version)
2528
* [Testing the development version](#testing-the-development-version)
@@ -137,7 +140,7 @@ The configuration file `main/src/config.json` follows a simple structure.
137140
"description": "Description of the query",
138141
"icon": "The key to the icon for the query. This is optional and a default menu icon will be used when left empty.",
139142
"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",
141144
"useProxy": "True or false, whether the query should be executed through the proxy or not. This field is optional and defaults to false.",
142145
... any other field that can be used in the Comunica query engine https://comunica.dev/docs/query/advanced/context/
143146
},
@@ -207,10 +210,10 @@ If all possible values for the template variables are fixed and hence can be wri
207210
* In the config file:
208211
* Add a `variables` object in the query's entry in the configuration file.
209212
* 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.
211214

212215
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.
214217
For URIs you must add surrounding angle brackets `<>`.
215218
Other literals (integers for example) don't have to be surrounded with extra delimiters.
216219
This is shown in the configuration structure above.
@@ -318,9 +321,39 @@ You can make use of these for your own tests. Follow these steps:
318321
These files will be available in the pod relative to `http://localhost:8080/example/`.
319322
* Prepare the pods by executing `npm run reset:pods` in directory `test`.
320323

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+
321354
## Testing
322355

323-
For testing we use [Cypress](https://www.cypress.io/).
356+
For testing with the provided configuration file, we use [Cypress](https://www.cypress.io/).
324357

325358
> It is important to test the production version at least at the end of a development cycle.
326359
@@ -374,18 +407,3 @@ The procedure is the same as for testing the production version, except for step
374407
```bash
375408
npm run dev
376409
```
377-
378-
## Advanced Usage
379-
380-
You can build your applications using custom queries created interactively with the query editor. To do this, you will need access to a pod, the viewer, and the `config.json` file. Follow these steps to get started:
381-
382-
1. **Log in to the viewer** with an account that has access to a pod.
383-
2. **Create custom queries** using the data viewer. You can refine and edit them until they meet your needs. Feel free to create as many queries as necessary.
384-
3. Once you're satisfied, **save the queries** by navigating to the dashboard and saving them as a file on the pod.
385-
4. Next, access the saved file on the pod using a Solid pod viewer, such as [Penny](https://penny.vincenttunru.com/).
386-
5. **Copy the content** of the file, which should contain a list of query objects.
387-
6. Open the `config.json` file and **add the query objects** to the list of existing queries.
388-
7. If necessary, update the `queryGroupId` property to assign the queries to a different group. Ensure the group exists in the `queryGroups` list, or create the group if it doesn’t exist.
389-
8. **Save the `config.json` file** to finalize your changes.
390-
391-
With these steps completed, your queries are ready to use in your application.

0 commit comments

Comments
 (0)