|
| 1 | +************************************************************************** |
| 2 | +** title: Tools |
| 3 | +** author: Brian Frank |
| 4 | +** created: 10 Sep 2021 |
| 5 | +** copyright: Copyright (c) 2021, Project-Haystack |
| 6 | +************************************************************************** |
| 7 | + |
| 8 | +Overview [#overview] |
| 9 | +******************** |
| 10 | +This chapter provides guidance to for open source tools available for |
| 11 | +to work with Project Haystack data. |
| 12 | + |
| 13 | +Build from Source [#build] |
| 14 | +************************** |
| 15 | +To compile the ontology from source into HTML, Json, Turtle, etc follow |
| 16 | +these steps: |
| 17 | + |
| 18 | +1. Checkout source from [GitHub]`#github` |
| 19 | + |
| 20 | +2. Install [Haxall]`#haxall` |
| 21 | + |
| 22 | +3. Run the [defc]`#defc` command line tool to compile the defs |
| 23 | + |
| 24 | +GitHub [#github] |
| 25 | +**************** |
| 26 | +All Haystack source material is managed on [GitHub]`https://github.com/Project-Haystack/haystack-defs`. |
| 27 | + |
| 28 | +If you have [git]`https://git-scm.com/` installed on your machine, you |
| 29 | +can clone the Haystack repo to your local machine with this command: |
| 30 | + |
| 31 | + git clone https://github.com/Project-Haystack/haystack-defs.git |
| 32 | + |
| 33 | +This will create a 'haystack-defs/' directory under your current working |
| 34 | +directory. |
| 35 | + |
| 36 | +Haxall [#haxall] |
| 37 | +**************** |
| 38 | +[Haxall]`https://haxall.io` is an open source framework which includes the |
| 39 | +reference implementation used to generate the documentation and downloads |
| 40 | +found on `https://project-haystack.org/`. It provides several features for |
| 41 | +working with Project-Haystack data: |
| 42 | + - 'defc' command line tool to compile the ontology from source |
| 43 | + - 'hx convert' command line to convert between the different |
| 44 | + [file types]`Filetypes` |
| 45 | + - Haxall daemon which provides a full runtime to load and explore |
| 46 | + haystack data using a functional scripting langauge |
| 47 | + |
| 48 | +Haxall requires a Java VM to run. So you will need Java installed on your |
| 49 | +machine as a prerequisite. To install Haxall download the latest release |
| 50 | +from [GitHub]`https://github.com/haxall/haxall/releases`. Releases are |
| 51 | +packaged as a zip file you can unzip to your machine. Once installed |
| 52 | +you can test using the "bin/hx" Bash script or "bin/hx.bat" Window's batch file |
| 53 | +as follows: |
| 54 | + |
| 55 | + > bin/hx version |
| 56 | + |
| 57 | +Defc [#defc] |
| 58 | +************ |
| 59 | +The 'defc' command line tool is used to compile the ontology from source. |
| 60 | +It compiles the source [Trio]`Trio` files one or more of the following |
| 61 | +output files: |
| 62 | + - html: generate the HTML documentation as found on the website |
| 63 | + - csv: output defs as a [CSV]`Csv` file |
| 64 | + - zinc: output defs as a [Zinc]`Zinc` file |
| 65 | + - trio: output ontology as a [Trio]`Trio` file |
| 66 | + - json: output ontology as a [Json]`Json` file |
| 67 | + - turtle: output ontology as a [RDF Turtle]`Rdf` file |
| 68 | + |
| 69 | +To use defc, first install [haxall]`#haxall` and verify its installed as follows |
| 70 | + |
| 71 | + bin/fan defc -version |
| 72 | + |
| 73 | +Run this command to print out command line syntax and examples: |
| 74 | + |
| 75 | + bin/fan defc -? |
| 76 | + |
| 77 | +If you have cloned the haystack git repo, then you can compile it as follows |
| 78 | + |
| 79 | + // compile ontology to HTML docs |
| 80 | + bin/fan defc haystack-defs/src |
| 81 | + |
| 82 | + // compile ontology to JSON |
| 83 | + bin/fan defc -output json haystack-defs/src |
| 84 | + |
| 85 | + // compile ontology to Turtle |
| 86 | + bin/fan defc -output turtle haystack-defs/src |
| 87 | + |
| 88 | + // compile ontology to JSON and Turtle |
| 89 | + bin/fan defc -output json,turtle haystack-defs/src |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | + |
| 96 | + |
0 commit comments