Adding profile schema

This commit is contained in:
Luca Frosini 2023-03-15 20:48:39 +01:00
parent 477cd9ed22
commit f7214bc123
2 changed files with 236 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
vc:minVersion="1.1">
<xs:redefine schemaLocation="profile5.xsd">
<xs:complexType name="Extra">
<xs:element name="country"/>
</xs:complexType>
</xs:redefine>
</xs:schema>

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
vc:minVersion="1.1">
<xs:element name="metadataformat">
<xs:complexType>
<xs:sequence>
<xs:element type="ExtendedMetadataFieldType" name="metadatafield" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute type="NotEmpty" use="required" name="type">
<xs:annotation>
<xs:documentation>
The type (i.e the name) of the profile.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="version" type="xs:integer" use="optional" fixed="5">
<xs:annotation>
<xs:documentation>This XSD is valid for gCube Metadata Profile version 5. Any XML conform to this schema must declare such a version as attibute in the root tag.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:complexType name="TagGroupType">
<xs:sequence>
<xs:choice>
<xs:sequence>
<xs:element name="how" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="onFieldName"/>
<xs:enumeration value="onValue"/>
<xs:enumeration value="onFieldName_onValue"/>
<xs:enumeration value="onValue_onFieldName"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:sequence>
<xs:element type="NotEmpty" name="fixedValue" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:choice>
<xs:element name="ifFieldValueMatch" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="NotEmpty" name="regex" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute type="xs:boolean" name="create"/>
</xs:complexType>
<xs:complexType name="TagType">
<xs:complexContent>
<xs:extension base="TagGroupType">
<xs:attribute type="NotEmpty" name="separator" default="_"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="GroupType">
<xs:complexContent>
<xs:extension base="TagGroupType">
<xs:attribute type="xs:boolean" name="propagateUp" default="false"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="NotEmpty">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="MetadataFieldType">
<xs:sequence>
<xs:element type="xs:string" name="fieldId" minOccurs="0">
<xs:annotation>
<xs:documentation>
It declares (if present in the profile) the value that will be used to specify the field name in the Document (e.g. JSON Document) passed to Service that will store the resulting Document. If the 'fieldId' is absent in the profile, the value of the 'fieldName' (which is mandatory) will be used as field name in the Document.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="xs:string" name="fieldName">
<xs:annotation>
<xs:documentation>It contains the name of the metadata field.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="xs:boolean" name="mandatory" minOccurs="0"
maxOccurs="1">
<xs:annotation>
<xs:documentation>
It declares if the 'metadatafield' is a field mandatory (by using 'true') or not (by using 'false').
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="dataType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="String"/>
<xs:enumeration value="Time"/>
<xs:enumeration value="Time_Interval"/>
<xs:enumeration value="Times_ListOf"/>
<xs:enumeration value="Text"/>
<xs:enumeration value="Boolean"/>
<xs:enumeration value="Number"/>
<xs:enumeration value="GeoJSON"/>
<xs:enumeration value="File"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element type="xs:string" name="maxOccurs" minOccurs="0"
maxOccurs="1">
<xs:annotation>
<xs:documentation>
It specifies the maximum number of times that the'metadatafield' can occur: N (as number): if the field must appear N times; * (as char asterisk): if the field can appear an unlimited number of times.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element type="xs:string" name="defaultValue" minOccurs="0"
maxOccurs="1"/>
<xs:element type="xs:string" name="note" minOccurs="0" maxOccurs="1"/>
<xs:element name="vocabulary" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="vocabularyField"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute type="xs:boolean" name="isMultiSelection"/>
</xs:complexType>
</xs:element>
<xs:element name="validator" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="regularExpression"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:choice>
<xs:element name="tags" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="TagType" name="tag" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="tagging" type="TaggingType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
This tagging method is deprecated. Please use the tag 'tags' instead.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:choice>
<xs:element name="groups" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence>
<xs:element type="GroupType" name="group" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="grouping" type="GroupingType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
This grouping method is deprecated. Please use the tag 'groups' instead.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
</xs:sequence>
<xs:attribute name="categoryref" use="optional" type="xs:string" />
</xs:complexType>
<xs:complexType name="Extra">
<xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip">
<xs:annotation>
<xs:documentation>Any tags are allowed</xs:documentation>
</xs:annotation>
</xs:any>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExtendedMetadataFieldType">
<xs:complexContent>
<xs:extension base="MetadataFieldType">
<xs:sequence>
<xs:element type="Extra" name="extra" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Any 'metadataField' definition can include any additional attribute in this 'extra' tag. This tag and its content are ignored by the validators. They are used by any external tools producing/consuming the profile definition and instances.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Maintain backward compatibility -->
<xs:simpleType name="TaggingGroupingValue">
<xs:restriction base="xs:string">
<xs:enumeration value="onFieldName" />
<xs:enumeration value="onValue" />
<xs:enumeration value="onFieldName_onValue" />
<xs:enumeration value="onValue_onFieldName" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="TaggingType">
<xs:simpleContent>
<xs:extension base="TaggingGroupingValue">
<xs:attribute type="xs:boolean" name="create" />
<xs:attribute type="NotEmpty" name="separator" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="GroupingType">
<xs:simpleContent id="TaggingGroupingValue">
<xs:extension base="TaggingGroupingValue">
<xs:attribute type="xs:boolean" name="create" />
<xs:attribute type="xs:boolean" name="propagateUp" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>