xml/experimental/extensions/prov.xsd
author Stian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
Thu, 06 Dec 2012 16:51:27 +0000
changeset 5310 6113b10ac714
parent 5309 60d1dbc7145e
permissions -rw-r--r--
xsd:any switched for prov:extraRecord
<?xml version="1.0" encoding="utf-8"?>

<!-- work in progress.

     In this schema, all ids are encoded as QNames. 

     Instead, a more permissive definition should be used such as CURIEs.

     Note that typical implementations won't recognize CURIEs :-(

  -->


<xs:schema targetNamespace="http://www.w3.org/ns/prov#"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:prov="http://www.w3.org/ns/prov#"
           xmlns:cu="http://www.w3.org/1999/xhtml/datatypes/"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">



<!-- CURIEs  <xs:import namespace="http://www.w3.org/1999/xhtml/datatypes/" />  -->


  <!-- Component 1 -->
  
  <xs:element name="entity" type="prov:Entity"/>
  <xs:complexType name="Entity">
    <xs:sequence>
      <xs:element ref="prov:label" minOccurs="0"/> 
      <xs:element ref="prov:type"  minOccurs="0" maxOccurs="unbounded"/>
 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>  

  <xs:element name="activity" type="prov:Activity"/>
  <xs:complexType name="Activity">
    <xs:sequence>
      <xs:element name="startTime"    type="xs:dateTime" minOccurs="0"/> 
      <xs:element name="endTime"      type="xs:dateTime" minOccurs="0"/> 
      <xs:element ref="prov:label" minOccurs="0"/> 
      <xs:element ref="prov:type"  minOccurs="0" maxOccurs="unbounded"/> 
      
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>
  

  <xs:complexType name="Used">
    <xs:sequence>
      <xs:element name="time"     type="xs:dateTime" minOccurs="0"/>
      <xs:element name="activity" type="prov:ActivityRef"/>
      <xs:element name="entity"   type="prov:EntityRef"/>
      <xs:element ref="prov:type"  minOccurs="0" maxOccurs="unbounded"/>

      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>
  
  <xs:complexType name="WasGeneratedBy">
    <xs:sequence>
      <xs:element name="time"     type="xs:dateTime" minOccurs="0"/>
      <xs:element name="entity"   type="prov:EntityRef"/>
      <xs:element name="activity" type="prov:ActivityRef" minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasStartedBy">
    <xs:sequence>
      <xs:element name="time"     type="xs:dateTime" minOccurs="0"/>
      <xs:element name="activity" type="prov:ActivityRef"/>
      <xs:element name="trigger"  type="prov:EntityRef"  minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasEndedBy">
    <xs:sequence>
      <xs:element name="time"     type="xs:dateTime" minOccurs="0"/>
      <xs:element name="activity" type="prov:ActivityRef"/>
      <xs:element name="trigger"  type="prov:EntityRef"  minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasInformedBy">
    <xs:sequence>
      <xs:element name="time"    type="xs:dateTime" minOccurs="0"/>
      <xs:element name="effect"  type="prov:ActivityRef"/>
      <xs:element name="cause"   type="prov:ActivityRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role" minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasStartedByActivity">
    <xs:sequence>
      <xs:element name="started" type="prov:ActivityRef"/>
      <xs:element name="starter" type="prov:ActivityRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>


  <!-- Component 2 -->
  
  <xs:element name="agent" type="prov:Agent"/>
  <xs:complexType name="Agent">
    <xs:sequence>
      <xs:element ref="prov:label" minOccurs="0"/> 
      <xs:element ref="prov:type"  minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasAssociatedWith">
    <xs:sequence>
      <xs:element name="activity" type="prov:ActivityRef"/>
      <xs:element name="agent"    type="prov:AgentRef"/>
      <xs:element name="plan"     type="prov:EntityRef" minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>


  <xs:complexType name="WasAttributedTo">
    <xs:sequence>
      <xs:element name="entity" type="prov:EntityRef"/>
      <xs:element name="agent"    type="prov:AgentRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"  minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="ActedOnBehalfOf">
    <xs:sequence>
      <xs:element name="subordinate" type="prov:AgentRef"/>
      <xs:element name="responsible" type="prov:AgentRef"/>
      <xs:element name="activity"    type="prov:ActivityRef"/>
      <xs:element ref="prov:type"   minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role"   minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other"   minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>


  <!-- Component 3 -->

  
  <xs:complexType name="WasDerivedFrom">
    <xs:sequence>
      <xs:element name="generation"       type="prov:DependencyRef" minOccurs="0"/>
      <xs:element name="usage"            type="prov:DependencyRef" minOccurs="0"/>
      <xs:element name="activity"         type="prov:ActivityRef" minOccurs="0"/>
      <xs:element name="generatedEntity"  type="prov:EntityRef"/>
      <xs:element name="usedEntity"       type="prov:EntityRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:role" minOccurs="0" maxOccurs="unbounded"/> 
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasRevisionOf">
    <xs:sequence>
      <xs:element name="newer"           type="prov:EntityRef"/>
      <xs:element name="older"           type="prov:EntityRef"/>
      <xs:element name="responsibility"  type="prov:AgentRef" minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="WasQuotedFrom">
    <xs:sequence>
      <xs:element name="quote"        type="prov:EntityRef"/>
      <xs:element name="original"     type="prov:EntityRef"/>
      <xs:element name="quoterAgent"  type="prov:AgentRef" minOccurs="0"/>
      <xs:element name="quotedAgent"  type="prov:AgentRef" minOccurs="0"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="HadOriginalSource">
    <xs:sequence>
      <xs:element name="derived"     type="prov:EntityRef"/>
      <xs:element name="source"      type="prov:EntityRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="TracedTo">
    <xs:sequence>
      <xs:element name="entity"      type="prov:EntityRef"/>
      <xs:element name="ancestor"    type="prov:EntityRef"/>
      <xs:element ref="prov:type" minOccurs="0" maxOccurs="unbounded"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <!-- Component 4 -->

  <xs:complexType name="AlternateOf">
    <xs:sequence>
      <xs:element name="entity2"   type="prov:EntityRef"/>
      <xs:element name="entity1"   type="prov:EntityRef"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="SpecializationOf">
    <xs:sequence>
      <xs:element name="specializedEntity"   type="prov:EntityRef"/>
      <xs:element name="generalEntity"   type="prov:EntityRef"/>
    </xs:sequence>
  </xs:complexType>
  
  <!-- Component 5 -->


  <!-- Component 6 -->
  
  <xs:element name="note" type="prov:Note"/>
  <xs:complexType name="Note">
    <xs:sequence>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>
  
  <xs:complexType name="HasAnnotation">
    <xs:sequence>
      <xs:element name="thing"   type="prov:NoteRef" minOccurs="1"/> <!-- note, just a ref to anything, really -->
      <xs:element name="note"    type="prov:NoteRef" minOccurs="1"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

   <!--
       Typed literals are encoded by means
       of xsi:type that represent the prov:datatype.

       -->
  
  <xs:element name="label" type="xs:string"/>
  <xs:element name="role"  type="xs:anySimpleType"/>
  <xs:element name="type"  type="xs:anySimpleType"/>

  <xs:attribute name="id"  type="xs:QName"/>
  <xs:attribute name="ref" type="xs:QName"/>

  <xs:complexType name="ActivityRef">
    <xs:attribute ref="prov:ref"/>
  </xs:complexType>
  <xs:complexType name="EntityRef">
    <xs:attribute ref="prov:ref"/>
  </xs:complexType>
  <xs:complexType name="AgentRef">
    <xs:attribute ref="prov:ref"/>
  </xs:complexType>
  
  <xs:complexType name="DependencyRef">
    <xs:attribute ref="prov:ref"/>
  </xs:complexType>
  
  <xs:complexType name="NoteRef">
    <xs:attribute ref="prov:ref"/>
  </xs:complexType>
  
  <xs:complexType name="Dependencies">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">

            <xs:element name="used"                 type="prov:Used"/>
            <xs:element name="wasGeneratedBy"       type="prov:WasGeneratedBy"/>
            <xs:element name="wasStartedBy"         type="prov:WasStartedBy"/>
            <xs:element name="wasEndedBy"           type="prov:WasEndedBy"/>
            <xs:element name="wasInformedBy"        type="prov:WasInformedBy"/>
            <xs:element name="wasStartedByActivity" type="prov:WasStartedByActivity"/>

            <xs:element name="wasAttributedTo"      type="prov:WasAttributedTo"/>
            <xs:element name="wasAssociatedWith"    type="prov:WasAssociatedWith"/>
            <xs:element name="actedOnBehalfOf"      type="prov:ActedOnBehalfOf"/>

            <xs:element name="wasDerivedFrom"       type="prov:WasDerivedFrom"/>
            <xs:element name="wasRevisionOf"        type="prov:WasRevisionOf"/>
            <xs:element name="wasQuotedFrom"        type="prov:WasQuotedFrom"/>
            <xs:element name="hadOriginalSource"    type="prov:HadOriginalSource"/>
            <xs:element name="tracedTo"             type="prov:TracedTo"/>

            <xs:element name="alternateOf"          type="prov:AlternateOf"/>
            <xs:element name="specializationOf"     type="prov:SpecializationOf"/>

            <xs:element name="hasAnnotation"        type="prov:HasAnnotation"/>
      </xs:choice>
      <xs:element ref="prov:extraDependency" minOccurs="0" maxOccurs="unbounded" />
      
    </xs:sequence>
  </xs:complexType>
  
  <xs:element name="extraDependency" abstract="true" />
  <xs:element name="extraRecord" abstract="true" />
  
  <!-- BUNDLES -->
  
  <xs:element name="account" type="prov:Account"/>
  <xs:complexType name="Account">
    <xs:sequence>
      <xs:element name="asserter" type="prov:AgentRef"  minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:records"  minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>
  
  <xs:element name="container" type="prov:Container">
    <xs:annotation>
      <xs:documentation>A set of assertions about the provenance of things</xs:documentation>
    </xs:annotation>
  </xs:element>
  
  <!-- a wrapper element for all records, used in Container or Account -->
  <xs:element name="records" type="prov:Records"/>
  <xs:complexType name="Records">
    <xs:sequence>
      <xs:element ref="prov:account"  minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:activity" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:entity"   minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:agent"    minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="prov:note"     minOccurs="0" maxOccurs="unbounded"/>
      <xs:element name="dependencies" type="prov:Dependencies" minOccurs="0"/>
      <xs:element ref="prov:extraRecord" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>
  
  <xs:complexType name="Container">
    <xs:sequence>
      <xs:element ref="prov:records"  minOccurs="1" maxOccurs="1"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
    <!-- tentative, this could allow us to annotate containers ... -->
  </xs:complexType>
  
  
  
  
  
  
  
  
  
</xs:schema>