https://github.com/common-workflow-language/schema_salad

Semantic Annotations for Linked Avro Data

https://github.com/common-workflow-language/schema_salad

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    7 of 43 committers (16.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.0%) to scientific vocabulary

Keywords from Contributors

cwl common-workflow-language workflows sciworkflows commonwl bioinformatics genomics workflow-engine sequences wdl
Last synced: 10 months ago · JSON representation

Repository

Semantic Annotations for Linked Avro Data

Basic Info
Statistics
  • Stars: 81
  • Watchers: 32
  • Forks: 63
  • Open Issues: 87
  • Releases: 105
Created almost 11 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License

README.rst

|Linux Build Status| |Code coverage| |Documentation Status| |CII Best Practices|

.. |Linux Build Status| image:: https://github.com/common-workflow-language/schema_salad/actions/workflows/ci-tests.yml/badge.svg?branch=main
   :target: https://github.com/common-workflow-language/schema_salad/actions/workflows/ci-tests.yml
.. |Code coverage| image:: https://codecov.io/gh/common-workflow-language/schema_salad/branch/main/graph/badge.svg
   :target: https://codecov.io/gh/common-workflow-language/schema_salad
.. |Documentation Status| image:: https://readthedocs.org/projects/schema-salad/badge/?version=latest
   :target: https://schema-salad.readthedocs.io/en/latest/?badge=latest
   :alt: Documentation Status
.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/1867/badge
   :target: https://bestpractices.coreinfrastructure.org/projects/1867

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.

The Schema Salad library is Python 3.9+ only.

Installation
------------

::

   pip3 install schema_salad

If you intend to use the `schema-salad-tool --codegen=python` feature, please
include the `[pycodegen]` extra::

   pip3 install schema_salad[pycodegen]

