Schema Template Tutorial
From OSL Demo
Item:OSW18201c9a18f64574a12d97efdeb2f953
Schema Template Tutorial [OSW18201c9a18f64574a12d97efdeb2f953] | |
---|---|
ID | OSW18201c9a18f64574a12d97efdeb2f953 |
UUID | 18201c9a-18f6-4574-a12d-97efdeb2f953 |
Label | Schema Template Tutorial |
Machine compatible name | SchemaTemplateTutorial |
Statements (outgoing) | |
Statements (incoming) | |
|
|
Keywords |
Description
No description found
Item | |
---|---|
Type(s)/Category(s) | Tutorial |
CreativeWork |
---|
Article |
---|
Tutorial | |
---|---|
Prerequisites (required) | Handlebars Templates |
Prerequisites (optional) | |
Follow-up (recommended) |
Step1: Generate a Template JSON
Template-Schema
"title": "Generic Model",
"properties": {
"parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
},
"submodels": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"parameters": {
"$ref": "#/properties/parameters"
},
"submodels": {
"$ref": "#/properties/submodels"
}
}
}
}
}
}
Template-JSON
{
"name": "BattmoModel"
"submodels": [
{
"name": "Geometrie",
"parameters": [
{
"name": "FaceArea"
}
],
"submodels": [
{
"name": "NegativeElectrode",
"parameters": [],
"submodels": [
{
"name": "ActiveMaterial",
"parameters": [
{
"name": "thickness"
}
],
"submodels": []
}
]
},
{
"name": "PositiveElectrode",
"parameters": [],
"submodels": [
{
"name": "ActiveMaterial",
"parameters": [
{
"name": "thickness"
}
],
"submodels": []
}
]
}
]
}
]
}
Step2: Generate the schema
Template-JSON
{
"name": "BattmoModel"
"submodels": [
{
"name": "Geometrie",
"parameters": [
{
"name": "FaceArea"
}
],
"submodels": [
{
"name": "NegativeElectrode",
"parameters": [],
"submodels": [
{
"name": "ActiveMaterial",
"parameters": [
{
"name": "thickness"
}
],
"submodels": []
}
]
},
{
"name": "PositiveElectrode",
"parameters": [],
"submodels": [
{
"name": "ActiveMaterial",
"parameters": [
{
"name": "thickness"
}
],
"submodels": []
}
]
}
]
}
]
}
Template
Schema
{
"name":"BattmoModel",
"properties": {
"Geometrie":{
"name":"Geometrie",
"properties":
{
"FaceArea":{},
"NegativeElectrode":{
"name":"NegativeElectrode",
"properties":{
"ActiveMaterial":{
"name":"ActiveMaterial",
"properties":{
"thickness":{}
}
}
}
},
"PositiveElectrode": {
"name":"PositiveElectrode",
"properties":{
"ActiveMaterial":{
"name":"ActiveMaterial",
"properties": {
"thickness":{}
}
}
}
}
}
}
}
}
Step3: Generate the target JSON
Schema
{
"name":"BattmoModel",
"properties": {
"Geometrie":{
"name":"Geometrie",
"properties":
{
"FaceArea":{},
"NegativeElectrode":{
"name":"NegativeElectrode",
"properties":{
"ActiveMaterial":{
"name":"ActiveMaterial",
"properties":{
"thickness":{}
}
}
}
},
"PositiveElectrode": {
"name":"PositiveElectrode",
"properties":{
"ActiveMaterial":{
"name":"ActiveMaterial",
"properties": {
"thickness":{}
}
}
}
}
}
}
}
}
JSON
{
"name": "MyModel1",
"geometry": {
"format": "1D",
"faceArea": "0.0001",
"NegativeElectrode": {
"ActiveMaterial": {
"thickness": "0.000064"
}
},
"PositiveElectrode": {
"ActiveMaterial": {
"thickness": "0.000057"
}
},
"Electrolyte": {
"Separator": {
"thickness": "0.000015"
}
}
}
}
jsondata
type |
| |||||
---|---|---|---|---|---|---|
uuid | "18201c9a-18f6-4574-a12d-97efdeb2f953" | |||||
name | "SchemaTemplateTutorial" | |||||
label |
| |||||
required_predecessor |
|