xml/schema/prov.xsd
author Luc Moreau <l.moreau@ecs.soton.ac.uk>
Wed, 26 Sep 2012 11:33:57 +0100
changeset 4486 f0e8bc2ae457
parent 4476 7c238aba1d07
child 4488 d9863da309f8
permissions -rw-r--r--
issue-515
<?xml version="1.0" encoding="utf-8"?>

<!-- 
     *warning*
     transformation of the opm opmx schema into prov compatible.
     purely tentative at this stage. 

     In PROV-DM, all ids are qualified names, specified as prov:QualifiedName in PROV-N.
     In this schema, all ids are instead defined as xsd:QNames. 


     ISSUES to tackle:
     - How do we support internationalization? 
       There is explicit support for internationalization for label.
       How can we support xml:lang for any string, as per prov-dm?

  -->


<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/"
           xmlns:xml="http://www.w3.org/XML/1998/namespace"
           elementFormDefault="qualified"
           attributeFormDefault="unqualified">



  <xs:import namespace="http://www.w3.org/1999/xhtml/datatypes/" />
  <xs:import namespace="http://www.w3.org/XML/1998/namespace" 
             schemaLocation="http://www.w3.org/2001/xml.xsd"/>

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

  <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:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="location"/>
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

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

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

  <xs:complexType name="WasInformedBy">
    <xs:sequence>
      <xs:element name="informed"  type="prov:ActivityRef"/>
      <xs:element name="informant" type="prov:ActivityRef"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

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

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

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

  <!-- Component 2 -->
  
  <xs:complexType name="WasDerivedFrom">
    <xs:sequence>
      <xs:element name="generatedEntity"  type="prov:EntityRef"/>
      <xs:element name="usedEntity"       type="prov:EntityRef"/>
      <xs:element name="activity"         type="prov:ActivityRef" minOccurs="0"/>
      <xs:element name="generation"       type="prov:GenerationRef" minOccurs="0"/>
      <xs:element name="usage"            type="prov:UsageRef" minOccurs="0"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <!-- Component 3 -->
  
  <xs:complexType name="Agent">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="location"/>
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </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:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </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" minOccurs="0"/>
      <xs:element name="plan"     type="prov:EntityRef" minOccurs="0"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="role"/>
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

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

  <xs:complexType name="WasInfluencedBy">
    <xs:sequence>
      <xs:element name="influencee"     type="prov:AnyRef"/>
      <xs:element name="influencer"     type="prov:AnyRef"/>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="label"/>
        <xs:element name="type"/>
        <xs:any namespace="##other"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <!-- Component 4 -->

  <!-- Component 5 -->

  <xs:complexType name="SpecializationOf">
    <xs:sequence>
      <xs:element name="specificEntity"   type="prov:EntityRef"/>
      <xs:element name="generalEntity"   type="prov:EntityRef"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="AlternateOf">
    <xs:sequence>
      <xs:element name="alternate1"   type="prov:EntityRef"/>
      <xs:element name="alternate2"   type="prov:EntityRef"/>
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="MentionOf">
    <xs:sequence>
      <xs:element name="specificEntity"   type="prov:EntityRef"/>
      <xs:element name="generalEntity"     type="prov:EntityRef"/>
      <xs:element name="bundle"            type="prov:EntityRef"/>
    </xs:sequence>
  </xs:complexType>

  
  <!-- Component 6 -->

  <xs:complexType name="CollectionMemberOf">
    <xs:sequence>
      <xs:element name="collection"          type="prov:EntityRef"/>
      <xs:element name="complete"        type="xs:boolean" minOccurs="0"/>
      <xs:element name="member"          type="prov:EntityRef" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

  <xs:complexType name="InternationalizedString">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute ref="xml:lang" use="optional"/>
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>    


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

       -->
  
  <xs:element name="label"    type="prov:InternationalizedString"/>
  <xs:element name="role"     type="xs:anySimpleType"/>
  <xs:element name="type"     type="xs:anySimpleType"/>
  <xs:element name="location" type="xs:anySimpleType"/>
  <xs:element name="value"    type="xs:anySimpleType"/>

  <!-- See comment in preamble.
       These should be prov:QualifiedName
       but instead are xsd:QName for tools to process them -->

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

  <xs:complexType name="ActivityRef">
    <xs:attribute ref="prov:ref" use="required" />
  </xs:complexType>
  <xs:complexType name="EntityRef">
    <xs:attribute ref="prov:ref" use="required"/>
  </xs:complexType>
  <xs:complexType name="AgentRef">
    <xs:attribute ref="prov:ref" use="required"/>
  </xs:complexType>
  <xs:complexType name="UsageRef">
    <xs:attribute ref="prov:ref" use="required"/>
  </xs:complexType>
  <xs:complexType name="GenerationRef">
    <xs:attribute ref="prov:ref" use="required"/>
  </xs:complexType>
  <xs:complexType name="AnyRef">
    <xs:attribute ref="prov:ref" use="required"/>
  </xs:complexType>

  <xs:group name="documentElements">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="entity"               type="prov:Entity"/>
        <xs:element name="activity"             type="prov:Activity"/>
        <xs:element name="wasGeneratedBy"       type="prov:WasGeneratedBy"/>
        <xs:element name="used"                 type="prov:Used"/>
        <xs:element name="wasInformedBy"        type="prov:WasInformedBy"/>
        <xs:element name="wasStartedBy"         type="prov:WasStartedBy"/>
        <xs:element name="wasEndedBy"           type="prov:WasEndedBy"/>
        <xs:element name="wasInvalidatedBy"     type="prov:WasInvalidatedBy"/>

        <xs:element name="wasDerivedFrom"       type="prov:WasDerivedFrom"/>

        <xs:element name="agent"                type="prov:Agent"/>
        <xs:element name="wasAttributedTo"      type="prov:WasAttributedTo"/>
        <xs:element name="wasAssociatedWith"    type="prov:WasAssociatedWith"/>
        <xs:element name="actedOnBehalfOf"      type="prov:ActedOnBehalfOf"/>
        <xs:element name="wasInfluencedBy"      type="prov:WasInfluencedBy"/>
        
        <xs:element name="specializationOf"     type="prov:SpecializationOf"/>
        <xs:element name="alternateOf"          type="prov:AlternateOf"/>
        <xs:element name="mentionOf"            type="prov:MentionOf"/>

        <xs:element name="collectionMemberOf"   type="prov:CollectionMemberOf"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>

  <xs:element name="document" type="prov:Document" />
  <xs:complexType name="Document">
    <xs:sequence>
      <xs:choice maxOccurs="unbounded">
        <xs:group ref="prov:documentElements"/>
        <xs:element name="bundle" type="prov:Bundle"/>
      </xs:choice>
    </xs:sequence>
  </xs:complexType>
  
  <xs:complexType name="Bundle">
    <xs:sequence>
      <xs:group ref="prov:documentElements"/>
    </xs:sequence>
    <xs:attribute ref="prov:id"/>
  </xs:complexType>

</xs:schema>