To install from source::

   git clone https://github.com/common-workflow-language/schema_salad
   cd schema_salad
   pip3 install .
   # or pip3 install .[pycodegen] if needed

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] [--skip-schemas]
                         [--strict-foreign-properties] [--print-jsonld-context]
                         [--print-rdfs] [--print-avro] [--print-rdf] [--print-pre]
                         [--print-index] [--print-metadata] [--print-inheritance-dot]
                         [--print-fieldrefs-dot] [--codegen language] [--codegen-target CODEGEN_TARGET]
                         [--codegen-examples directory] [--codegen-package dotted.package]
                         [--codegen-copyright copyright_string] [--print-oneline]
                         [--print-doc] [--strict | --non-strict]
                         [--verbose | --quiet | --debug] [--only ONLY] [--redirect REDIRECT]
                         [--brand BRAND] [--brandlink BRANDLINK] [--brandstyle BRANDSTYLE]
                         [--brandinverse] [--primtype PRIMTYPE] [--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

Generate HTML documentation::

   $ schema-salad-tool --print-doc myschema.yml > myschema.html
   $ # or
   $ schema-salad-doc myschema.yml > myschema.html

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
(Requires the `[pycodegen]` extra)::

   $ 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

Codegen Examples
----------------

The examples in the tables below are helpful to see how to use the output of `schema-salad-tool --codegen`
in different languages for loading and/or creating/editing/saving objects.

First set of examples is using the `CWL v1.2 schema `_:

+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Language    | Repository                                              | Serialization Example                                                                                                                                 | Deserialization Example                                                                                                                                                   |
+=============+=========================================================+======================================================================================================================================================+============================================================================================================================================================================+
| Python      | https://github.com/common-workflow-language/cwl-utils/  | `create_cwl_from_objects.py `_                           | `load_document() `_                                                      |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Java        | https://github.com/common-workflow-language/cwljava/    | (Not yet implemented)                                                                                                                                | `PackedWorkflowClassTest.java `_  |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| TypeScript  | https://github.com/common-workflow-lab/cwl-ts-auto      | `Creating, editing, and saving CWL docs with TypeScript `_ | `Loading CWL documents with TypeScript `_                                                            |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| .Net        | https://github.com/common-workflow-lab/CWLDotNet        | `Creating, editing, and saving CWL docs with .Net `_    | `Loading CWL documents with .Net `_                                                                    |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| C++         | https://github.com/common-workflow-lab/cwl-cpp-auto     | `cwl_output_example.cpp `_                                     | `cwl_input_example.cpp `_                                                             |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| D           | https://github.com/common-workflow-lab/cwl-d-auto       | `How to use `_                                                                         | `How to use `_                                                                                               |
+-------------+---------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Second set of examples is for the `Galaxy Workflow Format 2 `_ schema:

+-------------+------------------------------------------------------------------------------------+
| Language    | Path                                                                               |
+=============+====================================================================================+
| Python      | https://github.com/galaxyproject/gxformat2/blob/master/gxformat2/schema/v19_09.py  |
+-------------+------------------------------------------------------------------------------------+
| Java        | https://github.com/galaxyproject/gxformat2/tree/master/java                        |
+-------------+------------------------------------------------------------------------------------+
| TypeScript  | https://github.com/galaxyproject/gxformat2/tree/master/typescript                  |
+-------------+------------------------------------------------------------------------------------+

Quick Start
-----------

Let's say you have a 'basket' record that can contain items measured either by
weight or by count.  Here's an example::

   basket:
     - product: bananas
       price: 0.39
       per: pound
       weight: 1
     - product: cucumbers
       price: 0.79
       per: item
       count: 3

We want to validate that all the expected fields are present, the
measurement is known, and that "count" cannot be a fractional value.
Here is an example schema to do that::

   - name: Product
     doc: |
       The base type for a product.  This is an abstract type, so it
       can't be used directly, but can be used to define other types.
     type: record
     abstract: true
     fields:
       product: string
       price: float

   - name: ByWeight
     doc: |
       A product, sold by weight.  Products may be sold by pound or by
       kilogram.  Weights may be fractional.
     type: record
     extends: Product
     fields:
       per:
         type:
           type: enum
           symbols:
             - pound
             - kilogram
         jsonldPredicate: '#per'
       weight: float

   - name: ByCount
     doc: |
       A product, sold by count.  The count must be a integer value.
     type: record
     extends: Product
     fields:
       per:
         type:
           type: enum
           symbols:
             - item
         jsonldPredicate: '#per'
       count: int

   - name: Basket
     doc: |
       A basket of products.  The 'documentRoot' field indicates it is a
       valid starting point for a document.  The 'basket' field will
       validate subtypes of 'Product' (ByWeight and ByCount).
     type: record
     documentRoot: true
     fields:
       basket:
         type:
           type: array
           items: Product

You can check the schema and document in schema_salad/tests/basket_schema.yml
and schema_salad/tests/basket.yml::

   $ schema-salad-tool basket_schema.yml basket.yml
   Document `basket.yml` is valid


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.

.. _JSON-LD: http://json-ld.org
.. _Avro: http://avro.apache.org
.. _metaschema: https://github.com/common-workflow-language/schema_salad/blob/main/schema_salad/metaschema/metaschema.yml
.. _specification: http://www.commonwl.org/v1.2/SchemaSalad.html
.. _Language: https://github.com/common-workflow-language/cwl-v1.2/blob/v1.2.0/CommandLineTool.yml
.. _RDF: https://www.w3.org/RDF/

Owner

  • Name: Common Workflow Language
  • Login: common-workflow-language
  • Kind: organization

GitHub Events

Total
  • Release event: 5
  • Watch event: 8
  • Delete event: 50
  • Issue comment event: 74
  • Push event: 101
  • Pull request review comment event: 1
  • Pull request review event: 13
  • Pull request event: 110
  • Fork event: 2
  • Create event: 61
Last Year
  • Release event: 5
  • Watch event: 8
  • Delete event: 50
  • Issue comment event: 74
  • Push event: 101
  • Pull request review comment event: 1
  • Pull request review event: 13
  • Pull request event: 110
  • Fork event: 2
  • Create event: 61

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 1,291
  • Total Committers: 43
  • Avg Commits per committer: 30.023
  • Development Distribution Score (DDS): 0.619
Past Year
  • Commits: 86
  • Committers: 9
  • Avg Commits per committer: 9.556
  • Development Distribution Score (DDS): 0.535
Top Committers
Name Email Commits
Michael R. Crusoe m****e@g****m 492
dependabot[bot] 4****] 189
Peter Amstutz p****z@c****m 140
Manvendra Singh m****0@g****m 81
Peter Amstutz t****n@i****g 78
Tomoya Tanjo t****o@g****m 75
John Chilton j****n@g****m 73
Peter Amstutz p****z@v****m 19
Simon Gene Gottlieb s****n@g****e 19
kapilkd13 k****3@g****m 17
Adrian Zimmer z****5@g****m 16
Jeremy Leipzig l****g@g****m 10
Pau Ruiz i Safont p****t@e****k 8
GlassOfWhiskey i****2@g****m 8
Michael Franklin m****n@p****g 8
Bruno P. Kinoshita k****w 7
mvdbeek m****k@g****m 6
Nicola Soranzo n****o@e****k 6
Peter Haverty p****y@a****u 5
Francis Charette-Migneault f****t@g****m 5
Stian Soiland-Reyes s****n@a****g 2
Thomas Hickman T****n 2
Tjelvar Olsson t****n@j****k 2
odidev o****v@p****m 2
acoleman2000 a****1@g****m 2
Rupert Nash r****t@n****k 2
mergify[bot] 3****] 1
chapmanb c****b@5****m 1
Dafne van Kuppevelt d****t@e****l 1
William Moore w****e@d****k 1
and 13 more...

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 27
  • Total pull requests: 341
  • Average time to close issues: 6 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 13
  • Total pull request authors: 17
  • Average comments per issue: 1.48
  • Average comments per pull request: 1.33
  • Merged pull requests: 283
  • Bot issues: 0
  • Bot pull requests: 202
