diff --git a/tests/data/expected_json_schema.json b/tests/data/expected_json_schema.json
index 71dc6c3..8d54e8d 100644
--- a/tests/data/expected_json_schema.json
+++ b/tests/data/expected_json_schema.json
@@ -1,24 +1,33 @@
{
+ "$schema": "http://json-schema.org/draft-07/schema",
"title": "Test",
"type": "object",
"properties": {
"name": {
- "title": "Name",
- "type": "string",
- "term": "schema:hello"
+ "title": "name",
+ "term": "schema:hello",
+ "type": "string"
},
"number": {
- "title": "Number",
- "type": "number",
- "term": "schema:one"
+ "title": "number",
+ "term": "schema:one",
+ "type": "number"
},
"test2": {
- "title": "Test2",
+ "term": "schema:something",
"type": "array",
"items": {
"$ref": "#/definitions/Test2"
- },
- "term": "schema:something"
+ }
+ },
+ "ontology": {
+ "title": "ontology",
+ "type": "string",
+ "enum": [
+ "https://www.evidenceontology.org/term/",
+ "https://amigo.geneontology.org/amigo/term/",
+ "http://semanticscience.org/resource/"
+ ]
}
},
"definitions": {
@@ -26,22 +35,18 @@
"title": "Test2",
"type": "object",
"properties": {
- "title": "Test2",
- "type": "object",
- "properties": {
- "names": {
- "title": "Names",
- "type": "array",
- "items": {
- "type": "string"
- },
- "term": "schema:hello"
- },
- "number": {
- "title": "Number",
- "type": "number",
- "term": "schema:one"
+ "names": {
+ "title": "names",
+ "term": "schema:hello",
+ "type": "array",
+ "items": {
+ "type": "string"
}
+ },
+ "number": {
+ "title": "number",
+ "term": "schema:one",
+ "type": "number"
}
}
}
diff --git a/tests/data/expected_python_dc.py b/tests/data/expected_python_dc.py
index 8be2d1a..ee1276f 100644
--- a/tests/data/expected_python_dc.py
+++ b/tests/data/expected_python_dc.py
@@ -3,6 +3,7 @@
from dataclasses import dataclass, field
from dataclasses_json import config, dataclass_json
from typing import List, Optional
+from enum import Enum
from uuid import uuid4
@@ -12,6 +13,7 @@ class Test:
name: str
number: Optional[float] = None
test2: List[Test2] = field(default_factory=list)
+ ontology: Optional[Ontology] = None
# JSON-LD fields
id: str = field(
@@ -34,7 +36,28 @@ class Test:
"test2": "schema:something",
}
)
+
+
+
+ def add_to_test2(
+ self,
+ names: List[str],
+ number: Optional[float],
+ **kwargs,
+ ):
+ params = {
+
+ "names": names,
+ "number": number
+ }
+
+ self.test2.append(
+ Test2(**params)
+ )
+ return self.test2[-1]
+
+
@dataclass_json
@dataclass
class Test2:
@@ -60,4 +83,11 @@ class Test2:
"names": "schema:hello",
"number": "schema:one",
}
- )
\ No newline at end of file
+ )
+
+
+
+class Ontology(Enum):
+ ECO = "https://www.evidenceontology.org/term/"
+ GO = "https://amigo.geneontology.org/amigo/term/"
+ SIO = "http://semanticscience.org/resource/"
\ No newline at end of file
diff --git a/tests/data/expected_python_sdrdm.py b/tests/data/expected_python_sdrdm.py
index 8ac89d9..d2f42fb 100644
--- a/tests/data/expected_python_sdrdm.py
+++ b/tests/data/expected_python_sdrdm.py
@@ -34,6 +34,12 @@ class Test(
json_schema_extra=dict(term = "schema:something",)
)
+ ontology: Optional[Ontology] = element(
+ default=None,
+ tag="ontology",
+ json_schema_extra=dict()
+ )
+
_repo: str = PrivateAttr(default="https://www.github.com/my/repo/")
@@ -71,4 +77,11 @@ class Test2(
json_schema_extra=dict(term = "schema:one",)
)
- _repo: str = PrivateAttr(default="https://www.github.com/my/repo/")
\ No newline at end of file
+ _repo: str = PrivateAttr(default="https://www.github.com/my/repo/")
+
+
+
+class Ontology(Enum):
+ ECO = "https://www.evidenceontology.org/term/"
+ GO = "https://amigo.geneontology.org/amigo/term/"
+ SIO = "http://semanticscience.org/resource/"
\ No newline at end of file
diff --git a/tests/data/expected_sdrdm_schema.json b/tests/data/expected_sdrdm_schema.json
index 49cc24a..11a2354 100644
--- a/tests/data/expected_sdrdm_schema.json
+++ b/tests/data/expected_sdrdm_schema.json
@@ -41,10 +41,22 @@
"is_attr": false,
"name": "SomeTest2"
}
+ },
+ {
+ "name": "ontology",
+ "multiple": false,
+ "dtypes": ["Ontology"],
+ "docstring": "",
+ "options": [],
+ "term": null,
+ "required": false,
+ "xml": {
+ "is_attr": false,
+ "name": "ontology"
+ }
}
],
- "docstring": "",
- "object_type": "Object"
+ "docstring": ""
},
{
"name": "Test2",
@@ -76,8 +88,17 @@
}
}
],
- "docstring": "",
- "object_type": "Object"
+ "docstring": ""
+ }
+ ],
+ "enums": [
+ {
+ "name": "Ontology",
+ "mappings": {
+ "ECO": "https://www.evidenceontology.org/term/",
+ "GO": "https://amigo.geneontology.org/amigo/term/",
+ "SIO": "http://semanticscience.org/resource/"
+ }
}
],
"config": {
diff --git a/tests/data/expected_shacl.ttl b/tests/data/expected_shacl.ttl
index 5c75615..71e6137 100644
--- a/tests/data/expected_shacl.ttl
+++ b/tests/data/expected_shacl.ttl
@@ -27,7 +27,7 @@ tst:TestShape
sh:node md:Test2Shape ;
sh:minCount 0 ;
- ].
+ ];
tst:Test2Shape
a sh:NodeShape ;
diff --git a/tests/data/expected_shex.shex b/tests/data/expected_shex.shex
index 1abe1c3..24ced3f 100644
--- a/tests/data/expected_shex.shex
+++ b/tests/data/expected_shex.shex
@@ -3,11 +3,31 @@ PREFIX tst:
PREFIX schema:
tst:Test {
- schema:hello xsd:string;
- schema:one xsd:double?;
- schema:something @tst:Test2*;
+ schema:hello xsd:string {
+ shex:annotation [
+ shex:label "name"
+ ]
+ };
+ schema:one xsd:double? {
+ shex:annotation [
+ shex:label "number"
+ ]
+ };
+ schema:something @tst:Test2* {
+ shex:annotation [
+ shex:label "test2"
+ ]
+ };
}
tst:Test2 {
- schema:hello xsd:string*;
- schema:one xsd:double?;
+ schema:hello xsd:string* {
+ shex:annotation [
+ shex:label "names"
+ ]
+ };
+ schema:one xsd:double? {
+ shex:annotation [
+ shex:label "number"
+ ]
+ };
}
\ No newline at end of file
diff --git a/tests/data/expected_xml_schema.xsd b/tests/data/expected_xml_schema.xsd
index 1b03a3c..6768740 100644
--- a/tests/data/expected_xml_schema.xsd
+++ b/tests/data/expected_xml_schema.xsd
@@ -8,18 +8,28 @@
-
+
+
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/data/model.md b/tests/data/model.md
index 17a5a84..5613a48 100644
--- a/tests/data/model.md
+++ b/tests/data/model.md
@@ -22,6 +22,8 @@ nsmap:
- Type: Test2[]
- Term: schema:something
- XML: SomeTest2
+- ontology
+ - Type: Ontology
### Test2
@@ -33,3 +35,16 @@ nsmap:
- Type: float
- Term: schema:one
- XML: @number
+
+
+## Enumerations
+
+### Ontology
+
+Ontology endpoints for different types of sequences.
+
+```
+GO = "https://amigo.geneontology.org/amigo/term/"
+SIO = "http://semanticscience.org/resource/"
+ECO = "https://www.evidenceontology.org/term/"
+```
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 0b88b31..cecf9ba 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -36,7 +36,7 @@ mod tests {
.find(|o| o.name == "Test2".to_string())
.unwrap();
- assert_eq!(test1.attributes.len(), 3);
+ assert_eq!(test1.attributes.len(), 4);
assert_eq!(test2.attributes.len(), 2);
// Check if the attributes are correct
@@ -46,6 +46,7 @@ mod tests {
"name".to_string(),
"number".to_string(),
"test2".to_string(),
+ "ontology".to_string(),
];
assert_eq!(test1_attr_names, expected);