Skip to content

Repository files navigation

TypeAPI

Java Spring Boot Type Sense

Table of Contents

Introduction

The DTR Toolkit is a framework designed to work with Data Type Registries (DTRs). It provides functionalities for extracting, validating, and managing types, units, and taxonomies from various DTR sources.

Features

  • Type Extraction: Extract types from DTRs of different providers.
  • Validation: Generate schemas for different types describing schema elements and validate data.
  • Taxonomy Management: Manage and retrieve taxonomies.
  • Unit Handling: Extract and manage unit entities.
  • RESTful API: Provides a RESTful API for interaction.

Installation

Prerequisites

  • Java 11 or higher
  • Gradle 6.8 or higher
  • A TypeSense 25.1 instance or higher

Steps

  1. Clone the repository:
    git clone https://github.com/yourusername/dtr-toolkit.git
    cd dtr-toolkit
  2. Start a TypeSense server. The TypeAPI requires a TypeSense server running to store types, units and taxonomies and provide fast search capabilities. The easiest way to set this up is via docker.
  -p 8108:8108 \
  -v /path/to/data:/data \
  typesense/typesense:latest \
  --data-dir /data \
  --api-key xyz \
  --listen-port 8108

These are the default settings for port and key. If you wish to choose your own you need to adjust the src/main/resources/application.propertiesfile:

typesense.url=localhost
typesense.port=8108
typesense.key=xyz
  1. Build and run the project:
./gradlew buildRun

Via Docker Compose

You can also simply use the provided docker-compose.yml file to run the service and a typesense instance. The docker image for the TypeAPI is stored in the GitHub Container Registry: ghcr.io/fc4e-t4-3/dtr-toolkit:latest. So if you want a simple setup, just run docker-compose upin the same folder as the docker-compose.yml to start the containers.

The compose file requires two environment variables to be set, an ${ENV} variable, either default or prod, for setting the logging level. Also, a ${TYPESENSE_KEY}" needs to be set, both for initialzing the Typesense container, and for allowing the application access to it. These can be set using an .env file in the same folder as the compose file.

Usage

Once the application is running, you can access the Swagger UI at http://localhost:8080.

Configuration

The Data Type Registries that are imported are defined insrc/main/config/config.toml, for example:

url="http://typeregistry.lab.pidconsortium.net/"
suffix="objects?query=*"
style="eosc"
types=["BasicInfoType","InfoType","KernelInformationProfile"]
units=["MeasurementUnit"]
taxonomy=["TaxonomyNode"]
general=["ExtendedMimeType"]

Where the styledescribes the underlying schema definitions, types contains the names of the schema element types, units the name of the measurement units, taxonomy the name of the TaxonomyNode schema and under general other types can be imported that don't fit other categories.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages