Skip to main content

Schema Annotations for Linked Avro Data (SALAD)

Project description

Build Status Build status

Schema Salad

Salad is a schema language for describing JSON or YAML structured linked data documents. Salad schema describes rules for preprocessing, structural validation, and hyperlink checking for documents described by a Salad schema. Salad supports rich data modeling with inheritance, template specialization, object identifiers, object references, documentation generation, code generation, and transformation to RDF. Salad provides a bridge between document and record oriented data modeling and the Semantic Web.

Usage

$ pip install schema_salad

To install from source:

git clone https://github.com/common-workflow-language/schema_salad
cd schema_salad
python setup.py install

Commands

Schema salad can be used as a command line tool or imported as a Python module:

$ schema-salad-tool
usage: schema-salad-tool [-h] [--rdf-serializer RDF_SERIALIZER]
                      [--print-jsonld-context | --print-rdfs | --print-avro | --print-rdf | --print-pre | --print-index | --print-metadata | --print-inheritance-dot | --print-fieldrefs-dot | --codegen language | --print-oneline]
                      [--strict | --non-strict] [--verbose | --quiet | --debug] [--version]
                      [schema] [document]

$ python
>>> import schema_salad

Validate a schema:

$ schema-salad-tool myschema.yml

Validate a document using a schema:

$ schema-salad-tool myschema.yml mydocument.yml

Get JSON-LD context:

$ schema-salad-tool --print-jsonld-context myschema.yml mydocument.yml

Convert a document to JSON-LD:

$ schema-salad-tool --print-pre myschema.yml mydocument.yml > mydocument.jsonld

Generate Python classes for loading/generating documents described by the schema:

$ schema-salad-tool --codegen=python myschema.yml > myschema.py

Display inheritance relationship between classes as a graphviz ‘dot’ file and render as SVG:

$ schema-salad-tool --print-inheritance-dot myschema.yml | dot -Tsvg > myschema.svg

Documentation

See the specification and the metaschema (salad schema for itself). For an example application of Schema Salad see the Common Workflow Language.

Rationale

The JSON data model is an popular way to represent structured data. It is attractive because of it’s relative simplicity and is a natural fit with the standard types of many programming languages. However, this simplicity comes at the cost that basic JSON lacks expressive features useful for working with complex data structures and document formats, such as schemas, object references, and namespaces.

JSON-LD is a W3C standard providing a way to describe how to interpret a JSON document as Linked Data by means of a “context”. JSON-LD provides a powerful solution for representing object references and namespaces in JSON based on standard web URIs, but is not itself a schema language. Without a schema providing a well defined structure, it is difficult to process an arbitrary JSON-LD document as idiomatic JSON because there are many ways to express the same data that are logically equivalent but structurally distinct.

Several schema languages exist for describing and validating JSON data, such as JSON Schema and Apache Avro data serialization system, however none understand linked data. As a result, to fully take advantage of JSON-LD to build the next generation of linked data applications, one must maintain separate JSON schema, JSON-LD context, RDF schema, and human documentation, despite significant overlap of content and obvious need for these documents to stay synchronized.

Schema Salad is designed to address this gap. It provides a schema language and processing rules for describing structured JSON content permitting URI resolution and strict document validation. The schema language supports linked data through annotations that describe the linked data interpretation of the content, enables generation of JSON-LD context and RDF schema, and production of RDF triples by applying the JSON-LD context. The schema language also provides for robust support of inline documentation.

Project details


Release history Release notifications

This version
History Node

2.7.20180719125426

History Node

2.7.20180717111941

History Node

2.7.20180611133406

History Node

2.7.20180514132321

History Node

2.7.20180514111532

History Node

2.7.20180501211602

History Node

2.7.20180322174040

History Node

2.7.20180302220026

History Node

2.6.20180214144209

History Node

2.6.20171201034858

History Node

2.6.20171116190026

History Node

2.6.20171102064032

History Node

2.6.20171101113912

History Node

2.6.20171031091636

History Node

2.6.20170927145003

History Node

2.6.20170806163416

History Node

2.6.20170712194300

History Node

2.6.20170630075932

History Node

2.6.20170628130600

History Node

2.5.20170623152720

History Node

2.5.20170428142041

History Node

2.5.20170328195758

History Node

2.5.20170327140858

History Node

2.5.1.20170628121527

History Node

2.4.20170308171942

History Node

2.3.20170302225134

History Node

2.3.20170302150835

History Node

2.2.20170222151604

History Node

2.2.20170216125639

History Node

2.2.20170208112505

History Node

2.2.20170126160727

History Node

2.2.20170119151016

History Node

2.2.20170111180227

History Node

2.1.20161227191302

History Node

2.1.20161223160831

History Node

2.1.20161221160224

History Node

2.1.20161216210732

History Node

2.0.20161122040508

History Node

1.21.20161215163938

History Node

1.21.20161206204028

History Node

1.21.20161206181442

History Node

1.21.20161202201331

History Node

1.20.20161122192122

History Node

1.18.20161005190847

History Node

1.18.20160930145650

History Node

1.18.20160907135919

History Node

1.17.20160820171034

History Node

1.17.20160820165726

History Node

1.16.20160819133325

History Node

1.16.20160810195039

History Node

1.15.20160810152809

History Node

1.14.20160708181155

History Node

1.14.20160707164023

History Node

1.13.20160702001514

History Node

1.13.20160630144631

History Node

1.12.20160610104117

History Node

1.12.20160610092802

History Node

1.11.20160524152859

History Node

1.11.20160506154702

History Node

1.10.20160505185111

History Node

1.10.20160505184637

History Node

1.9.20160421133216

History Node

1.7.20160316203940

History Node

1.7.20160316150109

History Node

1.7.20160316145902

History Node

1.7.20160315232142

History Node

1.7

History Node

1.6.20160202222448

History Node

1.5.20160126213649

History Node

1.5.20160126190004

History Node

1.5.20160126150511

History Node

1.4.20160108200836

History Node

1.4.20160108152457

History Node

1.3.20160108151816

History Node

1.2.20151210153655

History Node

1.1.1

History Node

1.1.0

History Node

1.0.6

History Node

1.0.5

History Node

1.0.4

History Node

1.0.3

History Node

1.0.2

History Node

1.0.1

History Node

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
schema_salad-2.7.20180719125426-py2.py3-none-any.whl (382.1 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Jul 19, 2018
schema-salad-2.7.20180719125426.tar.gz (350.1 kB) Copy SHA256 hash SHA256 Source None Jul 19, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page