code examples extracted from WD-prov-dm-20111215
authorTim L <lebot@rpi.edu>
Tue, 27 Dec 2011 16:35:59 -0500
changeset 1314 d9c260a1f05d
parent 1313 100ce806e2c7
child 1315 b984f67f3465
code examples extracted from WD-prov-dm-20111215
model/scrape/generated/codeexamples/eg-01-5.2.1-entity-record.txt
model/scrape/generated/codeexamples/eg-02-5.2.2-activity-record.txt
model/scrape/generated/codeexamples/eg-03-5.2.3-agent-record.txt
model/scrape/generated/codeexamples/eg-04-5.2.4-note-record.txt
model/scrape/generated/codeexamples/eg-05-5.3.1.1-generation-record.txt
model/scrape/generated/codeexamples/eg-06-5.3.1.2-usage-record.txt
model/scrape/generated/codeexamples/eg-07-5.3.2.1-activity-association-record.txt
model/scrape/generated/codeexamples/eg-08-5.3.2.2-start-and-end-records.txt
model/scrape/generated/codeexamples/eg-09-5.3.3.1-responsibility-record.txt
model/scrape/generated/codeexamples/eg-10-5.3.3.2-derivation-record.txt
model/scrape/generated/codeexamples/eg-11-5.3.3.2-derivation-record.txt
model/scrape/generated/codeexamples/eg-12-5.3.3.3-complementarity-record.txt
model/scrape/generated/codeexamples/eg-13-5.3.3.3-complementarity-record.txt
model/scrape/generated/codeexamples/eg-14-5.4.1-account-record.txt
model/scrape/generated/codeexamples/eg-15-5.4.1-account-record.txt
model/scrape/generated/codeexamples/eg-16-5.4.1-account-record.txt
model/scrape/generated/codeexamples/eg-17-5.4.1-account-record.txt
model/scrape/generated/codeexamples/eg-18-5.4.2-record-container.txt
model/scrape/generated/codeexamples/eg-19-5.5.1-attribute.txt
model/scrape/generated/codeexamples/eg-20-5.5.1-attribute.txt
model/scrape/generated/codeexamples/eg-21-5.5.3-literal.txt
model/scrape/generated/codeexamples/eg-22-5.5.3-literal.txt
model/scrape/generated/codeexamples/eg-23-6.1-collections.txt
model/scrape/generated/codeexamples/eg-24-6.3-activity-ordering-record.txt
model/scrape/generated/codeexamples/eg-25-6.3-activity-ordering-record.txt
model/scrape/generated/codeexamples/eg-26-6.3-activity-ordering-record.txt
model/scrape/generated/codeexamples/eg-27-6.4-revision-record.txt
model/scrape/readme.txt
model/scrape/used/src/scrape-dm.xsl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-01-5.2.1-entity-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+entity(e0, [ prov:type="File", ex:path="/shared/crime.txt", ex:creator="Alice" ])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-02-5.2.2-activity-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+activity(a1,add-crime-in-london,2011-11-16T16:05:00,2011-11-16T16:06:00,[ex:host="server.example.org",prov:type="ex:edit" %% xsd:QName])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-03-5.2.3-agent-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,6 @@
+
+agent(e1, [ex:employee="1234", ex:name="Alice", prov:type="prov:Person" %% xsd:QName])
+
+entity(e2) and wasStartedBy(a1,e2,[prov:role="author"])
+
+entity(e3) and wasAssociatedWith(a1,e3,[prov:role="sponsor"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-04-5.2.4-note-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+note(ann1,[ex:color="blue", ex:screenX=20, ex:screenY=30])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-05-5.3.1.1-generation-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,3 @@
+
+  wasGeneratedBy(e1,a1, 2001-10-26T21:32:52, [ex:port="p1", ex:order=1])
+  wasGeneratedBy(e2,a1, 2001-10-26T10:00:00, [ex:port="p1", ex:order=2])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-06-5.3.1.2-usage-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,3 @@
+
+  used(a1,e1,2011-11-16T16:00:00,[ex:parameter="p1"])
+  used(a1,e2,2011-11-16T16:00:01,[ex:parameter="p2"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-07-5.3.2.1-activity-association-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,6 @@
+
+activity(a,[prov:type="workflow"])
+agent(ag1,[prov:type="programmer"])
+agent(ag2,[prov:type="researcher"])
+wasAssociatedWith(a,ag1,[prov:role="loggedInUser", ex:how="webapp"])
+wasAssociatedWith(a,ag2,[prov:role="designer", ex:context="phd"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-08-5.3.2.2-start-and-end-records.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,3 @@
+
+wasStartedBy(a,ag,[ex:mode="manual"])
+wasEndedby(a,ag,[ex:mode="manual"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-09-5.3.3.1-responsibility-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,9 @@
+
+activity(a,[prov:type="workflow"])
+agent(ag1,[prov:type="programmer"])
+agent(ag2,[prov:type="researcher"])
+agent(ag3,[prov:type="funder"])
+wasAssociatedWith(a,ag1,[prov:role="loggedInUser"])
+wasAssociatedWith(a,ag2)
+actedOnBehalfOf(ag1,ag2,a,[prov:type="delegation"])
+actedOnBehalfOf(ag2,ag3,a,[prov:type="contract"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-10-5.3.3.2-derivation-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,8 @@
+
+wasDerivedFrom(e5,e3,a4,g2,u2,[])
+wasDerivedFrom(e5,e3,a4,g2,u2,[prov:steps="1"])
+
+wasDerivedFrom(e3,e2,[prov:steps="1"])
+
+wasDerivedFrom(e2,e1,[])
+wasDerivedFrom(e2,e1,[prov:steps="n"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-11-5.3.3.2-derivation-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,4 @@
+
+activity(a,aAttrs)
+wasGeneratedBy(g,e2,a,gAttrs)
+used(u,a,e1,uAttrs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-12-5.3.3.3-complementarity-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,20 @@
+
+entity(rs,[ex:created=1870])
+
+entity(rs_l1,[prov:location="loc2"])
+entity(rs_l2,[prov:location="The Mall"])
+
+entity(rs_m1,[ex:membership=250, ex:year=1900])
+entity(rs_m2,[ex:membership=300, ex:year=1945])
+entity(rs_m3,[ex:membership=270, ex:year=2010])
+
+wasComplementOf(rs_m3, rs_l2)
+wasComplementOf(rs_m2, rs_l1)
+wasComplementOf(rs_m2, rs_l2)
+wasComplementOf(rs_m1, rs_l1)
+
+wasComplementOf(rs_m3, rs)
+wasComplementOf(rs_m2, rs)
+wasComplementOf(rs_m1, rs)
+wasComplementOf(rs_l1, rs)
+wasComplementOf(rs_l2, rs)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-13-5.3.3.3-complementarity-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,19 @@
+
+account(ex:acc1,
+        http://example.org/asserter1, 
+
+    ...
+    entity(rs,[ex:created=1870])
+    ...
+    )
+
+
+account(ex:acc2,
+        http://example.org/asserter2, 
+
+    ...
+    entity(rs_m1,[ex:membership=250, ex:year=1900])
+    ...
+    wasComplementOf(rs_m1, ex:acc2, rs, ex:acc1)
+
+)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-14-5.4.1-account-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,12 @@
+
+account(ex:acc0,
+        http://example.org/asserter, 
+          entity(e0, [ prov:type="File", ex:path="/shared/crime.txt", ex:creator="Alice" ])
+          ...
+          wasDerivedFrom(e2,e1)
+          ...
+          activity(a0,create-file,t)
+          ...
+          wasGeneratedBy(e0,a0,[])     
+          ...
+          wasAssociatedWith(a4, ag5, [prov:role="communicator"])  )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-15-5.4.1-account-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,6 @@
+
+account(ex:acc1,
+        http://example.org/id,
+          entity(e,[prov:type="person", ex:age=20])
+          entity(e,[prov:type="person", ex:age=30])
+          ...)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-16-5.4.1-account-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,9 @@
+
+account(ex:acc2,
+        http://example.org/asserter2, 
+          entity(e0, [ prov:type="File", ex:path="/shared/crime.txt", ex:creator="Alice" ])
+          ...
+          activity(a1,create-file,t1)
+          ...
+          wasGeneratedBy(e0,a1,[ex:fct="create"])     
+          ... )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-17-5.4.1-account-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,12 @@
+
+account(ex:acc3,
+        http://example.org/asserter1, 
+          entity(e0, [ prov:type="File", ex:path="/shared/crime.txt", ex:creator="Alice" ])
+          activity(a0,create-file,t)
+          wasGeneratedBy(e0,a0,[])  
+          account(ex:acc4,
+                  http://example.org/asserter2,
+                    entity(e1, [ prov:type="File", ex:path="/shared/crime.txt", ex:creator="Alice", ex:content="" ])
+                    activity(a0,copy-file,t)
+                    wasGeneratedBy(e1,a0,[ex:fct="create"])
+                    wasComplementOf(e1,e0)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-18-5.4.2-record-container.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,7 @@
+
+container
+  prefix ex: http://example.org/,
+
+  account(ex:acc1,http://example.org/asserter1,...)
+  account(ex:acc2,http://example.org/asserter1,...)
+endContainer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-19-5.5.1-attribute.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+   wasStartedBy(a,ag, [prov:role="program-operator"])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-20-5.5.1-attribute.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+   agent(ag, [prov:type="prov:SoftwareAgent" %% xsd:QName])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-21-5.5.3-literal.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,6 @@
+
+  "abc"
+  "abc" %% xsd:string
+  "1" %% xsd:int
+  1
+  "http://example.org/foo" %% xsd:anyURI
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-22-5.5.3-literal.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,2 @@
+
+  "ex:value" %% xsd:QName
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-23-6.1-collections.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,19 @@
+
+  
+wasAddedTo_Coll(c2,c1)
+  
+wasAddedTo_Key(c2,k1)
+  
+wasAddedTo_Entity(c2,e1)
+
+  
+wasAddedTo_Coll(c3,c2)
+  
+wasAddedTo_Key(c3,k2)
+  
+wasAddedTo_Entity(c3,e2)
+
+  
+wasRemovedFrom_Coll(c4,c3)
+  
+wasRemovedFrom_Key(c4,k1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-24-6.3-activity-ordering-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,3 @@
+
+wasInformedBy(a2,a1)
+wasInformedBy(a3,a2)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-25-6.3-activity-ordering-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,4 @@
+
+activity(a1,workflow,t1,t2,[ex:host="server1.example.org"])
+activity(a2,sub-workflow,t3,t4,[ex:host="server2.example.org"])
+wasStartedBy(a2,a1)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-26-6.3-activity-ordering-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,4 @@
+
+entity(e,[prov:type="creation-request"])
+wasGeneratedBy(e,a1)
+wasStartedBy(a2,e)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/generated/codeexamples/eg-27-6.4-revision-record.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,5 @@
+
+agent(ag,[prov:type="QualityController"])
+entity(e1,[prov:type="document"])
+entity(e2,[prov:type="document"])
+wasRevisionOf(e2,e1,ag)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/readme.txt	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,5 @@
+The code examples in http://www.w3.org/TR/prov-dm/ change regularly enough that it is difficult to determine which need attention for representation in PROV-O.
+
+This directory contains the text of examples scraped from the published HTML document and serves as a source for semi-automated PROV development.
+
+-Tim Lebo, 2011-12-27
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/model/scrape/used/src/scrape-dm.xsl	Tue Dec 27 16:35:59 2011 -0500
@@ -0,0 +1,50 @@
+<!-- Timothy Lebo -->
+<xsl:transform version="2.0" 
+               xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+               xmlns:x="http://www.w3.org/1999/xhtml">
+<xsl:output method="text"/>
+
+<xsl:template match="/">
+   <xsl:apply-templates select="//*[@class='codeexample']"/>
+</xsl:template>
+
+<xsl:template match="*[@class='codeexample']">
+   <xsl:variable name="section">
+      <xsl:for-each select="ancestor::x:div[contains(@class,'section')]">
+         <!-- e.g. 5.2.1 -> '..' -->
+         <xsl:sort select="string-length(replace(descendant::x:span[@class='secno'][1]/text(),'[^\.]',''))" order="descending"/>
+         <!-- e.g. 6.2 over 6. -->
+         <xsl:sort select="string-length(descendant::x:span[@class='secno'][1])" order="descending"/> 
+         <xsl:if test="position() = 1">
+            <number><xsl:value-of select="replace(descendant::x:span[@class='secno'][1],'\. *$','')"/></number>
+            <title><xsl:value-of select="normalize-space(descendant::x:span[@class='secno'][1]/following-sibling::text()[1])"/></title>
+         </xsl:if>
+      </xsl:for-each>
+   </xsl:variable>
+
+   <xsl:variable name="filename" select="concat('generated/codeexamples/eg-',
+                                                if (position() le 9) then '0' else '',position(),'-',
+                                                $section/number,'-',
+                                                replace(lower-case($section/title),' ','-'),
+                                                '.txt')"/>
+   <xsl:value-of select="concat(position(),' ',local-name(.),' ',@class,' ',$section/number,' ',$section/title,$NL,'--',$NL)"/>
+   <xsl:apply-templates select="." mode="text"/>
+   <xsl:result-document href="{$filename}">
+      <xsl:apply-templates select="." mode="text"/>
+   </xsl:result-document>
+   <xsl:value-of select="concat('--',$NL,$NL)"/>
+</xsl:template>
+
+<xsl:template match="@*|node()" mode="text">
+  <xsl:copy>
+		<xsl:copy-of select="@*"/>	
+	  <xsl:apply-templates/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:variable name="NL">
+<xsl:text>
+</xsl:text>
+</xsl:variable>
+
+</xsl:transform>