Skip to content

Commit

Permalink
feat: Added Software* items
Browse files Browse the repository at this point in the history
  • Loading branch information
beneboy committed Mar 27, 2019
1 parent 0342ec7 commit 0189005
Show file tree
Hide file tree
Showing 20 changed files with 267 additions and 50 deletions.
5 changes: 5 additions & 0 deletions examples/software/invalid.softwareApplication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: SoftwareApplication
softwareRequirements:
# Invalid - Just a list of strings
- Some Package
- Some Other Package
8 changes: 8 additions & 0 deletions examples/software/invalid.softwareSession.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: SoftwareSession
# Missing property "environment".
cpuResource:
type: ResourceParameters
# Invalid, requested must be > 0
requested: -1
# Invalid, limit but be > 0
limit: -2
8 changes: 8 additions & 0 deletions examples/software/invalid.softwareSourceCode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: SoftwareSourceCode
maintainers:
# invalid, should be People or Organizations not just strings
- Joe Smith
- Jane Doe

# invalid, should be a URL
codeRepository: my-repo.git
8 changes: 8 additions & 0 deletions examples/software/simple.softwareApplication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: SoftwareApplication
softwareRequirements:
- type: SoftwareApplication
name: SomePackage
version: 1.2.3
- type: SoftwareApplication
name: SomeOtherPackage
version: 3.2.1
15 changes: 15 additions & 0 deletions examples/software/simple.softwareSession.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: SoftwareSession
environment:
- name: StencilaMega
volumeMounts:
- type: VolumeMount
mountSource: /foo/bar
mountDestination: /baz/bax
cpuResource:
type: ResourceParameters
requested: 500
limit: 1000
memoryResource:
type: ResourceParameters
requested: 1024
limit: 2048
2 changes: 2 additions & 0 deletions examples/software/simple.softwareSourceCode.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: SoftwareSourceCode
codeRepository: https://github.com/stencila/schema
36 changes: 19 additions & 17 deletions schema/CreativeWork.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ $id: https://stencila.github.com/schema/CreativeWork.schema.json
title: CreativeWork
description: The most generic kind of creative work, including books, movies, photographs, software programs, etc. https://schema.org/CreativeWork
'@id': schema:CreativeWork
properties:
authors:
'@id': schema:author
description: The authors of this content.
type: array
items:
anyOf:
- $ref: Person.schema.yaml
- $ref: Organization.schema.yaml
citations:
'@id': schema:citation
description: Citations or references to another creative work, such as another publication, web page, scholarly article, etc.
type: array
items:
anyOf:
- type: string
- $ref: CreativeWork.schema.yaml
allOf:
- $ref: Thing.schema.yaml
- properties:
authors:
'@id': schema:author
description: The authors of this content.
type: array
items:
anyOf:
- $ref: Person.schema.yaml
- $ref: Organization.schema.yaml
citations:
'@id': schema:citation
description: Citations or references to another creative work, such as another publication, web page, scholarly article, etc.
type: array
items:
anyOf:
- type: string
- $ref: CreativeWork.schema.yaml
11 changes: 3 additions & 8 deletions schema/Environment.schema.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
$schema: https://json-schema.org/draft-07/schema
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/Environment.schema.json
title: Environment
'@id': stencila:Environment
description: A computational environment.
properties:
type:
description: The type of document
type: string
const: Environment
extends:
'@id': stencila:extends
description: Other environments that this environment extends by adding or removing packages.,
Expand All @@ -26,13 +22,12 @@ properties:
type: array
items:
$ref: Package.schema.yaml
source:
'@id': stencila:source
environmentSource:
'@id': stencila:environmentSource
description: |
Source of environment definition. For example, a URL to a Dockerfile, a path to Singularity recipe file,
or a path to a filesystem folder.,
allOf:
- type: string
required:
- type
- name
29 changes: 29 additions & 0 deletions schema/Mount.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/Mount.schema.json
'@id': stencila:Mount
title: Mount
description: |
Describes a volume mount from a host to container.
allOf:
- $ref: Thing.schema.yaml
- properties:
mountSource:
'@id': stencila:mountSource
description: The mount source directory on the host.
type: string
mountDestination:
'@id': stencila:mountDestination
description: The mount location inside the container.
type: string
mountOptions:
'@id': stencila:mountOptions
type: array
description: A list of options to use when applying the mount.
items:
- type: string
mountType:
'@id': stencila:mountType
type: string
description: The type of mount.
required:
- mountDestination
18 changes: 4 additions & 14 deletions schema/Package.schema.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
$schema: https://json-schema.org/draft-07/schema,
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/Package.schema.json
title: Package
description: A computational package.
'@id': stencila:Package
type: object
properties:
type:
description: The type of document
type: string
const: Package
name:
'@id': schema:name
description: The name of the environment.
allOf:
- $ref: name.schema.yaml
additionalProperties: false
allOf:
- $ref: Thing.schema.yaml
required:
- name
- name
7 changes: 7 additions & 0 deletions schema/ResourceParameters.schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# `ResourceParameters`

