Skip to content

Commit f90171a

Browse files
authored
Update README.md
1 parent 8f56009 commit f90171a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ Each element in the array will become an API endpoint in the microservice. An ex
3939
## Using variables in the export query
4040
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).
4141

42-
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', 'type']}`. `myVariable` is the name of the variable that must be replaced. `type` is the datatype of the variable. This must be one of `'string'`, `'uri'`, `'int'`, `'float'`, `'date'`, `'dateTime'`, `'bool'`. At runtime the variable will be replaced with the value provided in the `myVariable` query param of the request.
42+
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', 'type']}`.
43+
* `myVariable` is the name of the variable that must be replaced.
44+
* `type` is the datatype of the variable. This must be one of `'string'`, `'uri'`, `'int'`, `'float'`, `'date'`, `'dateTime'`, `'bool'`.
45+
At runtime the variable will be replaced with the value provided in the `myVariable` query param of the request.
4346

4447
An example `export.js` including variables file may look as follows:
4548

@@ -50,15 +53,15 @@ export default [
5053
{
5154
path: '/example',
5255
format: 'text/csv',
53-
query: template`SELECT * FROM <http://mu.semte.ch/application> WHERE { ?s a ${'class'} } LIMIT 100`,
56+
      query: template`SELECT * FROM <http://mu.semte.ch/application> WHERE { ?s a ${['class', 'uri']} } LIMIT 100`,
5457
file: 'export-example.csv'
5558
},
5659
...
5760
];
5861

5962
```
6063

61-
A GET request on `/example?class=<http://xmlns.com/foaf/0.1/Person>` will export the first 100 URIs of type `foaf:Person`.
64+
A GET request on `/example?class=http://xmlns.com/foaf/0.1/Person` will export the first 100 URIs of type `foaf:Person`.
6265

6366
## Example docker-compose
6467
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`.
@@ -67,7 +70,7 @@ If you don't want to build a new Docker image you can also run `semtech/mu-expor
6770
version: '2',
6871
services:
6972
export:
70-
image: semtech/mu-export-service:0.3.0
73+
image: semtech/mu-export-service:1.0.0
7174
volumes:
7275
- ./:/config
7376
links:

0 commit comments

Comments
 (0)