2023-INGIPRO-docs/XSD/platform/PlatformBasics.xsd
2024-06-07 20:33:18 +03:00

171 lines
6.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="http://www.ingipro.com/test/base"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:base="http://www.ingipro.com/test/base">
<xs:complexType name="AnyType">
<xs:complexContent>
<xs:extension base="xs:anyType"/>
</xs:complexContent>
</xs:complexType>
<xs:simpleType name="Date">
<xs:restriction base="xs:date"/>
<!-- TODO: утвердить единый формат хранения даты для платформы (не путать с timestamp!) -->
</xs:simpleType>
<xs:simpleType name="String">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:simpleType name="Decimal">
<xs:restriction base="xs:decimal"/>
</xs:simpleType>
<xs:simpleType name="Integer">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
<xs:simpleType name="IndexNumber">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
<xs:complexType name="Price">
<!-- TODO: find standard solution for currency handling -->
<xs:simpleContent><xs:extension base="base:Decimal">
<xs:attribute name="currency" type="base:CurrencyCode"/>
</xs:extension></xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCode">
<xs:restriction base="base:String">
<xs:enumeration value="RUR"/>
<xs:enumeration value="EUR"/>
<xs:enumeration value="USD"/>
</xs:restriction>
<!-- TODO: enumerate available currencies -->
</xs:simpleType>
<xs:simpleType name="Hash">
<xs:annotation><xs:documentation xml:lang="ru">
<term>хэш-сумма</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<!-- MD5 hash -->
<!-- TODO: проверить адекватность с точки зрения безопасности и подмены коллизией -->
<xs:pattern value="[0-9a-f]{32}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="QNameXML">
<xs:annotation><xs:documentation xml:lang="ru">
<term>имя типа XML Schema с префиксом</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
<!-- TODO: найти паттерн. Возможно взять что-то типа QName -->
</xs:simpleType>
<xs:simpleType name="SelectorXML">
<xs:annotation><xs:documentation xml:lang="ru">
<term>селектор элементов XML</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
<!-- TODO: можно ограничить синтаксисом XPath например -->
</xs:simpleType>
<xs:simpleType name="FileName">
<xs:annotation><xs:documentation xml:lang="ru">
<term>имя файла</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
</xs:simpleType>
<xs:complexType name ="DataElement">
<xs:annotation><xs:documentation xml:lang="ru">
<term>элемент структуры данных</term>
</xs:documentation></xs:annotation>
<xs:choice>
<xs:element name="Entity" type="base:Entity"/>
<xs:element name="Value" type="base:Value"/>
<xs:element name="List" type="base:List"/>
<xs:element name="Pivot" type="base:PivotTable"/>
<xs:element name="Custom" type="base:AnyType"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="ExternalLink">
<xs:annotation><xs:documentation xml:lang="ru">
<term>отсылка к внешней системе</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<!-- NOTE: возможно стоит сделать структурные элементы для описания системы и целевой сущности -->
<xs:element name="Address" type="base:String"/>
<xs:element name="Subaddress" type="base:String" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Value">
<xs:annotation><xs:documentation xml:lang="ru">
<term>произвольное значение</term>
</xs:documentation></xs:annotation>
<xs:complexContent>
<xs:extension base="xs:anyType">
<xs:anyAttribute/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Entity">
<xs:annotation><xs:documentation xml:lang="ru">
<term>предметная сущность</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:any processContents="lax" maxOccurs="unbounded"/>
</xs:sequence>
<xs:anyAttribute/>
</xs:complexType>
<xs:complexType name="List">
<xs:annotation><xs:documentation xml:lang="ru">
<term>произвольный список</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<!-- TODO: специфицировать тип элемента списка в случае потребности ограничения типа элемента -->
<xs:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PivotTable">
<xs:annotation><xs:documentation xml:lang="ru">
<term>сводная таблица</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<!-- TODO: можно добавить альтернативу схеме - определить структуру таблицы через перечисление столбцов -->
<xs:element name="ItemSchema" type="base:QNameXML"/>
<xs:element name="Items" type="base:PivotItems"/>
<!-- TODO: правило представления: если тег внутри Summary совпадает с Item, то вписывать в ту же колонку -->
<xs:element name="Summary" type="base:AnyType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PivotItems">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Item" type="base:AnyType"/>
<xs:element name="Group" type="base:PivotGroup"/>
<!-- CHECK: проверить, что тип в Item совпадает со значением ItemSchema -->
</xs:choice>
</xs:complexType>
<xs:complexType name="PivotGroup">
<xs:annotation><xs:documentation xml:lang="ru">
<term>группировка элементов сводной таблицы</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="GroupName" type="base:String"/>
<xs:element name="Item" type="base:AnyType" minOccurs="0"/>
<xs:element name="Items" type="base:PivotItems"/>
</xs:sequence>
</xs:complexType>
</xs:schema>