## About

`ResourceParameters` is a generic class for representing any kind of resource that has the concept of a requested or reserved amount and a limit. For example, reserving an amount of memory but not going over the limit. Both `resourceRequested` and `resourceLimit` are optional and can be omitted as appropriate for a particular use case.

The values are just numbers and the application parsing application can interpret these however it needs. For example, for a memory limit these may be bytes, for a CPU limit they could be the proportion of CPU to use.
17 changes: 17 additions & 0 deletions schema/ResourceParameters.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/ResourceParameters.schema.json
title: ResourceParameters
'@id': stencila:ResourceParameters
description: |
Describes limits or requested amounts for a particular resource (e.g. memory or CPU).
properties:
resourceLimit:
'@id': stencila:resourceLimit
description: The maximum amount of the resource that can be used.
type: number
minimum: 0
resourceRequested:
'@id': stencila:resourceRequested
description: The amount of the resource that has been requested (and possibly reserved).
type: number
minimum: 0
10 changes: 0 additions & 10 deletions schema/Session.schema.yaml

This file was deleted.

13 changes: 13 additions & 0 deletions schema/SoftwareApplication.schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `SoftwareApplication`

## Extends

`SoftwareApplication` extends `CreativeWork`.

## About

`SoftwareApplication` represents a software application that can be located by name and version. It may be fetched in binary format or some package manager (npm, pip, etc) could fetch and compile the source code.

## Parsing/Interpretation

Although by using the `softwareRequirements` property it is possible to represent a full hierarchy of required packages, normally it is adequate to only list the immediate dependencies and allow the system/language package manager to resolve the rest.
20 changes: 20 additions & 0 deletions schema/SoftwareApplication.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/SoftwareApplication.schema.json
title: SoftwareApplication
description: |
A software application.
'@id': stencila:SoftwareApplication
allOf:
- $ref: CreativeWork.schema.yaml
- properties:
softwareRequirements:
'@id': schema:softwareRequirements
description: |
Component dependency requirements for application. This includes runtime environments and shared libraries that are not included in the application distribution package, but required to run the application (Examples: DirectX, Java or .NET runtime).
type: array
items:
- $ref: SoftwareApplication.schema.yaml
softwareVersion:
'@id': schema:softwareVersion
description: Version of the software instance.
type: string
13 changes: 13 additions & 0 deletions schema/SoftwareSession.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `SoftwareSession`

## Extends

`SoftwareSession` extends `Thing`.

## Related

### Open Containers Initiative

