Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have recognized that constraints 4 and 5 can't be translated in xml schema, but I've resolved the remaining questions editing the schema structure and adding some extra constraints. Xml:</p> <pre><code>&lt;workflowManagementSystem xmlns="http://www.example.org/wfInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.example.org/wfInfo wfInfo.xsd "&gt; &lt;workflows&gt; &lt;workflow name="wf1"&gt; &lt;actions&gt; &lt;action name="ac1" role="role1"&gt; &lt;/action&gt; &lt;action name="ac2" role="role2"&gt; &lt;/action&gt; &lt;action name="ac3" role="AddettoVendite" automaticallyInstantiated="true"&gt; &lt;nextAction actionName="ac1"&gt;&lt;/nextAction&gt; &lt;nextAction actionName="ac2"&gt;&lt;/nextAction&gt; &lt;/action&gt; &lt;/actions&gt; &lt;processes&gt; &lt;process startTime="2011-10-13T12:30:00Z"&gt; &lt;actionStatuses&gt; &lt;actionStatus action="ac1" actor="actor3" terminationTime="2011-10-13T12:30:00Z"&gt;&lt;/actionStatus&gt; &lt;actionStatus action="ac3" actor="actor2"&gt;&lt;/actionStatus&gt; &lt;/actionStatuses&gt; &lt;/process&gt; &lt;process startTime="2011-10-13T12:30:00Z"&gt; &lt;actionStatuses&gt; &lt;actionStatus action="ac1" actor="actor1"&gt;&lt;/actionStatus&gt; &lt;/actionStatuses&gt; &lt;/process&gt; &lt;/processes&gt; &lt;/workflow&gt; &lt;workflow name="wf2"&gt; &lt;actions&gt; &lt;action name="ac2" role="role2" automaticallyInstantiated="true"&gt; &lt;nextAction actionName="ac4"&gt;&lt;/nextAction&gt; &lt;/action&gt; &lt;action name="ac4" role="role2" automaticallyInstantiated="false"&gt; &lt;nextAction actionName="ac2"&gt;&lt;/nextAction&gt; &lt;/action&gt; &lt;action name="ac5" role="role1" automaticallyInstantiated="false"&gt; &lt;/action&gt; &lt;/actions&gt; &lt;processes&gt; &lt;/processes&gt; &lt;/workflow&gt; &lt;/workflows&gt; &lt;actors&gt; &lt;actor name="Actor1"&gt; &lt;roles&gt; &lt;role name="Role3"&gt;&lt;/role&gt; &lt;role name="Role4"&gt;&lt;/role&gt; &lt;/roles&gt; &lt;/actor&gt; &lt;actor name="Actor2"&gt; &lt;roles&gt; &lt;role name="Role1"&gt;&lt;/role&gt; &lt;/roles&gt; &lt;/actor&gt; &lt;actor name="Actor3"&gt; &lt;roles&gt; &lt;role name="Role1"&gt;&lt;/role&gt; &lt;role name="Role2"&gt;&lt;/role&gt; &lt;/roles&gt; &lt;/actor&gt; &lt;/actors&gt; &lt;/workflowManagementSystem&gt; </code></pre> <p>And the corresponding schema is:</p> <pre><code>&lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/wfInfo" xmlns:tns="http://www.example.org/wfInfo" elementFormDefault="qualified"&gt; &lt;element name="workflowManagementSystem" type="tns:workflowManagementSystemType"&gt; &lt;!-- CONSTRAINTS --&gt; &lt;key name="workflowKey"&gt; &lt;selector xpath="tns:workflows/tns:workflow"&gt;&lt;/selector&gt; &lt;field xpath="@name"&gt;&lt;/field&gt; &lt;/key&gt; &lt;keyref name="nextProcessRef" refer="tns:workflowKey"&gt; &lt;selector xpath="tns:workflows/tns:workflow/tns:actions/tns:action/tns:nextProcess"&gt; &lt;/selector&gt; &lt;field xpath="@workflowName"&gt;&lt;/field&gt; &lt;/keyref&gt; &lt;key name="actorKey"&gt; &lt;selector xpath="tns:actors/tns:actor"&gt;&lt;/selector&gt; &lt;field xpath="@name"&gt;&lt;/field&gt; &lt;/key&gt; &lt;keyref name="actorRef" refer="tns:actorKey"&gt; &lt;selector xpath="tns:workflows/tns:workflow/tns:processes/tns:process/tns:actionStatuses/tns:actionStatus"&gt; &lt;/selector&gt; &lt;field xpath="@actor"&gt;&lt;/field&gt; &lt;/keyref&gt; &lt;/element&gt; &lt;!-- ROOT --&gt; &lt;complexType name="workflowManagementSystemType"&gt; &lt;all&gt; &lt;!-- WORKFLOWS --&gt; &lt;element name="workflows" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="workflow" type="tns:workflowType" maxOccurs="unbounded" minOccurs="0"&gt; &lt;!-- CONSTRAINTS --&gt; &lt;key name="actionKey"&gt; &lt;selector xpath="tns:actions/tns:action"&gt;&lt;/selector&gt; &lt;field xpath="@name"&gt;&lt;/field&gt; &lt;/key&gt; &lt;keyref name="nextActionRef" refer="tns:actionKey"&gt; &lt;selector xpath="tns:actions/tns:action/tns:nextAction"&gt;&lt;/selector&gt; &lt;field xpath="@actionName"&gt;&lt;/field&gt; &lt;/keyref&gt; &lt;keyref name="actionRef" refer="tns:actionKey"&gt; &lt;selector xpath="tns:processes/tns:process/tns:actionStatuses/tns:actionStatus"&gt;&lt;/selector&gt; &lt;field xpath="@action"&gt;&lt;/field&gt; &lt;/keyref&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;!-- ACTORS --&gt; &lt;element name="actors" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="actor" type="tns:actorType" maxOccurs="unbounded" minOccurs="0"&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;/all&gt; &lt;/complexType&gt; &lt;!-- WORKFLOW --&gt; &lt;complexType name="workflowType"&gt; &lt;all&gt; &lt;!-- ACTIONS --&gt; &lt;element name="actions" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="action" type="tns:actionType" maxOccurs="unbounded" minOccurs="0"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;!-- PROCESSES --&gt; &lt;element name="processes" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="process" type="tns:processType" maxOccurs="unbounded" minOccurs="0"&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;/all&gt; &lt;attribute name="name" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;!-- PROCESS --&gt; &lt;complexType name="processType"&gt; &lt;sequence&gt; &lt;!-- ACTIONSTATUSES --&gt; &lt;element name="actionStatuses" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="actionStatus" type="tns:actionStatusType" maxOccurs="unbounded" minOccurs="0"&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;attribute name="startTime" type="dateTime" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;!-- ACTION --&gt; &lt;complexType name="actionType"&gt; &lt;choice&gt; &lt;element name="nextAction" maxOccurs="unbounded" minOccurs="0"&gt; &lt;complexType&gt; &lt;attribute name="actionName" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;element name="nextProcess" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;attribute name="workflowName" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;/choice&gt; &lt;attribute name="name" type="string" use="required"&gt;&lt;/attribute&gt; &lt;attribute name="automaticallyInstantiated" type="boolean" use="required"&gt; &lt;/attribute&gt; &lt;attribute name="role" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;!-- ACTIONSTATUS --&gt; &lt;complexType name="actionStatusType"&gt; &lt;attribute name="action" type="string" use="required"&gt;&lt;/attribute&gt; &lt;attribute name="actor" type="string" use="optional"&gt;&lt;/attribute&gt; &lt;attribute name="terminationTime" type="dateTime" use="optional"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;!-- ACTOR --&gt; &lt;complexType name="actorType"&gt; &lt;sequence&gt; &lt;element name="roles" maxOccurs="1" minOccurs="1"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="role" type="tns:roleType" maxOccurs="unbounded" minOccurs="1"&gt;&lt;/element&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;!-- CONSTRAINTS --&gt; &lt;unique name="actorRoleUnique"&gt; &lt;selector xpath="tns:role"&gt;&lt;/selector&gt; &lt;field xpath="@name"&gt;&lt;/field&gt; &lt;/unique&gt; &lt;/element&gt; &lt;/sequence&gt; &lt;attribute name="name" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;complexType name="roleType"&gt; &lt;attribute name="name" type="string" use="required"&gt;&lt;/attribute&gt; &lt;/complexType&gt; &lt;/schema&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload