Skip to content

EnexaProject/enexa-utils

Repository files navigation

ENEXA utils

Build

make build

That builds enexa-utils Docker image which is required to build modules.

Setup the test environment

docker-compose up -d

That would start Fuseki and a dummy ENEXA service. It is used for testing enexa-utils and modules.

docker-compose down

That would stop them.

To clear the test SPARQL store:

echo "DELETE WHERE { ?s ?p ?o }" |./sparql-update "http://localhost:47238/test"

Test

Parameter retrieval

export ENEXA_META_DATA_ENDPOINT=https://dbpedia.org/sparql
export ENEXA_MODULE_INSTANCE_IRI=http://dbpedia.org/resource/Lagomorpha
2>&1 perl -E 'say for @ARGV' -- \
"$(./enexa-parameter http://dbpedia.org/property/name)" \
"$(./enexa-parameter http://dbpedia.org/property/image)"

Result submission

docker-compose up -d
export ENEXA_SHARED_DIRECTORY=./test-shared-dir/
export ENEXA_WRITEABLE_DIRECTORY=./test-shared-dir/"$(date +%s)"/
mkdir -p "$ENEXA_SHARED_DIRECTORY"
mkdir -p "$ENEXA_WRITEABLE_DIRECTORY"
export ENEXA_SERVICE_URL=http://127.0.0.1:36321/
export ENEXA_META_DATA_ENDPOINT=http://admin:[email protected]:47238/test
URI=$(./enexa-add-file test-result-file)

echo "PREFIX enexa: <http://w3id.org/dice-research/enexa/ontology#> SELECT ?o { <$URI> enexa:location ?o }" |./sparql-select "$ENEXA_META_DATA_ENDPOINT"
docker-compose down

Usage in modules

Docker

In Dockerfile:

FROM <your_application's_docker_image>
COPY --from=enexa-utils:1 / /.

In a module at runtime:

# retrieve parameters
echo $(enexa-parameter "http://example.org/input-parameter-1")
# do useful things
echo your_result >your_output_file
# save result files
enexa-add-file your_output_file "http://example.org/output-parameter-2"

The project documentation can be found [here](https://enexa.eu/documentation). For the repository-specific documentation, visit [this link](https://enexa.eu/documentation/enexa-utils.html).

Examples