Knowledge Grid Knowledge Objects for development with the Landis-Lewis Lab.
- Knowledge Grid Activator is running locally on port 8080.
- Ruby 2.4.1
- Gem dependencies installed
bundle install
- Build docker image
docker build -f activator.dockerfile -t kgrid-activator-1.0.1
- Create/Run docker container
docker create --name kga -p 8080:8080 kgrid-activator-1.0.1
- Start and test docker container
docker start kga curl localhost:8080/hello/world
Build all the knowledge objects
rake kobble
Load the count-spek knowledge object into the activator
rake activate['count-spek']
or
curl -X PUT localhost:8080/count/spek --form ko=@build/count-spek.zip
Test the hello-js knowledge object is loaded.
rake test['count-spek']
or
curl localhost:8080/count/spek
- Make directory under src/
- Write metadata.yml
- Write payload
- Run rake task to build all knowledge objects
rake kobble
The options for putting a knowledge object into an activator are:
- PUT request to running Activator
- Add to shelf directory of Activator before starting it.
- Add to Knowledge Grid Library
Example using a locally running activator and the kobbled hello-js knowledge object in the build/ directory.
curl -X PUT \
http://localhost:8080/shelf/ark:/kobble/hello-js \
-H 'accept-encoding: text/plain' \
-H 'content-type: application/json' \
--data @build/hello-js.json
OR
rake activate['hello-js']
The response should be:
Object ark:/kobble/hello-js added to the shelf
POST input data to activator with the kobject loaded
curl --request POST \
--url http://localhost:8080/knowledgeObject/ark:/kobble/hello-js/result \
--header 'content-type: application/json' \
--header 'accept: application/json' \
--data '{"name": "Alice"}'
OR
rake test['hello-js']
The result should be
{
"result": "Hello, Alice",
"source": "http://n2t.net//ark:/kobble/hello-js",
"metadata": {
"arkId": {
"arkId": "ark:/kobble/hello-js"
}
}
}