Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extended schema to support diagrammatic data #12

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
329 changes: 318 additions & 11 deletions schemas/ontouml2.schema.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,300 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://ontouml.org/ontouml-schema/2.0/0.1.202001091222",
"title": "Root Package",
"description": "A package that contains an ontology in OntoUML 2. Mandatory fields are those defined for Package.",
"title": "Project",
"description": "A project of an ontology in OntoUML 2, which may contain both model and diagrammatic data.",
"type": "object",
"allOf": [
{
"properties": {
"type": {
"const": "Project"
},
"id": {
"$ref": "#/definitions/id"
},
"name": {
"$ref": "#/definitions/name"
},
"description": {
"$ref": "#/definitions/description"
},
"model": {
"$ref": "#/definitions/Package"
},
"diagrams": {
"description": "An array containing diagrams that depict the elements in the model.",
"oneOf": [
{
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/Diagram"
}
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
"required": [
"type",
"id",
"name",
"description",
"model",
"diagrams"
],
"definitions": {
"Diagram": {
"type": "object",
"properties": {
"type": {
"const": "Diagram"
},
"id": {
"$ref": "#/definitions/id"
},
"name": {
"$ref": "#/definitions/name"
},
"description": {
"$ref": "#/definitions/description"
},
"owner": {
"$ref": "#/definitions/reference"
},
"contents": {
"$ref": "#/definitions/diagramContents"
}
},
"required": [
"type",
"id",
"name",
"description",
"owner",
"contents"
],
"additionalProperties": false
},
"diagramContents": {
"description": "A non-empty nullable array of objects representing shapes, lines and labels in a diagram.",
"oneOf": [
{
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": {
"$ref": "#/definitions/DiagramElement"
}
},
{
"type": "null"
}
]
},
"DiagramElement": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Shape",
"Line",
"Label"
]
},
"id": {
"$ref": "#/definitions/id"
},
"source": {
"$ref": "#/definitions/reference"
},
"field": {
"description": "A particular field of the source element used for rendering this DiagramElement. Example: \"name\" for a Label of a association.",
"$ref": "#/definitions/nullableString"
},
"points": {
"$ref": "#/definitions/points"
},
"font": {
"$ref": "#/definitions/font"
},
"line": {
"$ref": "#/definitions/line"
},
"background": {
"$ref": "#/definitions/background"
},
"visibility": {
"$ref": "#/definitions/visibility"
},
"elements": {
"description": "A non-empty nullable array of dependent diagram elements, i.e., of elements that can only be rendered if the container element is rendered. An example is the label of an association between two classes.",
"oneOf": [
{
"type": "array",
"uniqueItems": true,
"minItems": 1,
"items": {
"$ref": "#/definitions/DiagramElement"
}
},
{
"type": "null"
}
]
}
},
"additionalProperties": true,
"required": [
"type",
"id",
"source",
"field",
"points",
"font",
"line",
"background",
"visibility",
"elements"
]
},
"points": {
"description": "A list of coordinates to position the element in the diagram. The values are interpreted in reference to the top-left corner of the diagram, which is has the coordinate {\"x\": 0, \"y\":0}.",
"oneOf": [
{
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"x": {
"$ref": "#/definitions/nullableNumber"
},
"y": {
"$ref": "#/definitions/nullableNumber"
}
},
"required": [
"x",
"y"
],
"additionalProperties": false
}
},
{
"type": "null"
}
]
},
"visibility": {
"description": "A field that contains flags to show/hide certain components of the diagram element. Useful for hiding the attributes and operations compartments of a class shape.",
"oneOf": [
{
"type": "object",
"minimum": 1,
"additionalProperties": {
"type": "boolean",
"minLength": 1
}
},
{
"type": "null"
}
]
},
"background": {
"oneOf": [
{
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/color"
},
"transparency": {
"$ref": "#/definitions/nullableNumber"
}
},
"required": [
"color",
"transparency"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"line": {
"oneOf": [
{
"type": "object",
"properties": {
"color": {
"$ref": "#/definitions/color"
},
"transparency": {
"$ref": "#/definitions/nullableNumber"
},
"weight": {
"$ref": "#/definitions/nullableNumber"
},
"style": {
"$ref": "#/definitions/lineStyle"
}
},
"required": [
"color",
"transparency",
"weight",
"style"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"font": {
"oneOf": [
{
"properties": {
"name": {
"$ref": "#/definitions/nullableString"
},
"size": {
"$ref": "#/definitions/nullableNumber"
},
"color": {
"$ref": "#/definitions/color"
}
},
"required": [
"name",
"size",
"color"
],
"additionalProperties": false
},
{
"type": "null"
}
]
},
"color": {
"description": "The color of the lines used to draw the shape, represented in hex format: \"#ff99a3\"",
"$ref": "#/definitions/nullableString"
},
"lineStyle": {
"description": "The style of a line. Examples: \"solid\", \"dashed\", \"dotted\"",
"$ref": "#/definitions/nullableString"
},
"Package": {
"description": "An object representing a packge element. Mandatory fields: constant \"type\": \"Package\", \"id\", \"name\", \"elements\", \"propertyAssignments\". Additional fields NOT allowed.",
"description": "An object representing a package element. Mandatory fields: constant \"type\": \"Package\", \"id\", \"name\", \"elements\", \"propertyAssignments\". Additional fields NOT allowed.",
"type": "object",
"properties": {
"type": {
Expand All @@ -27,7 +310,7 @@
"$ref": "#/definitions/description"
},
"contents": {
"$ref": "#/definitions/contents"
"$ref": "#/definitions/packageContents"
},
"propertyAssignments": {
"$ref": "#/definitions/propertyAssignments"
Expand Down Expand Up @@ -158,7 +441,13 @@
}
},
"additionalProperties": false,
"required": ["type", "id", "name", "description", "propertyAssignments"]
"required": [
"type",
"id",
"name",
"description",
"propertyAssignments"
]
},
"Relation": {
"description": "An object representing an relation element. Mandatory fields: constant \"type\": \"Class\", \"id\", \"name\", \"stereotypes\", \"properties\", \"propertyAssignments\". The \"properties\" array must have at least two items and is not nullable. The order of these items represents their position on a equivalent predicate, e.g., in the ternary relation \"buys-product-from(buyer,product,seller)\", the order of items representing these entities must follow the order \"buyer\" (in properties[0]), \"product\" (in properties[1]), and \"seller\" (in properties[2]). Relation elements are also used to represent derivation relations, in which case they must contain the stereotype \"derivation\" and have only 2 properties, the first being a Relation element and the second a Class element. Additional fields NOT allowed. Ordered properties.",
Expand Down Expand Up @@ -360,7 +649,11 @@
"oneOf": [
{
"type": "string",
"enum": ["NONE", "SHARED", "COMPOSITE"]
"enum": [
"NONE",
"SHARED",
"COMPOSITE"
]
},
{
"type": "null"
Expand Down Expand Up @@ -395,7 +688,7 @@
"isReadOnly"
]
},
"contents": {
"packageContents": {
"description": "A non-empty nullable array of objects representing model elements. Possible object types in this array are: \"Package\", \"Class\", \"Relation\", \"Generalization\", \"GeneralizationSet\".",
"oneOf": [
{
Expand Down Expand Up @@ -487,6 +780,17 @@
}
]
},
"nullableNumber": {
"description": "A auxiliary definition for nullable number fields.",
"oneOf": [
{
"type": "number"
},
{
"type": "null"
}
]
},
"properties": {
"description": "A non-empty array of Property elements representing properties exhibited by instances of the container model element. Nullable. If the container object of his field is a class, the properties in this array are the attributes of the class. Alternatively, if the container is a relation, the properties in this array are the association ends of the relation.",
"oneOf": [
Expand Down Expand Up @@ -576,7 +880,10 @@
"$ref": "#/definitions/id"
}
},
"required": ["type", "id"],
"required": [
"type",
"id"
],
"additionalProperties": false
},
{
Expand All @@ -602,4 +909,4 @@
]
}
}
}
}
Loading