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
The `export.js` file defines an array of export configuration objects as follows:
10
22
@@ -27,27 +39,12 @@ An export configuration object consists of the following properties:
27
39
*[REQUIRED]`query`: the SPARQL query to execute. This may be a `SELECT` or a `CONSTRUCT` query.
28
40
*[OPTIONAL]`file`: name of the downloaded file. The filename may also be provided through a query param on the export request (e.g. `/example?file=my-name.csv`). If no filename is provided, the export will be displayed inline in the browser.
29
41
30
-
## Example docker-compose
31
-
32
-
```yaml
33
-
version: '2',
34
-
services:
35
-
export:
36
-
image: semtech/mu-export-js-template:0.2.0
37
-
volumes:
38
-
- ./:/config
39
-
links:
40
-
- database:database
41
-
```
42
-
43
-
Note: if you extend the `semtech/mu-export-js-template` with an `export.js` file instead of mounting a volume in `/config`, the `ONBUILD` commands of the `semtech/mu-javascript-template` will not be executed in your image since `ONBUILD` is only executed one level deep.
44
-
45
42
## Using variables in the export query
46
43
You can also define variables in your SPARQL export query which will be replaced with query param values at runtime. Therefore, we use [ES6's tagged template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals).
47
44
48
-
Import the `template` tag function from `/app/template.js` in your `export.js` and apply the tag function on your query. You can then define variables in your SPARQL query using `${'myVariable'}`. At runtime the variable will be replaced with the value provided in the `myVariable` query param of the request.
45
+
Import the `template` tag function from `/app/template.js` in your `export.js` and apply the tag function on your query. You can then define variables in your SPARQL query using `${'myVariable'}` (note the quotes around the variable name). At runtime the variable will be replaced with the value provided in the `myVariable` query param of the request.
49
46
50
-
An example `export.js` file may look as follows:
47
+
An example `export.js`including variables file may look as follows:
51
48
52
49
```javascript
53
50
importtemplatefrom'/app/template.js';
@@ -65,3 +62,17 @@ export default [
65
62
```
66
63
67
64
A GET request on `/example?class=<http://xmlns.com/foaf/0.1/Person>` will export the first 100 URIs of type `foaf:Person`.
65
+
66
+
## Example docker-compose
67
+
If you don't want to build a new Docker image you can also run `semtech/mu-export-service` and mount your export configuration in `/config`.
0 commit comments