Skip to content
/ ld-cli Public

A command-line utility for processing JSON-LD, RDF, RDFC, JCS, and CBOR-LD, with native executables for Ubuntu, macOS, and Windows - completely free of JVM dependencies or runtime overhead.

License

Notifications You must be signed in to change notification settings

filip26/ld-cli

Repository files navigation

Linked Data CLI

A simple command-line utility designed to process JSON-LD, RDF, and CBOR-LD documents. Built with GraalVM, ld-cli delivers native executables for Ubuntu, macOS, and Windows - eliminating JVM dependencies and runtime overhead.

It's ideal for batch workflows, automated validation, canonicalization, and serialization of linked data resources in knowledge graphs, decentralized identifiers (DIDs), and semantic web applications.

Features

Status

Snap Status Downloads GitHub release (latest by date including pre-releases)

Installation

📦 Install via Snap

You can install this app easily on any Linux distribution that supports Snaps.

sudo snap install ld-cli

📁 Manual Download

Download the latest release from the GitHub Releases page.

After downloading, extract the archive and make the binary executable:

unzip ld-cli-....zip
chmod +x ld-cli

Usage

> ld-cli -h
Usage: ld-cli [-hv] [COMMAND]

Linked Data Command Line Processor

Options:
  -h, --help      display help message
  -v, --version   display a version

Commands:
  expand      Expand JSON-LD document
  compact     Compact JSON-LD document using the context
  flatten     Flatten JSON-LD document and optionally compact using a context
  frame       Frame JSON-LD document using the frame
  fromrdf     Transform N-Quads document into a JSON-LD document in an expanded form
  tordf       Transform JSON-LD document into N-Quads document
  compress    Compress JSON-LD document into CBOR-LD  
  decompress  Decompress CBOR-LD document into JSON-LD
  rdfc        Canonize an RDF N-Quads document with RDFC-1.0
  jcs         Canonize a JSON document using the JSON Canonicalization Scheme (JCS)

> ld-cli expand -h
Usage: ld-cli expand [-op] [-b=<base>] [-c=<context>] [-i=<input>] [-m=1.0|1.1]

Expand JSON-LD document

Options:
  -b, --base=<base>         input document base IRI
  -c, --context=<context>   context IRI
  -i, --input=<input>       input document IRI
  -m, --mode=1.0|1.1        processing mode
  -o, --ordered             certain algorithm processing steps are ordered
                              lexicographically
  -p, --pretty              pretty print output JSON

Pipeline

cat document.json | ld-cli expand --ordered --pretty > expanded.jsonld

https:// scheme support

ld-cli rdfc -i https://raw.githubusercontent.com/filip26/titanium-rdf-canon/refs/heads/main/src/test/resources/com/apicatalog/rdf/canon/rdfc10/test022-in.nq 

file:/ scheme support

ld-cli compress -i file:/home/filip/example.jsonld

Custom CBOR-LD dictionaries

ld-cli decompress --pretty --dictionary=./utopia-barcodes-dictionary-example.json <<< 'd90664a60183198000198001198002189d82187618a418b8a3189c18a618ce18b218d01ae592208118baa2189c18a018a8447582002018be18aa18c0a5189c186c18d60418e018e618e258417ab7c2e56b49e2cce62184ce26818e15a8b173164401b5d3bb93ffd6d2b5eb8f6ac0971502ae3dd49d17ec66528164034c912685b8111bc04cdc9ec13dbadd91cc18e418ac'

Contributing

All PR's welcome!

Building

  1. Install GraalVM and Native Image
    • download and unpack graalvm-jdk-....tar.gz
    • set JAVA_HOME and PATH env variables
  2. mvn clean package -Pnative
  3. ./target/ld-cli

Resources

Sponsors

Commercial Support

Commercial support is available at filip26@gmail.com

About

A command-line utility for processing JSON-LD, RDF, RDFC, JCS, and CBOR-LD, with native executables for Ubuntu, macOS, and Windows - completely free of JVM dependencies or runtime overhead.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages