Skip to content

Commit

Permalink
Added OWL and README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Davenport committed Nov 11, 2024
1 parent 559c089 commit 0d72b00
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
38 changes: 38 additions & 0 deletions generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

# BrAPI Schema Generator

Generates the OpenAPI Specification, GraphQL Schema and OWL Model from the JSON Schema.
The files are generated in the Specification/Generated directory.

### How to use

To generate all use the following

* In windows

```powershell
./gradlew generateAll
```

* In Linux or macOS

```shell
./gradle generateAll
```
For individual tasks try

* *generateGraphQL* to generate the GraphQL Schema from the JSON Schema
* *generateOpenAPI* to generate the OpenAPI Specification from the JSON Schema
* *generateOWL* to generate the OWL Model from the JSON Schema
* *validate* to validate the JSON Schema without generating any file

The files are generated in the Specification/Generated directory.

to change the version of BrAPI used in the file name edit the *brapiVersion* in
[Settings](settings.gradle).

### Configuration

To configure the generator see https://github.com/plantbreeding/brapi-schema-tools


33 changes: 28 additions & 5 deletions generator/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apply plugin : "java"
ext {
javaMainClass = 'org.brapi.schematools.cli.BrAPICommand'
brapiSchemaToolsVersion = '0.7.0-SNAPSHOT'
brapiSchemaToolsVersion = '0.10.0-SNAPSHOT'
brapiVersion = 'v2_1'
}

repositories {
Expand All @@ -28,22 +29,44 @@ tasks.register("generateGraphQL", JavaExec) {
classpath = sourceSets.main.runtimeClasspath
mainClass = javaMainClass
workingDir = '../'
def filename = "Specification/Generated/brapi_" + brapiVersion + ".graphqls"
args = ['generate',
'Specification/BrAPI-Schema',
'-l', 'GRAPHQL',
'-f', 'Specification/Generated/schema.graphqls',
'-f', filename,
'-x']
}

tasks.register("generateOpenAPI", JavaExec) {
group = 'BrAPI'
description = 'Generate GraphQL schema from the Json Schema'
description = 'Generate OpenAPI schema from the Json Schema'
classpath = sourceSets.main.runtimeClasspath
mainClass = javaMainClass
workingDir = '../'
def filename = "Specification/Generated/brapi_" + brapiVersion + ".json"
args = ['generate', 'Specification/BrAPI-Schema',
'-l', 'OPEN_API',
'-f', 'Specification/Generated/brapi_openapi.json',
'-c', 'Specification\\OpenAPI-Components',
'-f', filename,
'-c', 'Specification/OpenAPI-Components',
'-x']
}

tasks.register("generateOWL", JavaExec) {
group = 'BrAPI'
description = 'Generate OWL schema from the Json Schema'
classpath = sourceSets.main.runtimeClasspath
mainClass = javaMainClass
workingDir = '../'
def filename = "Specification/Generated/brapi_" + brapiVersion + ".ttl"
args = ['generate', 'Specification/BrAPI-Schema',
'-l', 'OWL',
'-f', filename,
'-m', 'generator/ont-model-metadata.yaml',
'-x']
}

tasks.register("generateAll") {
dependsOn generateGraphQL
dependsOn generateOpenAPI
dependsOn generateOWL
}

0 comments on commit 0d72b00

Please sign in to comment.