Git Product home page Git Product logo

ld-compiler's Introduction

The linked-data compiler for the knowledge base project

This project contains a compiler API for triggering the compilation of a linked data knowledge base. The inputs are a url to a git repository containing markdown files. The outputs are an elastic search index and some static html resources (posted to a resource api).

This project is based on the ProjectScaffold F# template, uses FAKE for task management and Paket for packet management. Please see the project scaffold docs for more information about this setup.

Requirements

  • docker
  • docker-compose

Building and running unit tests

To build the project and run unit tests:

docker build .

Running integration tests

A transient environment is created using docker-compose with the files in the integration-tests folder. Integration tests are then run against this environment, which is destroyed after every run.

First you must build the docker image locally:

docker build -t nice/ld-compiler:dev .

Now run the following script:

cd integration-tests
sh run.sh

NOTE: Don't worry if you see the error message: "ERROR: Tag dev not found in repository docker.io/nice/ld-compiler". This error is expected and doesn't affect the ability to run the tests.

Building a knowledge base for debugging

There is a buildkb script that takes a git repo url and builds a knowledge base and leaves it up for inspecting/debugging. for example

./buildkb.sh https://github.com/nhsevidence/ld-dummy-content

Now you should be able to inspect the search index via:

curl localhost:9200/_search?pretty

and the resourceapi like so:

curl localhost:8082/resource/qs1/st1

Compilation/publication Process

The stages of transformation for each markdown file are as follows (src/compiler/Compile.fs):

  • Markdown parsed to in-memory type
  • Use pandoc to create static html file
  • Extract and resolve annotations
  • Converted to RDF
  • serialised to TTL and write to disk
  • added ttl file to graph db

The publication process which follows on from compilation (src/compiler/Publish.fs):

  • Find all statements in graph db
  • compress to json-ld
  • upload to elastic search
  • collect and POST all static html resources to resource api

ld-compiler's People

Contributors

jameskirk36 avatar sainsworth avatar dcmwong avatar mgallagher1980 avatar

Watchers

James Cloos avatar JamesLinus avatar  avatar

Forkers

forki

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.