Past Year
  • Issues: 1
  • Pull requests: 101
  • Average time to close issues: about 3 hours
  • Average time to close pull requests: 4 days
  • Issue authors: 1
  • Pull request authors: 5
  • Average comments per issue: 2.0
  • Average comments per pull request: 1.09
  • Merged pull requests: 67
  • Bot issues: 0
  • Bot pull requests: 70
Top Authors
Issue Authors
  • mr-c (8)
  • tom-tan (4)
  • dependabot[bot] (3)
  • tetron (3)
  • stmbaier (2)
  • GlassOfWhiskey (2)
  • nsoranzo (1)
  • suecharo (1)
  • pvanheus (1)
  • nbraud (1)
  • bioflowy (1)
  • SGSSGene (1)
  • adamnovak (1)
  • bkappes (1)
Pull Request Authors
  • dependabot[bot] (265)
  • mr-c (100)
  • tom-tan (11)
  • SGSSGene (11)
  • tetron (10)
  • GlassOfWhiskey (9)
  • fmigneault (5)
  • mvdbeek (5)
  • acoleman2000 (3)
  • nsoranzo (2)
  • giuseppe998e (2)
  • pjotrp (2)
  • hauntsaninja (2)
  • bioflowy (2)
  • eseiler (2)
Top Labels
Issue Labels
dependencies (3) python (3) help wanted (2)
Pull Request Labels
dependencies (265) python (211) github_actions (53) ready_for_merge (2) java (1)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 385,709 last-month
  • Total docker downloads: 168,409
  • Total dependent packages: 17
    (may contain duplicates)
  • Total dependent repositories: 130
    (may contain duplicates)
  • Total versions: 258
  • Total maintainers: 5
pypi.org: schema-salad

Schema Annotations for Linked Avro Data (SALAD)

  • Versions: 199
  • Dependent Packages: 10
  • Dependent Repositories: 130
  • Downloads: 385,709 Last month
  • Docker Downloads: 168,409
Rankings
Docker downloads count: 0.8%
Dependent packages count: 1.0%
Downloads: 1.1%
Dependent repos count: 1.3%
Average: 3.0%
Forks count: 5.6%
Stargazers count: 8.1%
Maintainers (4)
Last synced: 10 months ago
proxy.golang.org: github.com/common-workflow-language/schema_salad
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 10 months ago
spack.io: py-schema-salad

