-
Notifications
You must be signed in to change notification settings - Fork 2
dev guide
The dev guide contains some resources specifically for developers, e.g. how to add a data source or query, how to put variables from code into the query.
The software is easily extensible.
If you are not interested in using one or more of the supplied data sources, just remove the respective folder from src/main/resources/sparqlg
and the according controller in the package eu.tib.controller
. There are no dependencies between queries of different data sources.
Follow the steps to add a new data source:
- add a new folder named after your data source under
src/main/resources/sparqlg
. - for every query add a folder and include a
sparql-generate-conf.json
(its structure is described on the SPARQL-Generate website). - add a controller in
eu.tib.controller
that retrieves your input and calls your query likewrService.execute(queryid, input)
-
queryid
contains the path to yoursparql-generate-conf.json
within the resources folder. -
input
is a Map where you put your input values. Every key-value-pair will be available in your query as a binding, where?key
will be replaced withvalue
.
.
-
Queries from a data source are typically divided into three steps: source, extraction, vivo-rdf.
- source: this query only loads data from a source, e.g. via the source command or HTTP GET/POST
- mapping: this query extracts the relevant properties from the retrieved data and binds them to variables
- vivo-rdf: this query defines the VIVO objects and puts the extracted properties into the RDF statements
This structure has the following advantages:
- sometimes a source query can be skipped, if the data was already loaded by a previous query
- all RDF statements for VIVO are in a central folder and can be reused
To transfer input variables from a HTTP request / Java code into one of the queries, use the input
parameter required by wrService.execute(queryid, input)
. input
is a Map (=set of key-value-pairs). Every key-value-pair will be available in your query as a binding, where ?key
will contain the value
.