added inference information to type conventions
authorStephan Zednik <zednis@rpi.edu>
Mon, 04 Mar 2013 12:39:10 -0700
changeset 5879 c331e747c1e5
parent 5878 38eff31037df
child 5881 5c2721c7a5f1
added inference information to type conventions
xml/prov-xml.html
--- a/xml/prov-xml.html	Mon Mar 04 20:38:37 2013 +0100
+++ b/xml/prov-xml.html	Mon Mar 04 12:39:10 2013 -0700
@@ -1,5 +1,4 @@
-<!DOCTYPE html
->
+<!DOCTYPE html>
 
 <html><head> 
     <title>PROV-XML: The PROV XML Schema</title> 
@@ -78,7 +77,7 @@
 	    
 	    $("pre.prov-attribute").each(function(index) {
 		    $(this)
-		    	.before("<p>The element <code>"+$(this).attr("element")+"</code> is used to represent a PROV attribute and has type "+$(this).attr("schemaType")+".</p>")
+		    	.before("<p>The element <code>"+$(this).attr("element")+"</code> is used to represent a PROV "+$(this).attr("provType")+" attribute and has type "+$(this).attr("schemaType")+".</p>")
 		    	.before("<p>Element definition in XML Schema:</p>")
 	    });
 	    
@@ -362,6 +361,8 @@
 
 <section id="type-conventions">
 <h3>Type Conventions</h3>
+<section id="type-conventions-attributes">
+<h4>PROV Type Attribute</h4>
 <p>The PROV-DM states that type information is described using a the prov:type PROV attribute with and may occur multiple times for a given entity, activity, agent, or relation.</p>
 <p>PROV-XML uses the element <code>prov:type</code> to represent the prov:type PROV attribute.  This element can be use to represent both PROV and non-PROV type information.  The following examples shows type information encoded using the <code>prov:type</code> element.</p>
 <pre class="example" title="type information using prov:type PROV attribute" ignore>
@@ -379,7 +380,11 @@
 
 &lt;/prov:document&gt;
 </pre>
-<p>PROV-XML defines complexTypes to match the PROV defined type values.  These types provide a more native XML representation of PROV types.  The following example is considered equivalent to the previous example because the element <code>prov:plan</code> has type <code>prov:Plan</code>.</p>
+<p>The <code>prov:type</code> element is the only mechanism to explicitly declare multiple types for an instance or declare types that are not derived from the default element type. The <code>prov:type</code> element can be used in conjunction with schema-defined PROV types (see examples 2-5).</p>
+</section> <!-- end type-conventions-attributes -->
+<section id="type-conventions-extension-types">
+<h4>Extension Types</h4>
+<p>PROV-XML defines complexTypes to match the PROV defined type values.  These types provide a more native XML representation of PROV types.  The following example is considered equivalent to the previous example because the element <code>prov:plan</code> has type <code>prov:Plan</code>.  All complexTypes representing a PROV type which is defined as a subclass of another PROV type are defined in PROV-XML as extensions of their parent PROV type's complexType.  For example, <code>prov:Plan</code> is defined as an extension of the complexType <code>prov:Entity</code> and may be referenced by either <code>prov:plan</code> or <code>prov:entity</code>.</p>
 <pre class="example" title="type information using schema defined types" ignore>
 &lt;prov:document
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -394,6 +399,27 @@
 
 &lt;/prov:document&gt;
 </pre>
+<p>When an extended type is used a PROV type attribute relation may be inferred for the current and any parent type of the declared type.</p>
+<p>Stating all type information using the PROV type attribute assists in interoperability with non-PROV-XML encoding of PROV.</p>
+<pre class="example" title="type information using schema defined types - type inferences" ignore>
+&lt;prov:document
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:prov="http://www.w3.org/ns/prov#"
+    xmlns:ex="http://example.com/ns/ex#"
+    xmlns:tr="http://example.com/ns/tr#"&gt;
+
+  &lt;prov:plan prov:id="tr:WD-prov-dm-20111215"&gt;
+    &lt;prov:type xsi:type="xsd:QName"&gt;ex:Workflow&lt;/prov:type&gt;
+    <b>&lt;prov:type&gt;prov:Plan&lt;/prov:type&gt; &lt;!-- inferred --&gt;</b>
+    <b>&lt;prov:type&gt;prov:Entity&lt;/prov:type&gt; &lt;!-- inferred --&gt;</b>
+  &lt;/prov:plan&gt;
+
+&lt;/prov:document&gt;
+</pre>
+</section><!-- end-type-conventions-extension-types -->
+<section id="type-conventions-xsi-type">
+<h4>XSI Type</h4>
 <p>Because the <code>prov:Plan</code> complexType is defined as an extension of the complexType <code>prov:Entity</code>, the following example using <code>xsi:type</code> is valid and considered equivalent to the two previous examples. The attribute <code>xsi:type</code> tells an XML parser the complexType of the element.  The value of <code>xsi:type</code> must be a complexType derived from the default element type.</p>
 <pre class="example" title="type information using xsi:type" ignore>
 &lt;prov:document
