GFEAR-CLI

GFEAR-CLI has been provided as a proof of concept for the GFEAR language and its ability to compile .gfear scripts and execute those scripts over a directory.

Download FEAR-CLI

A download to the FEAR-CLI is provided here.

Once downloaded, extract the archive to a new folder.

The archive comes with a number of examples that can be used to experiment with. Alternatively, you can write your own scripts, see the section on GFEAR Scripts for more information.

The archive also comes with some sample data in the Artefacts directory. CSV and JSON files in this directory will be used as a datasource, see Handling Data for more information.

Finally, see the section Running FEAR-CLI on how to run the fear-cli program from the command line and a list of arguments that can be used with the program.

Installation Requirements for .NET

When executing fear.cli.exe it will provide links if any runtime environments are missing, or you can use the links below.

Microsoft .NET Framework 8.0 Runtime

Microsoft Windows Desktop App Framework 8.0

GFEAR Scripts

If you plan on writing your own GFEAR scripts, these can be placed inside a directory of the default Source/GFEAR/ directory, next to existing scripts. Scripts are used based on the fields of datasources, meaning that there is no need to remove existing GFEAR sample scripts if the fields in your data do not overlap the sample scripts.

Also be aware that, for demonstration purposes, a compiled copy of scripts is supplied in the PreCompiled directory. You may want to remove the contents of this directory as well if you do not want to experiment with the sample data and scripts.

Handling Data

By default, JSON datas in the Artefact directory is loaded and processed. These files are identified by the file having a file extension of .json. At present, you can specify to load data via CSV using the –input-format argument, see Options for more details on the usage. XML is not currently supported, but is under development.

Mapping Data to Scripts

There are 2 methods that can be used to map data to a gfear script, field mapping, and type mapping.

  • Field Mapping: examines the fields of your data supplied in the Artefacts directory and matches against the most appropriate gfear script(s). The threshold for this is to match an aribtrary 70% of fields in the accepts statement of the gfear script.
  • Type Mapping: allows for you data to be annotated with a field of TypeName. If this field is present, it will be used to determine the gfear script based on the name of the codifier as specified in the define codifier statement, see Defining a Graph-Codifier.

The Ontologies Directory

The FEAR.CLI application will load any ontologies that are in RDF format within the ontologies directory.

The purpose of loading ontologies is to allow shorter expressions of properties where-by the property type can be omitted, and derived by referring to the rdf:range of the property defined within the ontology.

Running FEAR-CLI

If you have placed your scripts and data in the default directories, you can simply run the FEAR-CLI program directly from a command line.

FEAR.CLI.exe

The result of executing the scripts will be displayed on the console with the default format being Turtle. By default, you will also see a visualization of the graph displayed as well.

Command Line Options

The FEAR-CLI has a multitude of command line options that can be set. Many of these command line options can also be set in the configuration file.

Usage:

FEAR.CLI [options]

Options:

The following table outlines the command-line options that can be used with the fear.cli.exe program

Command Argument Description Configuration File
-sd, --script-directory <script-directory> Directory of scripts to be executed [default: Source/GFEAR/]  
-c, --configuration-file <configuration-file> Configuration file [default: configuration.json]  
-pd, --precompiled-directory <precompiled-directory> Directory of precompiled scripts to be executed [default: PreCompiled/GFEAR/]  
-ad, --artifacts-directory <artifacts-directory> Directory of artifacts of data to be processed. If you specify a full file path, that file will be used. [default: artifacts] “ArtifactsDirectory”
-sc, --source-compilation <Both|CompileScripts|Precompiled> Source compilation (Source or PreCompiled) [default: CompileScripts]  
-if, --input-format <input-format> Data format (CSV, JSON, or XML) [default: JSON]  
-sf, --serialisation-format, --serialization-format <serialization-format> Output format (TTl, JSON-LD, or XML) [default: TTL]  
-of, --output-file <output-file> Output file name [default: graph.ttl]  
-co, --console-output Display the serialized RDF representation of the graph on the console. “ConsoleOutput”
-ns, --namespace <namespace> Namespace of the graph [default: http://fear.graph/]  
-na, --namespace-abbreviation <namespace-abbreviation> Namespace abbreviation of the graph [default: fear]  
-tm, --type-matching <PropertyFallback|Strict> Strict type matching [default: PropertyFallback]  
-dt, --display-transpile <display-transpile> Display the transpiled C# code for a given Script file (.gfear extension is not required) “DisplayTranspiled”
-v, --visualise, --visualize Display a window for visualizing the graph using the MSAGL library. “Visualize”, “Visualization”, “Visualise”, “Visualisation”
-s, --statistics Display statistics of the generated graph at the end of execution. “Statistics”
--accept-experimental-terms Accepts the experimental terms of the FEAR.CLI.exe program being supplied for evaluation purposes.  

Configuring a Remote Graph

The FEAR-CLI has been tested with Apache Jena as a Fuseki endpoint. To use an existing remote graph, the Connections section of the configuration file can be used.

An example Connections configuration section is supplied below:

"Connections": {
  "GraphDBConnection": {
    "Authentication": true,
     "Endpoint": "http://localhost:3030/temp/data",
     "Username": "test_user",
     "Password": "user_Passw0rd!"
  }
}