Getting Started

REPL

The REPL is the simplest way to try things out. You can download it from here and then run it with:

java -jar idml-1.0.xxx.jar repl

It’ll give you a prompt asking for some input JSON, then ask for some IDML to run against it, for example:

json> {"a": "hello", "b": "world"}
....>
JSON accepted

idml> output = "%s %s".format(a, b)
....>
{
  "output" : "hello world"
}

Tool

The IDML tool is the alternative way to evaluate IDML on the command line, it’s contained in the same release as the repl from github releases.It is invoked on a command line with a set of mappings and will take line-delimited JSON on stdin and map it to stdout:

Usage

Ptolemy IDML command line tool.
Usage: idml apply [options] <file>...

  --help              Show usage information and flags
  --pretty <value>    Enable pretty printing of output
  --unmapped <value>  This probably doesn't do what you think it does
  <file>...           one or more mapping files to run the data through

Example

andi@andi-workstation examples > cat > input.json
{"a": "hello", "b": "world"}
{"a": "hello"}
{}
andi@andi-workstation examples > cat > mapping.idml
output = "%s %s".format(a, b)
andi@andi-workstation examples > java -jar idml.jar apply mapping.idml < input.json
{"output":"hello world"}
{}
{}