Updated examples
authorStian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
Thu, 14 Feb 2013 15:33:04 +0000
changeset 5573 59d3339f4090
parent 5572 cb84fb124fa5
child 5574 23df88c5f810
Updated examples
xml/examples/custom-example.xml
xml/examples/custom.xsd
xml/examples/prov-all.xml
xml/examples/with-extensions.xml
--- a/xml/examples/custom-example.xml	Thu Feb 14 13:43:16 2013 +0000
+++ b/xml/examples/custom-example.xml	Thu Feb 14 15:33:04 2013 +0000
@@ -27,6 +27,9 @@
     <prov:wasAttributedTo>
         <prov:entity prov:ref="e1"></prov:entity>
         <prov:agent prov:ref="ag1" />
+        <custom:customAttribute>
+        	<custom:title>Fails unless custom:title is present</custom:title>
+        </custom:customAttribute>
     </prov:wasAttributedTo>
 
 
--- a/xml/examples/custom.xsd	Thu Feb 14 13:43:16 2013 +0000
+++ b/xml/examples/custom.xsd	Thu Feb 14 15:33:04 2013 +0000
@@ -4,7 +4,7 @@
     elementFormDefault="qualified" xmlns:prov="http://www.w3.org/ns/prov#">
     <xsd:import schemaLocation="../schema/prov.xsd" namespace="http://www.w3.org/ns/prov#"></xsd:import>
     
-    <xsd:element name="usingProv">
+    <xsd:element name="usingProvInside">
         <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="title" />
@@ -14,7 +14,7 @@
         </xsd:complexType>
     </xsd:element>
 
-    <xsd:element name="custom" substitutionGroup="prov:abstractElement">
+    <xsd:element name="customAttribute">
         <xsd:complexType>
             <xsd:sequence>
                 <xsd:element name="title" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xml/examples/prov-all.xml	Thu Feb 14 15:33:04 2013 +0000
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<prov:document xmlns:xml="http://www.w3.org/XML/1998/namespace"
+	xmlns:prov="http://www.w3.org/ns/prov#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xsi:schemaLocation="http://www.w3.org/ns/prov#
+                         ../schema/prov.xsd ">
+<!-- 
+A documenting that is mixing the various extensions included by prov.xsd
+ -->
+
+	<!-- 
+	<prov:label>Not allowed here as there is no xs:element for prov:label </prov:label>
+	 -->
+	
+	<prov:entity prov:id="empty">
+		<prov:label>Hello</prov:label>
+		<prov:type>prov:EmptyCollection</prov:type>
+	</prov:entity>
+	<prov:person>
+		<prov:type>foaf:Person</prov:type>
+		<!--
+		  foaf:name is allowed because of processContent=lax in xsd:any 
+		 -->
+		<foaf:name>Stian Soiland-Reyes</foaf:name>
+		<!--  But prov:activity is not allowed as it's in the prov: namespace		
+		<prov:activity></prov:activity>		
+		 -->
+	</prov:person>
+	
+	<prov:emptyDictionary prov:id="empty" />
+
+	<prov:bundle>
+		<prov:label>a label</prov:label>		
+	</prov:bundle>
+
+	<prov:mentionOf>
+		<prov:specificEntity prov:ref="a" />
+		<prov:generalEntity prov:ref="b" />
+		<prov:bundle prov:ref="c" />
+	</prov:mentionOf>
+
+</prov:document>
\ No newline at end of file
--- a/xml/examples/with-extensions.xml	Thu Feb 14 13:43:16 2013 +0000
+++ b/xml/examples/with-extensions.xml	Thu Feb 14 15:33:04 2013 +0000
@@ -5,12 +5,9 @@
 have been made without any special PROV-XML provisioning. These can be used
 wherever there is a <xsd:any> in the PROV-XML schemas.
 
-Note that (at time of writing) the PROV schema has processContent="strict" on the
-schemas, so therefore elements from  
-
 -
 Stian Soiland-Reyes
-2013-02-08
+2013-02-14
 
 
  -->
@@ -35,22 +32,26 @@
     
     <prov:entity prov:id="someBook">
         <dcterms:title>A title</dcterms:title>
-        <!-- But not valid: -->
-        <!-- 
-          <dcterms:madeup>No declaration for element dcterms:madeup</dcterms:madeup>
-        -->        
+        <!-- Should perhaps not be valid as we have a schema for dcterms namespace,        
+        but unknown elements are allowed by processContent="lax" -->       
+        <dcterms:madeup>Expected 'No declaration for element dcterms:madeup'</dcterms:madeup>
     </prov:entity>
 
     <prov:person prov:id="fred">
-    	<prov:label>Fred</prov:label>
-        <!-- Can't use  <foaf:name>, as there is no XML Schema! :-( -->
+    	<!-- Valid even without a schema because of processContent="lax" -->
+    	<foaf:name>Fred</foaf:name>
 
         <xhtml:p>
-            A <xhtml:strong>nice</xhtml:strong>    person
+            A <xhtml:strong>nice</xhtml:strong> person
         </xhtml:p>
         <!-- 
-        <prov:location>Not allowed AFTER xs:any</prov:location>
+        <prov:location>prov: not allowed AFTER xs:any inside 
+        	prov:entity and friends</prov:location>
          -->
+         
+         <!-- elements in schema will have to validate, though:
+          <xhtml:p><xhtml:p>Can't nest paragraphs!</p></xhtml:p></xhtml:p>
+          -->
     </prov:person>
 
     <!--  An <xs:any> element from a non-PROV schema -->
@@ -78,27 +79,37 @@
             <prov:entity prov:ref="formula"></prov:entity>
             <prov:agent prov:ref="fred"/>
             <dcterms:description>We have to play along with the PROV-XSD
-                schema if we reuse a prov:element inside
+                schema if we reuse a prov:element inside, so the above
+				two elements are required.
             </dcterms:description>
         </prov:wasAttributedTo>
     </mathml:annotation-xml>
 
     <!-- prov:elements also allowed AFTER extensions -->
     
+    <prov:bundleContent prov:id="bundle1">
+    	<!--  Mix and match -->
+        <mathml:mi>a</mathml:mi>
+    	<prov:activity prov:id="bunddleEntity" />
+    	<!--  A nested bundle -->
+        <prov:bundle prov:id="bundle2" />
+        <mathml:mo></mathml:mo>
+    </prov:bundleContent>
+	    
+	<!-- The prov:bundle entity 
+	     -->
     <prov:bundle prov:id="bundle1">
         <prov:label>A bundle</prov:label>
-
-        <!--  Inside a prov:bundle <xs:any> elements must be *before* 
-        the prov:activity, but *after* what prov:Entity allows -->
-        <mathml:mi>a</mathml:mi>
-        
-        <prov:activity prov:id="bunddleEntity">
-        </prov:activity>
-        
-        <!--  Not allowed :-( -->
-        <!-- 
-          <mathml:mo></mathml:mo>
-         -->
+        <mathml:mi>a</mathml:mi>       
     </prov:bundle>
     
+    <!--  Content of nested bundle must be under <prov:document> -->
+    <prov:bundleContent prov:id="bundle2">
+    	<!--  Mix and match -->
+        <mathml:mi>a</mathml:mi>
+    	<prov:activity prov:id="bunddleEntity" />    	
+        <mathml:mo></mathml:mo>
+    </prov:bundleContent>
+    
+    
 </prov:document>