lib_usage.md 1.75 KB
Newer Older
Bruno Guillaume's avatar
Bruno Guillaume committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
+++
Categories = ["Development","GoLang"]
Tags = ["Development","golang"]
Description = ""
date = "2018-03-13T16:40:34+01:00"
title = "lib_usage"
menu = "main"

+++

# Example of library usage with several GRS applied sequentially.
The graph representation has changed in version 0.47 and now each graph is aware of its relative domain.
The usage of the library is simpler (see the old version for comparison).

In the code below, 3 different GRS are loaded (you will need to adapt full path to your local install):

 * `pos_to_ssq`
 * `ssq_to_dsq`
 * `dsq_to_deep`

The file with the code below: `lib_usage.ml` ([Download](/lib_usage/lib_usage.ml)) can be compiled with the command:

`ocamlbuild -use-ocamlfind -pkgs 'libgrew, libgrew, conll, yojson, log, containers, str, ANSITerminal' lib_usage.native`

```ocaml
Bruno Guillaume's avatar
Bruno Guillaume committed
26
{{< input file="static/lib_usage/lib_usage.ml" >}}
Bruno Guillaume's avatar
Bruno Guillaume committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
```



# Obsolete: Example of version 0.46 library usage with several GRS applied sequentially.

Example with version 0.46 of the library.

:warning: A graph is defined relatively to a particular domain and using it with the wrong domain may produced unwanted effects and erroneous graphs.

In the code below, 3 different GRS are loaded (you will need to adapt full path to your local install):
 * `pos_to_ssq`
 * `ssq_to_dsq`
 * `dsq_to_deep`


The output of the first GRS `graph1__pos_to_ssq` is defined relatively to the domain of the same GRS `pos_to_ssq`.
To be used as the input of the GRS `ssq_to_dsq`, it must be converted to the domain of the new GRS `ssq_to_dsq`.
The converted version of `graph1` is `graph1__ssq_to_dsq`.

Again, the output of `ssq_to_dsq` must be converted before being used as an input to the next GRS `dsq_to_deep` (see below).

```ocaml
Bruno Guillaume's avatar
Bruno Guillaume committed
50
{{< input file="static/lib_usage/lib_usage_0.46.ml" >}}
Bruno Guillaume's avatar
Bruno Guillaume committed
51 52
```