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

chore: improve XML and JSON Schemas (DEV-449) #180

Merged
merged 10 commits into from Apr 25, 2022
6 changes: 3 additions & 3 deletions docs/dsp-tools-create-ontologies.md
Expand Up @@ -80,13 +80,13 @@ The following fields are mandatory:

- `name`
- `labels`
- `super`
- `object`
- `gui_element`

The following fields are optional:

- `comments`
- `super` (with the exception of `LinkValue` where `super` is mandatory)
- `subject`
- `gui_attributes`

Expand Down Expand Up @@ -154,7 +154,7 @@ Comments with language tags. Currently, "de", "en", "fr" and "it" are supported.

### Super

(optional)
(required)

`"super": ["<super-property>", "<super-property>, ...]`

Expand All @@ -165,7 +165,7 @@ including the prefix of the external or internal ontology - has to be given.

The following base properties are defined by DSP:

- `hasValue`: This is the most generic base and taken as default if `super` is omitted.
- `hasValue`: This is the most generic base.
- `hasLinkTo`: This value represents a link to another resource. You have to indicate the "_object_" as a prefixed name
that identifies the resource class this link points to (a ":" prepended to the name is sufficient if the resource is
defined in the current ontology).
Expand Down
25 changes: 15 additions & 10 deletions knora/dsplib/schemas/data.xsd
Expand Up @@ -200,16 +200,16 @@
</xs:simpleContent>
</xs:complexType>

<!-- boolean value type -->
<!-- boolean value type-->

<xs:complexType name="boolean_type">
<xs:simpleContent>
<xs:extension base="xs:boolean">
<xs:attribute name="comment" type="xs:string"/>
<xs:attribute name="permissions" type="xs:NCName" use="required"/>
</xs:extension>
</xs:simpleContent>
<xs:simpleContent>
<xs:extension base="xs:boolean">
<xs:attribute name="comment" type="xs:string"/>
<xs:attribute name="permissions" type="xs:NCName" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

<!-- textprop_type -->
<xs:complexType name="textprop_type">
<xs:sequence>
Expand Down Expand Up @@ -334,7 +334,7 @@
<!-- booleanprop_type -->
<xs:complexType name="booleanprop_type">
<xs:sequence>
<xs:element name="boolean" type="boolean_type" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="boolean" type="boolean_type" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
Expand Down Expand Up @@ -454,7 +454,12 @@
<xs:complexType>
<xs:sequence>
<xs:element name="permissions" type="permissions_type" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="resource" type="resource_type" minOccurs="1" maxOccurs="unbounded"/>
<xs:element name="resource" type="resource_type" minOccurs="1" maxOccurs="unbounded">
<xs:unique name="UniqueNameAttr">
<xs:selector xpath=".//*"/>
<xs:field xpath="@name"/>
</xs:unique>
</xs:element>
</xs:sequence>
<xs:attribute name="default-ontology" type="xs:string"/>
<xs:attribute name="shortcode" type="knorashortcode_type"/>
Expand Down
19 changes: 18 additions & 1 deletion knora/dsplib/schemas/ontology.json
Expand Up @@ -379,6 +379,7 @@
},
"required": [
"name",
"super",
"object",
"labels",
"gui_element"
Expand Down Expand Up @@ -475,6 +476,22 @@
},
"then": {
"properties": {
"super": {
"type": "array",
"items": {
"type": "string",
"oneOf": [
{
"enum": [
"hasGeometry"
]
},
{
"$ref": "#/definitions/prefixedname"
}
]
}
},
"gui_element": {
"enum": [
"Geometry",
Expand All @@ -496,7 +513,7 @@
"properties": {
"gui_element": {
"const":
"Geonames"
"Geonames"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion testdata/test-onto.json
Expand Up @@ -293,7 +293,7 @@
{
"name": "hasGeometry",
"super": [
"hasValue"
"hasGeometry"
],
"object": "GeomValue",
"labels": {
Expand Down