2023-INGIPRO-docs/XSD/platform/DocumentationElements.xsd

451 lines
20 KiB
XML
Raw Normal View History

2024-06-07 20:33:18 +03:00
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:base="http://www.ingipro.com/test/base"
xmlns:doc="http://www.ingipro.com/test/doc"
targetNamespace="http://www.ingipro.com/test/doc">
<xs:import namespace="http://www.ingipro.com/test/base" schemaLocation="D:\DEV\!WORK\INGIPRO\XSD\platform\PlatformBasics.xsd"/>
<xs:complexType name="Document">
<xs:annotation><xs:documentation xml:lang="ru">
<term>шаблон документа</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<!-- CHECK: Проверить, что не более одной ссылки с типом DocumentLink -->
<xs:element name="DocumentLink" type="base:ExternalLink" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DocumentTitle" type="doc:DocumentTitle"/>
<xs:element name="DocumentIndex" type="doc:DocumentIndex" minOccurs="0"/>
<xs:element name="DateIssue" type="base:Date"/>
<xs:element name="Status" type="doc:DocumentStatus" minOccurs="0"/>
<xs:element name="DocumentForm" type="base:AnyType" minOccurs="0"/>
<xs:element name="DocumentGround" type="doc:Ground" minOccurs="0" maxOccurs="unbounded"/>
<!-- CHECK: все элементы документа должны обладать атрибутом elementType -->
<!-- CHECK: структура элементов должна соответствовать прототипам, соответствующим значению elementType -->
<xs:element name="Body" type="base:AnyType"/>
<xs:element name="AttachmentsList" type="doc:AttachmentsList" minOccurs="0"/>
<xs:element name="Signature" type="doc:SignatureProperty" maxOccurs="unbounded"/>
<xs:element name="SigningOrder" type="doc:SigningOrder" minOccurs="0"/>
<!-- CHECK: ключи для идентификаторов -->
<!-- CHECK: Связь ID подписей в порядке и списке подписей -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLink">
<xs:annotation><xs:documentation xml:lang="ru">
<term>внутренняя отсылка к документу в системе</term>
</xs:documentation></xs:annotation>
<xs:complexContent><xs:extension base="base:ExternalLink">
<xs:sequence>
<xs:element name="Address" type="base:String" fixed="НАЗВАНИЕ_ПЛАТФОРМЫ"/>
<xs:element name="Subaddress" type="base:String"/>
</xs:sequence>
</xs:extension></xs:complexContent>
</xs:complexType>
<xs:simpleType name="DocumentStatus">
<xs:annotation><xs:documentation xml:lang="ru">
<term>статус документа</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<xs:enumeration value="предварительный"/>
<xs:enumeration value="промежуточный"/>
<xs:enumeration value="заключительный"/>
<xs:enumeration value="проект"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="AttachmentsList">
<xs:annotation><xs:documentation xml:lang="ru">
<term>список приложений</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="Attachment" type="doc:Attachment" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Attachment">
<xs:annotation>
<xs:documentation xml:lang="ru">
<term>приложение</term>
</xs:documentation>
<xs:appinfo>
<shortRepresentation>${AttachmentID} ${Description}</shortRepresentation>
<fullRepresentation>${AttachmentID} ${Description}\nФайл: ${File}, Хэш-сумма: ${FileHash}, Схема: {AttachmentSchema}</fullRepresentation>
</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="AttachmentID" type="doc:AttachmentID"/>
<!-- INFO: Для приложений, приводящихся в форме XML документа -->
<!-- CHECK: схема приложения должна наследоваться от doc:Document -->
<xs:element name="AttachmentSchema" type="base:QNameXML" minOccurs="0"/>
<xs:element name="AttachedFile" type="base:FileName"/>
<xs:element name="FileHash" type="base:Hash"/>
<xs:element name="Description" type="base:AnyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentsList">
<xs:annotation><xs:documentation xml:lang="ru">
<term>список документов</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="DocumentID" type="doc:DocumentTitle" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- ~журналы и записи~ -->
<xs:complexType name="JournalDescription">
<xs:annotation><xs:documentation xml:lang="ru">
<term>описание журнала записей</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="Attributes" minOccurs="0">
<xs:complexType><xs:sequence>
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
</xs:sequence></xs:complexType>
</xs:element>
<xs:element name="Strucutre">
<xs:complexType><xs:sequence>
<xs:any maxOccurs="unbounded" processContents="lax"/>
<!-- CHECK: потребовать, чтобы типы всех элементов структуры удовлетворяли doc:EntryTypeDeclaration -->
</xs:sequence></xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="EntryTypeDeclaration">
<!-- CHECK: Для JournalEntry с заданным EntryType проверять
- Body[@xsi:type == this\EntrySchema]
- Signature/SignerRole == this\SignerRole -->
<xs:annotation><xs:documentation xml:lang="ru">
<term>структурный элемент журнала</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="EntryType" type="doc:EntryType"/>
<xs:element name="EntrySchema" type="base:QNameXML"/>
<xs:element name="SignerRole" type="base:String" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="JournalEntry">
<xs:annotation><xs:documentation xml:lang="ru">
<term>запись в журнале</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="Date" type="base:Date"/>
<xs:element name="EntryID" type="doc:EntryID"/>
<xs:element name="EntryType" type="doc:EntryType"/>
<xs:element name="JournalID" type="doc:DynamicElementID"/>
<xs:element name="DocumentID" type="doc:DocumentTitle"/>
<xs:element name="DocumentHash" type="base:Hash"/>
<xs:element name="PreviousID" type="doc:EntryID" minOccurs="0"/>
<xs:element name="PreviousHash" type="base:Hash" minOccurs="0"/>
<xs:element name="Body" type="base:AnyType"/>
<xs:element name="Signature" type="doc:SignatureProperty" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- ~подписание~ -->
<xs:complexType name="SignatureProperty">
<xs:annotation>
<xs:documentation xml:lang="ru">
<term>реквизит подписи</term>
</xs:documentation>
<xs:appinfo>
<fullRepresentation>{SignatureID}, {SignatureType} {SignerRole}</fullRepresentation>
</xs:appinfo>
</xs:annotation>
<xs:sequence>
<xs:element name="SignatureID" type="doc:SignaruteID"/>
<xs:element name="SignatureType" type="doc:SignatureType" minOccurs="0"/>
<xs:element name="SignerRole" type="base:AnyType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SigningOrder">
<xs:annotation><xs:documentation xml:lang="ru">
<term>порядок подписания</term>
</xs:documentation></xs:annotation>
<xs:choice maxOccurs="unbounded">
<xs:element name="SignatureID" type="doc:SignaruteID" maxOccurs="unbounded"/>
<xs:element name="UnorderedBatch" maxOccurs="unbounded">
<xs:complexType><xs:sequence>
<xs:element name="SignatureID" type="doc:SignaruteID" maxOccurs="unbounded"/>
</xs:sequence></xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="SignatureInfo">
<xs:annotation><xs:documentation xml:lang="ru">
<term>электронная подпись</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="SignatureID" type="doc:SignaruteID"/>
<xs:element name="DateSigned" type="base:Date"/>
<xs:element name="Signer" type="base:AnyType"/>
<xs:element name="RepresentedOrganization" type="base:AnyType" minOccurs="0"/>
<xs:element name="Position" type="base:AnyType" minOccurs="0"/>
<xs:element name="SigningGround" type="doc:Ground" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SignatureRole" type="base:AnyType" minOccurs="0"/>
<xs:element name="Target" type="base:SelectorXML" minOccurs="0" maxOccurs="unbounded">
<xs:annotation><xs:documentation xml:lang="ru">
<term>указание на информацию, за которую отвечает данная подпись</term>
</xs:documentation></xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<!-- ~изменение подписанного документа~ -->
<xs:complexType name="JournalModifications">
<xs:annotation><xs:appinfo>
<parentSchema>doc:JournalDescription</parentSchema>
</xs:appinfo></xs:annotation>
<xs:sequence>
<xs:element name="Strucutre">
<xs:complexType><xs:sequence>
<xs:element name="ModifyDocument">
<xs:complexType><xs:sequence>
<xs:element name="EntryType" fixed="запись в однородном журнале" type="doc:EntryType"/>
<xs:element name="EntrySchema" fixed="doc:ModifyDocument" type="base:QNameXML"/>
</xs:sequence></xs:complexType>
</xs:element>
</xs:sequence></xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ModifyDocument">
<xs:annotation><xs:documentation xml:lang="ru">
<term>внесение изменений в документ</term>
</xs:documentation></xs:annotation>
<xs:complexContent><xs:restriction base="base:AnyType">
<xs:sequence>
<!-- CHECK: если присутствует ID документа, то должен быть и хеш -->
<xs:element name="TargetDocumentID" type="base:String" minOccurs="0"/>
<xs:element name="TargetDocumentHash" type="base:Hash" minOccurs="0"/>
<!-- TODO: определиться на каком слое и в какой форме проводятся изменения в таблице изменений -->
<xs:element name="Modification" type="base:AnyType"/>
<xs:element name="Ground" type="doc:DocumentTitle"/>
<xs:element name="Author" type="base:AnyType"/>
</xs:sequence>
</xs:restriction></xs:complexContent>
</xs:complexType>
<!-- ~общие типы~ -->
<xs:complexType name="Ground">
<xs:annotation><xs:documentation xml:lang="ru">
<term>основание</term>
</xs:documentation></xs:annotation>
<xs:choice maxOccurs="unbounded">
<xs:element name="Document" type="doc:ReferenceDocument"/>
<xs:element name="Attachment" type="doc:ReferenceAttachment"/>
<xs:element name="Internal" type="doc:ReferenceSection"/>
<xs:element name="Custom" type="base:AnyType"/>
</xs:choice>
</xs:complexType>
<xs:simpleType name="ElementType">
<xs:annotation><xs:documentation xml:lang="ru">
<term>тип элемента документирования</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<xs:enumeration value="PrimaryElement">
<xs:annotation><xs:documentation xml:lang="ru">
<prototype>doc:PrimaryElement</prototype>
</xs:documentation></xs:annotation>
</xs:enumeration>
<xs:enumeration value="RecurringElement">
<xs:annotation><xs:documentation xml:lang="ru">
<prototype>doc:RecurringElement</prototype>
</xs:documentation></xs:annotation>
</xs:enumeration>
<xs:enumeration value="DynamicElement">
<xs:annotation><xs:documentation xml:lang="ru">
<prototype>doc:DynamicElement</prototype>
</xs:documentation></xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="PrimaryElement" abstract="true">
<xs:annotation><xs:documentation xml:lang="ru">
<term>элемент содержания, вводимый документом</term>
</xs:documentation></xs:annotation>
<xs:complexContent><xs:extension base="base:DataElement">
<xs:attribute name="elementType" fixed="PrimaryElement" type="doc:ElementType" use="required"/>
</xs:extension></xs:complexContent>
</xs:complexType>
<xs:complexType name="RecurringElement" abstract="true">
<xs:annotation><xs:documentation xml:lang="ru">
<term>заимстовованный элемент содержания, требующий обоснования</term>
</xs:documentation></xs:annotation>
<xs:sequence maxOccurs="unbounded">
<xs:element name="Ground" type="doc:Ground" minOccurs="0" maxOccurs="unbounded"/>
<!-- TODO: найти способ как избавиться от дублирования списка из base:DataElement, сохранив Ground как первый тег -->
<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:sequence>
<!-- CHECK: основание должно присутствовать, но не обязательно первым потомком -->
<xs:attribute name="elementType" fixed="RecurringElement" type="doc:ElementType" use="required"/>
</xs:complexType>
<xs:complexType name="DynamicElement" abstract="true">
<xs:annotation><xs:documentation xml:lang="ru">
<term>динамический элемент содержания</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="DynanicElementID" type="doc:DynamicElementID"/>
<xs:choice>
<xs:element name="Journal" type="doc:JournalDescription"/>
<!-- CHECK: требование к схеме соответствовать элементу Body (т.е. иметь атрибут elementType и соотв. структуру) -->
<xs:element name="ElementSchema" type="base:QNameXML"/>
<xs:element name="Custom" type="base:AnyType"/>
</xs:choice>
</xs:sequence>
<xs:attribute name="elementType" fixed="DynamicElement" type="doc:ElementType" use="required"/>
</xs:complexType>
<xs:complexType name="ReferenceDocument">
<xs:annotation><xs:documentation xml:lang="ru">
<term>отсылка к документу</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="DocumentID" type="doc:DocumentTitle"/>
<xs:element name="DateIssue" type="base:Date" minOccurs="0"/>
<xs:element name="Author" type="base:String" minOccurs="0"/>
<xs:element name="DocumentHash" type="base:Hash" minOccurs="0"/>
<xs:element name="ReferredSection" type="doc:SectionID" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReferredElements" type="base:SelectorXML" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferenceAttachment">
<xs:annotation><xs:documentation xml:lang="ru">
<term>отсылка к приложению</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="AttachmentID" type="doc:AttachmentID"/>
<xs:element name="ReferredSection" type="doc:SectionID" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReferredElements" type="base:SelectorXML" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferenceSection">
<xs:annotation><xs:documentation xml:lang="ru">
<term>отсылка к разделу внутри текущего документа</term>
</xs:documentation></xs:annotation>
<xs:sequence>
<xs:element name="ReferredSection" type="doc:SectionID"/>
<xs:element name="ReferredElements" type="base:SelectorXML" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DataOrDocument">
<xs:annotation><xs:documentation xml:lang="ru">
<term>значение или отсылка к документу</term>
</xs:documentation></xs:annotation>
<xs:choice>
<xs:element name="Data" type="base:DataElement"/>
<xs:element name="Document" type="doc:ReferenceDocument"/>
</xs:choice>
</xs:complexType>
<xs:simpleType name="DocumentTitle">
<xs:annotation><xs:documentation xml:lang="ru">
<term>название документа</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
</xs:simpleType>
<xs:simpleType name="DocumentIndex">
<xs:annotation><xs:documentation xml:lang="ru">
<term>внутренний номер документа</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
</xs:simpleType>
<xs:simpleType name="SectionID">
<xs:annotation><xs:documentation xml:lang="ru">
<term>идентификатор раздела документа</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String" />
</xs:simpleType>
<xs:simpleType name="DynamicElementID">
<xs:annotation><xs:documentation xml:lang="ru">
<term>идентификатор динамического элемента документа</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<xs:pattern value="[0-9a-f]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="AttachmentID">
<xs:annotation><xs:documentation xml:lang="ru">
<term>илентификатор приложения</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String" />
</xs:simpleType>
<xs:simpleType name="EntryID">
<xs:annotation><xs:documentation xml:lang="ru">
<term>идентификатор записи в журнале</term>
</xs:documentation></xs:annotation>
<xs:restriction base="doc:DocumentTitle">
<xs:pattern value="[0-9a-f]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="EntryType">
<xs:annotation><xs:documentation xml:lang="ru">
<term>тип записи в журнале</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
</xs:simpleType>
<xs:simpleType name="SignatureType">
<xs:annotation><xs:documentation xml:lang="ru">
<term>тип подписи</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<xs:enumeration value="Документ целиком"/>
<xs:enumeration value="Без динамических элементов"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SignaruteID">
<xs:annotation><xs:documentation xml:lang="ru">
<term>идентификатор подписи</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String">
<xs:pattern value="[0-9a-f]{2}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SignatureSertificate">
<xs:annotation><xs:documentation xml:lang="ru">
<term>сертификат электронной подписи</term>
</xs:documentation></xs:annotation>
<xs:restriction base="base:String"/>
<!-- TODO: необходимо использовать сложный тип в соответствии с сертификацией подписи -->
</xs:simpleType>
</xs:schema>