Skip to content

The object store for saving/retrieving knowledge objects.

License

Notifications You must be signed in to change notification settings

kgrid/kgrid-shelf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KGrid Shelf

CircleCI GitHub release License: GPL v3

KGrid Shelf - (access, acquisition) view Knowledge Objects (and sets of Knowledge Objects ) & their components; deposit & remove published versions of Knowledge Objects; copy versions of Knowledge Objects s between Libraries & Activators (Knowledge Objects are immutable).

KGrid Shelf has two modules, the shelf api and gateway component. The api is used by other KGrid components to provide access to the KOs while the gateway wraps the api in a simple spring boot application for easy RESTFul access to the shelf api for testing and development.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

For building and running the application you need:

Clone

To get started you can simply clone this repository using git:

git clone https://github.com/kgrid/kgrid-shelf.git
cd kgrid-shelf

Quick start

This quick start will run the activator and load two example knowledge objects for testing.
This example will load a sample KO shelf (where to look for the KOs) via the kgrid.shelf.cdostore.url property.

Note: this property must be a valid URI.

By default, application will start up on PORT 8080.

mvn clean package
java -jar target/kgrid-shelf*.jar --kgrid.shelf.cdostore.url=filesystem:file://shelf

Once Running access the Activators Health Endpoint. All statuses reported should be UP

{
  "status": "UP",
  "shelf": {
    "status": "UP",
    "kgrid.shelf.cdostore.url": "filesystem:file://shelf/"
  },
  "diskSpace": {
    "status": "UP",
    "total": 499963170816,
    "free": 421147205632,
    "threshold": 10485760
  }
}
   

Unit tests

  • Unit tests can be executed via maven:

    mvn clean test
    
  • There is also

Importing Knowledge Objects with manifests

There are two methods by which knowledge objects can be imported to the shelf:

1. Define one or more manifest.json files which point to each Knowledge Object's location.

Currently, knowledge objects can be loaded from a url, a local file, or a classpath reference.

Example manifest.json file:
    {
        "manifest":
          [
            "http://path-to-web-ko",
            "file:/path-to-local-ko",
            "classpath:/path-to-classpath-ko"
          ]
    }

When running the shelf, an array of manifest files can be automatically imported by setting the property: kgrid.shelf.manifest.

Example:

  kgrid.shelf.manifest=file:/path/to/manifest,http://path-to-manifest,classpath:/path-to-manifest

2. Pass a single manifest to the create manifest endpoint

The Shelf-API has an endpoint for importing a single manifest. To use it, simple send a POST request to /kos/manifest/ endpoint of your shelf with the contents of the manifest.json file as the request body. See the API documentation for more information.