Schema Annotations for Linked Avro Data (SALAD)

  • Versions: 3
  • Dependent Packages: 4
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Average: 11.6%
Dependent packages count: 11.6%
Forks count: 14.6%
Stargazers count: 20.1%
Maintainers (1)
Last synced: 11 months ago
conda-forge.org: schema-salad
  • Versions: 53
  • Dependent Packages: 3
  • Dependent Repositories: 0
Rankings
Dependent packages count: 15.6%
Forks count: 21.9%
Average: 26.4%
Dependent repos count: 34.0%
Stargazers count: 34.1%
Last synced: 10 months ago

Dependencies

schema_salad/java/pom.xml maven
  • com.fasterxml.jackson.core:jackson-databind [2.13.2.1,)
  • com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.10.4
  • junit:junit 4.13.2
  • org.apache.commons:commons-lang3 3.12.0
  • org.snakeyaml:snakeyaml-engine 2.3
schema_salad/typescript/package.json npm
  • @types/chai ^4.2.22 development
  • @types/chai-as-promised ^7.1.4 development
  • @types/js-yaml ^4.0.4 development
  • @types/mocha ^9.0.0 development
  • @types/node ^16.11.6 development
  • @types/node-fetch ^2.5.12 development
  • @types/sinon ^10.0.6 development
  • @types/uuid ^8.3.3 development
  • chai ^4.3.4 development
  • chai-as-promised ^7.1.1 development
  • codecov.io ^0.1.6 development
  • mocha ^9.1.3 development
  • nyc ^15.1.0 development
  • rimraf ^3.0.2 development
  • sinon ^12.0.1 development
  • ts-node ^10.4.0 development
  • typedoc ^0.22.10 development
  • typescript ^4.4.4 development
  • js-yaml ^4.1.0
  • node-fetch ^2.6.6
  • uri-js ^4.4.1
  • uuid ^8.3.2
mypy-requirements.txt pypi
  • black >=19.10b0
  • mypy ==0.961
  • types-dataclasses *
  • types-pkg_resources *
  • types-requests *
requirements.txt pypi
  • CacheControl ==0.12.11
  • black *
  • lockfile ==0.12.2
  • mistune >=0.8.1,<0.9
  • rdflib >=4.2.2,<7.0.0
  • rdflib >=4.2.2,<6.0.0
  • rdflib-jsonld >=0.4.0,<=0.6.1
  • ruamel.yaml >=0.12.4,
setup.py pypi
  • CacheControl *
  • lockfile *
  • mistune *
  • once *
  • rdflib *
  • requests *
  • ruamel.yaml *
  • setuptools *
  • then *
test-requirements.txt pypi
  • pytest >=6.2,<7.2
  • pytest-cov *
  • pytest-xdist *
.github/workflows/ci-tests.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/quay-publish.yml actions
  • actions/checkout v3 composite
  • docker/build-push-action v3 composite
  • docker/login-action v2 composite
  • docker/setup-buildx-action v2 composite
.github/workflows/wheels.yml actions
  • RalfG/python-wheels-manylinux-build v0.5.0-manylinux2014_x86_64 composite
  • RalfG/python-wheels-manylinux-build v0.5.0-musllinux_1_1_x86_64 composite
  • RalfG/python-wheels-manylinux-build v0.5.0-manylinux_2_28_x86_64 composite
  • RalfG/python-wheels-manylinux-build v0.5.0-manylinux_2_24_x86_64 composite
  • actions/checkout v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
dev-requirements.txt pypi
  • autoflake <2.1 development
  • bandit <1.7.5 development
  • build <0.9.1 development
  • diff_cover <7.4 development
  • flake8-bugbear <22.13 development
  • isort <5.12 development
  • pydocstyle <6.3 development
  • pylint <2.16 development
  • tox <3.29 development
  • tox-pyenv <1.2 development
cibw-requirements.txt pypi
  • cibuildwheel ==2.16.0
pyproject.toml pypi