@@ -409,8 +435,25 @@
 
 &lt;/prov:document&gt;
 </pre>
-
-<p>The <code>prov:type</code> element is the only mechanism to explicitly declare multiple types for an instance or declare types that are not derived from the default element type. The <code>prov:type</code> element can be used in conjunction with schema-defined PROV types (see examples 2 and 3).</p>
+<p>A PROV type attribute relation may be inferred by the use of the <code>xsi:type</code> XML attribute.</p>
+<pre class="example" title="type information using xsi:type - type inferences" ignore>
+&lt;prov:document
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:prov="http://www.w3.org/ns/prov#"
+    xmlns:ex="http://example.com/ns/ex#"
+    xmlns:tr="http://example.com/ns/tr#"&gt;
+
+  &lt;prov:entity prov:id="tr:WD-prov-dm-20111215" xsi:type="prov:Plan"&gt;
+    &lt;prov:type xsi:type="xsd:QName"&gt;ex:Workflow&lt;/prov:type&gt;
+    <b>&lt;prov:type&gt;prov:Plan&lt;/prov:type&gt; &lt;!-- inferred --&gt;</b>
+    <b>&lt;prov:type&gt;prov:Entity&lt;/prov:type&gt; &lt;!-- inferred --&gt;</b>
+  &lt;/prov:entity&gt;
+
+&lt;/prov:document&gt;
+</pre>
+</section> <!-- end type-conventions-xsi-type -->
+
 </section>
 
 <section id="naming-conventions">
@@ -1987,7 +2030,7 @@
 <section id="element-Label">
 <h5>Label</h5>
 <span class="glossary-ref" data-ref="glossary-label" data-withspan="true"></span>
-<pre class="prov-attribute" element="prov:label" schemaType="prov:InternationalizedString">
+<pre class="prov-attribute" element="prov:label" provType="label" schemaType="prov:InternationalizedString">
 &lt;xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="label" type="prov:InternationalizedString"/&gt;
 </pre>
 <pre class="example" title="prov:label">
@@ -2011,7 +2054,7 @@
 <section id="element-Location">
 <h5>Location</h5>
 <span class="glossary-ref" data-ref="glossary-location" data-withspan="true"></span>
-<pre class="prov-attribute" element="prov:location" schemaType="xs:anySimpleType">
+<pre class="prov-attribute" element="prov:location" provType="location" schemaType="xs:anySimpleType">
 &lt;xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="location" type="xs:anySimpleType"/&gt;
 </pre>
 <pre class="example" title="prov:location">
@@ -2038,7 +2081,7 @@
 <section id="element-Role">
 <h5>Role</h5>
 <span class="glossary-ref" data-ref="glossary-role" data-withspan="true"></span>
-<pre class="prov-attribute" element="prov:role" schemaType="xs:anySimpleType">
+<pre class="prov-attribute" element="prov:role" provType="Role" schemaType="xs:anySimpleType">
 &lt;xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="role" type="xs:anySimpleType"/&gt;
 </pre>
 <pre class="example" title="prov:role">
@@ -2070,7 +2113,7 @@
 <section id="element-Type">
 <h5>Type</h5>
 <span class="glossary-ref" data-ref="glossary-type" data-withspan="true"></span>
-<pre class="prov-attribute" element="prov:type" schemaType="xs:anySimpleType">
+<pre class="prov-attribute" element="prov:type" provType="Type" schemaType="xs:anySimpleType">
 &lt;xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="type" type="xs:anySimpleType"/&gt;
 </pre>
 <pre class="example" title="prov:type">
@@ -2106,7 +2149,7 @@
 <section id="element-Value">
 <h5>Value</h5>
 <span class="glossary-ref" data-ref="glossary-value-attribute" data-withspan="true"></span>
-<pre class="prov-attribute" element="prov:value" schemaType="xs:anySimpleType">
+<pre class="prov-attribute" element="prov:value" provType="Value" schemaType="xs:anySimpleType">
 &lt;xs:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="value" type="xs:anySimpleType"/&gt;
 </pre>
 <pre class="example" title="prov:value">