# KGrid Activator

# Running the Activator

Download the latest activator jar from GitHub Latest Activator Release.

  1. Create a activator directory
  2. Create a directory named shelf in the new activator directory
  3. Download kgrid-activator-#.#.#.jar
  4. Place the kgrid-activator-#.#.#.jar into the activator
  5. Download hello-world.zip
  6. Place the hello-world.zip into the activator/shelf directory and unzip. This will place the KOs into the shelf directory

Directory structure should look similar to the following

 ├── activator   
 │  └──  shelf
 │     └── hello-world  
 │          ├── metadata.json
 │            ├── v0.1.0
 │            │   ├── metadata.json
 │            │   ├── service.yaml
 │            │   └── src
 │            │       └── index.js
 │            ├── v0.2.0
 │            │   ├── dist
 │            │   │   └── main.js
 │            │   ├── metadata.json
 │            │   └── service.yaml
 │            └── v0.3.0
 │                ├── dist
 │                │   └── main.js
 │                ├── metadata.json
 │                └── service.yaml
 └── kgrid-activator-#.#.#.jar

The activator is executable jar and can be run from the command line. Open a terminal window and navigate to the direcoty where the jar and shelf are located.

Type in the following.

 java -jar kgrid-activator-#.#.#.jar

By default the activator will run on port 8080. You can validate the activator is up and running using the activators health endpoint. The health of the Activator should display a status of UP.

   "status": "UP",
   "shelf": {
      "status": "UP",
      "kgrid.shelf.cdostore.url": "shelf"
   "activationService": {
      "status": "UP",
      "Knowledge Objects found": 1,
      "Adapters loaded": [
   "EndPoints loaded": [
   "diskSpace": {
      "status": "UP",
      "total": 499963170816,
      "free": 415911948288,
      "threshold": 10485760

The Hello World is a very simple KO with a Javascript based service that takes in a name and displays a Welcome to the Knowledge Grid message.

First lets look at the Hello World's metadata. Hello World

The Hello World KO has one service called welcome. The welcome service expects you to pass it a name as a json object, for example {"name":"Fred Flintstone"}. The following is a curl POST to the Hello World welcome.

curl -X POST -H "Content-Type:application/json"  \
    -d "{\"name\": \"Fred Flintstone\"}" \

The Hello World KO will return the following

  "result" : "Welcome to Knowledge Grid, Fred Flintstone",
  "info" : {
    "ko" : {
      "@id" : "hello-world",
      "@type" : "koio:KnowledgeObject",
      "identifier" : "ark:/hello/world",
      "title" : "Implementation koio v1 of Hello World",
      "hasServiceSpecification" : "service.yaml",
      "hasPayload" : "welcome.js",
      "@context" : [ "http://kgrid.org/koio/contexts/knowledgeobject.jsonld" ]
    "inputs" : {
      "name" : "Fred Flintstone"

# Configuration

There are several settings that you can control on the Activator.

Activator Knowledge Object Shelf Location

By default the activator will look for a shelf in jar execution directory but the location the shelf can be configured:

java -jar kgrid-activator-1.1.2.jar --kgrid.shelf.cdostore.url=filesystem:file:///data/myshelf

java -jar kgrid-activator-1.1.2.jar --kgrid.shelf.cdostore.url=filesystem:file:///c:/Users/me/myshelf

Activator Cross-Origin Resource Sharing (CORS) The Activator by default allows all origins access to the api. You can tighten that access via the cors.url parameter.

To change the origins allowed:

java -jar kgrid-activator-1.1.2.jar --cors.url=https://myservice.com

Activator Server Port

To change the port:

java -jar kgrid-activator-1.1.2.jar --server.port=9090

Activator Server Path

By default the endpoints of the activator at the root of the activator server. To change the server root path:

java -jar kgrid-activator-1.1.2.jar --server.contextPath=/activator

Activator Object Auto-Reload

By default the activator does not automatically reload objects but it can be configured to activate an object when it detects a change to a file on the shelf by setting this property:

java -jar kgrid-activator-1.1.2.jar --kgrid.activator.autoreload=true

Last Updated: 11/25/2019, 6:20:00 PM