This is "inspired" by the [OCI Runtime Config Schema](https://github.com/opencontainers/runtime-spec/blob/master/schema/config-schema.json)

There are a number of properties that did not seem relevant to our use as well as some references that did not seem to be required. We try to stay consistent with the naming used but have dereferenced and combined the config schema and [Linux Schema](https://github.com/opencontainers/runtime-spec/blob/master/schema/defs-linux.json) to use the cpu and memory limits.
27 changes: 27 additions & 0 deletions schema/SoftwareSession.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/SoftwareSession.schema.json
title: SoftwareSession
'@id': stencila:SoftwareSession
description: |
Represents a runtime session with the resources and image that is required by software to execute.
allOf:
- $ref: Thing.schema.yaml
- properties:
volumeMounts:
'@id': stencila:volumeMount
description: Volumes to mount in the session.
type: array
items:
- $ref: Mount.schema.yaml
cpuResource:
'@id': stencila:cpuResource
$ref: ResourceParameters.schema.yaml
memoryResource:
'@id': stencila:memoryResource
$ref: ResourceParameters.schema.yaml
environment:
'@id': stencila:environment
description: Definition of the environment to execute this session in.
$ref: Environment.schema.yaml
required:
- environment
9 changes: 9 additions & 0 deletions schema/SoftwareSourceCode.schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `SoftwareSourceCode`

## Extends

`SoftwareSourceCode` extends `CreativeWork`.

## About

Usually contains a link to a `codeRepository` where the code can be fetched from and then compiled. Normally using `SoftwareApplication` is preferred, if possible, however using `SoftwareSourceCode` allows for the installation of packages where no pre-built version is available.
55 changes: 55 additions & 0 deletions schema/SoftwareSourceCode.schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/SoftwareSourceCode.schema.json
title: SoftwareSourceCode
description: |
Computer programming source code. Example: Full (compile ready) solutions, code snippet samples, scripts, templates.
'@id': schema:SoftwareSourceCode
allOf:
- $ref: CreativeWork.schema.yaml
- properties:
codeRepository:
'@id': schema:codeRepository
description: |
Link to the repository where the un-compiled, human readable code and related code is located (SVN, github, CodePlex)
$ref: URL.schema.yaml
codeSampleType:
'@id': schema:codeSampleType
description: |
What type of code sample: full (compile ready) solution, code snippet, inline code, scripts, template.
type: string
maintainers:
'@id': codemeta:maintainer
description: |
The people or organizations who maintain the software.
type: array
items:
- $ref: Organization.schema.yaml
- $ref: Person.schema.yaml
programmingLanguages:
'@id': schema:programmingLanguage
description: |
The computer programming language.
type: array
items:
- type: string
runtimePlatform:
'@id': schema:runtimePlatform
description: |
Runtime platform or script interpreter dependencies (Example - Java v1, Python2.3, .Net Framework 3.0).
type: array
items:
- type: string
softwareRequirements:
'@id': schema:softwareRequirements
description: |
Component dependency requirements for application. This includes runtime environments and shared libraries that are not included in the application distribution package, but required to run the application (Examples: DirectX, Java or .NET runtime).
type: array
items:
- $ref: SoftwareApplication.schema.yaml
targetProducts:
'@id': schema:targetProduct
description: |
Target Operating System / Product to which the code applies. If applies to several versions, just the product name can be used.
type: array
items:
- $ref: SoftwareApplication.schema.yaml
6 changes: 5 additions & 1 deletion schema/index.schema.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
$schema: http://json-schema.org/draft-07/schema#
$id: https://stencila.github.com/schema/index.schema.json
'@id': stencila:index
anyOf:
- $ref: CreativeWork.schema.yaml
- $ref: Datatable.schema.yaml
- $ref: DatatableColumn.schema.yaml
- $ref: Document.schema.yaml
- $ref: Environment.schema.yaml
- $ref: Include.schema.yaml
- $ref: Mount.schema.yaml
- $ref: Organization.schema.yaml
- $ref: Package.schema.yaml
- $ref: Person.schema.yaml
- $ref: Session.schema.yaml
- $ref: ResourceParameters.schema.yaml
- $ref: SoftwareSession.schema.yaml
- $ref: SoftwareSourceCode.schema.yaml
- $ref: Sheet.schema.yaml
- $ref: Table.schema.yaml
- $ref: TableCell.schema.yaml
Expand Down

0 comments on commit 0189005

Please sign in to comment.