Examples of extensions/xs:any use
authorStian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
Fri, 08 Feb 2013 16:54:56 +0000
changeset 5515 849b9479d525
parent 5512 4fe185da9faa
child 5516 fbd89df0acb1
Examples of extensions/xs:any use
xml/examples/custom-example.xml
xml/examples/custom.xsd
xml/examples/with-extensions.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xml/examples/custom-example.xml	Fri Feb 08 16:54:56 2013 +0000
@@ -0,0 +1,33 @@
+<?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:custom="http://www.example.org/custom"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="
+	http://www.w3.org/ns/prov#
+		../schema/prov.xsd 
+	http://www.example.org/custom
+		custom.xsd">
+	<prov:person prov:id="fred">
+	</prov:person>
+
+	<custom:custom>
+		<custom:title>Not in substitution group</custom:title>
+	</custom:custom>
+
+	<custom:usingProv>
+		<custom:title>In substitution group</custom:title>
+		<prov:wasDerivedFrom>
+			<prov:generatedEntity prov:ref="e2"/>
+			<prov:usedEntity prov:ref="e1"/>
+		</prov:wasDerivedFrom>
+		<prov:activity prov:id="a1">
+		</prov:activity>
+	</custom:usingProv>
+
+	<prov:wasAttributedTo>
+		<prov:entity prov:ref="e1"></prov:entity>
+		<prov:agent prov:ref="ag1" />
+	</prov:wasAttributedTo>
+
+
+</prov:document>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xml/examples/custom.xsd	Fri Feb 08 16:54:56 2013 +0000
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://www.example.org/custom" xmlns:tns="http://www.example.org/custom"
+	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:complexType>
+			<xsd:sequence>
+				<xsd:element name="title" />
+				<xsd:element ref="prov:wasDerivedFrom" />
+				<xsd:element ref="prov:activity" />
+			</xsd:sequence>
+		</xsd:complexType>
+	</xsd:element>
+
+	<xsd:element name="custom" substitutionGroup="prov:abstractElement">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="title" />
+			</xsd:sequence>
+		</xsd:complexType>
+	</xsd:element>
+	
+</xsd:schema>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xml/examples/with-extensions.xml	Fri Feb 08 16:54:56 2013 +0000
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- 
+
+This is an example showing a mixture of PROV-XML and other XML schemas which 
+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
+
+
+ -->
+<prov:document 
+	xmlns:xml="http://www.w3.org/XML/1998/namespace"
+	xmlns:prov="http://www.w3.org/ns/prov#"
+	xmlns:dcterms="http://purl.org/dc/terms/"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xmlns:mathml="http://www.w3.org/1998/Math/MathML"
+	xmlns:xhtml="http://www.w3.org/1999/xhtml"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+
+	xsi:schemaLocation="http://www.w3.org/ns/prov#
+						 ../schema/prov.xsd 
+	http://www.w3.org/1999/xhtml
+                         http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd
+	http://www.w3.org/1998/Math/MathML
+						 http://www.w3.org/Math/XMLSchema/mathml3/mathml3.xsd
+	http://purl.org/dc/terms/
+						 http://dublincore.org/schemas/xmls/qdc/2008/02/11/dcterms.xsd">
+	
+	
+	<prov:entity prov:id="someBook">
+		<dcterms:title>A title</dcterms:title>
+		<!-- But not valid: -->
+		<!-- 
+		  <dcterms:madeup>No declaration for element dcterms:madeup</dcterms:madeup>
+		-->		
+	</prov:entity>
+
+	<prov:person prov:id="fred">
+		<!-- Can't use FOAF, as there is no XML Schema! :-( -->
+		<!-- 
+		  <foaf:name>Fred</foaf:name> 
+		-->
+
+		<xhtml:p>
+			A <xhtml:strong>nice</xhtml:strong>	person
+		</xhtml:p>
+	</prov:person>
+
+	<!--  An <xs:any> element from a non-PROV schema -->
+	<mathml:annotation-xml prov:id="formula"
+		xmlns="http://www.w3.org/1998/Math/MathML">
+		<mrow>
+			<msup>
+				<mfenced>
+					<mrow>
+						<mi>a</mi>
+						<mo>+</mo>
+						<mi>b</mi>
+					</mrow>
+				</mfenced>
+				<mn>2</mn>
+			</msup>
+		</mrow>
+
+		<!-- arbitrary nesting allowed back to prov because
+		of xs:any in mathml. Note that this prov:wasAttributedTo
+		should NOT be picked up by a PROV-XML-only parser, at least
+		not as a part of the <prov:document>.
+		 -->
+		<prov:wasAttributedTo>
+			<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
+			</dcterms:description>
+		</prov:wasAttributedTo>
+	</mathml:annotation-xml>
+
+	<!-- prov:elements also allowed AFTER extensions -->
+	
+	<prov:bundle prov:id="bundle1">
+		
+		<!--  Inside a prov:bundle <xs:any> must be *before* 
+		the prov:entity -->
+		
+		<mathml:mi>a</mathml:mi>
+		
+		<prov:entity prov:id="bunddleEntity">
+		</prov:entity>
+		
+		<!--  Not allowed :-( -->
+		<!-- 
+		  <mathml:mo></mathml:mo>
+		 -->
+	</prov:bundle>
+	
+</prov:document>