prov-constraints: changed style for rules
authorLuc Moreau <l.moreau@ecs.soton.ac.uk>
Thu, 31 May 2012 14:51:05 +0100
changeset 3121 d5ff48cdc773
parent 3120 2a455f987991
child 3122 80b8f377605c
prov-constraints: changed style for rules
model/extra.css
model/prov-constraints.html
--- a/model/extra.css	Thu May 31 11:41:49 2012 +0100
+++ b/model/extra.css	Thu May 31 14:51:05 2012 +0100
@@ -45,22 +45,22 @@
     background: #fff;
 }
 
-.inference[id]::before {
-    content:    "Inference: " attr(id);
-    width:  380px;  /* How can we compute the length of "Constraint: " attr(id) */
-}
+/* .inference[id]::before { */
+/*     content:    "Inference: " attr(id); */
+/*     width:  380px;  /\* How can we compute the length of "Constraint: " attr(id) *\/ */
+/* } */
 
 
-.inference::before {
-    content:    "Inference";
-    display:    block;
-    width:  150px;
-    margin: -1.5em 0 0.5em 0;
-    font-weight:    bold;
-    border: 1px solid #f00;
-    background: #fff;
-    padding:    3px 1em;
-}
+/* .inference::before { */
+/*     content:    "Inference"; */
+/*     display:    block; */
+/*     width:  150px; */
+/*     margin: -1.5em 0 0.5em 0; */
+/*     font-weight:    bold; */
+/*     border: 1px solid #f00; */
+/*     background: #fff; */
+/*     padding:    3px 1em; */
+/* } */
 
 .syntax {
     padding:    1em;
@@ -114,22 +114,22 @@
     background: #fff;
 }
 
-.constraint[id]::before {
-    content:    "Constraint: " attr(id);
-    width:  380px;  /* How can we compute the length of "Constraint: " attr(id) */
-}
+/* .constraint[id]::before { */
+/*     content:    "Constraint: " attr(id); */
+/*     width:  380px;  /\* How can we compute the length of "Constraint: " attr(id) *\/ */
+/* } */
 
 
-.constraint::before {
-    content:    "Constraint";
-    display:    block;
-    width:  150px;
-    margin: -1.5em 0 0.5em 0;
-    font-weight:    bold;
-    border: 1px solid #00f;
-    background: #fff;
-    padding:    3px 1em;
-}
+/* .constraint::before { */
+/*     content:    "Constraint"; */
+/*     display:    block; */
+/*     width:  150px; */
+/*     margin: -1.5em 0 0.5em 0; */
+/*     font-weight:    bold; */
+/*     border: 1px solid #00f; */
+/*     background: #fff; */
+/*     padding:    3px 1em; */
+/* } */
 
 
 
@@ -164,22 +164,22 @@
     background: #fff;
 }
 
-.definition[id]::before {
-    content:    "Definition: " attr(id);
-    width:  380px; 
-}
+/* .definition[id]::before { */
+/*     content:    "Definition: " attr(id); */
+/*     width:  380px;  */
+/* } */
 
 
-.definition::before {
-    content:    "Definition";
-    display:    block;
-    width:  150px;
-    margin: -1.5em 0 0.5em 0;
-    font-weight:    bold;
-    border: 1px solid #000;
-    background: #fff;
-    padding:    3px 1em;
-}
+/* .definition::before { */
+/*     content:    "Definition"; */
+/*     display:    block; */
+/*     width:  150px; */
+/*     margin: -1.5em 0 0.5em 0; */
+/*     font-weight:    bold; */
+/*     border: 1px solid #000; */
+/*     background: #fff; */
+/*     padding:    3px 1em; */
+/* } */
 
 
 .deprecatedconstraint {
@@ -436,3 +436,10 @@
 code {
     color:  black;
 }
+
+.ruleTitle {
+    font-family: sans-serif;
+    font-size: 1.6ex;
+    font-weight: bold;
+}
+
--- a/model/prov-constraints.html	Thu May 31 11:41:49 2012 +0100
+++ b/model/prov-constraints.html	Thu May 31 14:51:05 2012 +0100
@@ -15,12 +15,109 @@
 
     <script src="http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js" class="remove"></script> 
     <script src="http://www.w3.org/2007/OWL/toggles.js" class="remove"></script> 
+    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" class="remove"></script>
 
     <script class="remove"> 
+
+      function updateRules() {
+        var count=1;
+        $('.constraint,.definition,.inference').each(function(index) {
+
+          var myid=$(this).attr('id');
+          var mycount=count++;
+
+          if (myid==undefined) {
+            myid='rule_' + mycount;
+            $(this).attr('id',myid);
+          }
+
+          var myClass=$(this).attr('class');
+
+          var myTitle=capitaliseFirstLetter(myClass) + ' ' + mycount + ' (' + myid + ')';
+          
+          $(this).attr('data-count', mycount)
+                 .attr('data-title',myTitle).prepend($('<div>').addClass('ruleTitle')
+                                                          .append($('<a>').addClass('internalDFN').attr('href','#'+myid).append(myTitle)));
+
+          console.log( "rule for " + myid + " " + mycount);
+
+        });
+      }
+
+          function capitaliseFirstLetter(string)
+          {
+          return string.charAt(0).toUpperCase() + string.slice(1);
+          }
+
+
+      function updateRulesRefs() {
+        $('.anexample-ref').each(function(index) {
+
+          myhref=$(this).attr('href');
+
+          //console.log( "example ref for " + myhref);
+
+          mycount=$(myhref).attr('data-count');
+
+          console.log( "rule ref for " + myhref + " " + mycount);
+
+          $(this).children('span').replaceWith(function(){return $('<span>').append("Example " + mycount)});
+
+        });
+      }
+      function updateExamples() {
+        var count=1;
+        $('.anexample').each(function(index) {
+
+          var myid=$(this).attr('id');
+          var mycount=count++;
+
+          if (myid==undefined) {
+            myid='example_' + mycount;
+            $(this).attr('id',myid);
+          }
+
+          
+          $(this).attr('data-count', mycount).prepend($('<div>').addClass('anexampleTitle')
+                                                          .append($('<a>').addClass('internalDFN').attr('href','#'+myid).append("Example " + mycount)));
+
+          //console.log( "example for " + myid + " " + mycount);
+
+        });
+      }
+
+
+      function updateExamplesRefs() {
+        $('.anexample-ref').each(function(index) {
+
+          myhref=$(this).attr('href');
+
+              //console.log( "example ref for " + myhref);
+
+          mycount=$(myhref).attr('data-count');
+
+              //console.log( "example ref for " + myhref + " " + mycount);
+
+          $(this).children('span').replaceWith(function(){return $('<span>').append("Example " + mycount)});
+
+        });
+      };
+
+
+      $(document).ready(function(){
+        updateRules();
+        updateRulesRefs();
+      });
+</script>
+
+    <script class="remove"> 
+
+
       var addExtraReferences = function() {
           for (var k in extraReferences)
               berjon.biblio[k] = extraReferences[k];
       };
+
       var extraReferences = {
         "CLOCK":
          "Lamport, L. "+
@@ -365,11 +462,12 @@
 
 <p> Inferences have the following general form:</p>
 <div class='inference' id='inference-example'>
+<p>
   <span class='conditional'>IF</span> <span class="name">hyp_1</span> and ... and
 <span class="name">hyp_k</span> <span class='conditional'>THEN</span>
   there exists <span class="name">a_1</span> and ... and <span
   class="name">a_m</span> such that <span
-  class="name">conclusion_1</span> and ... and <span class="name">conclusion_n</span>.
+  class="name">conclusion_1</span> and ... and <span class="name">conclusion_n</span>.</p>
   </div>
  
 <p>
@@ -391,10 +489,11 @@
 <p> Definitions have the following general form:</p>
 
 <div class='definition' id='definition-example'>
+<p>
   <span class="name">defined_exp</span> holds <span class='conditional'>IF AND ONLY IF </span>
   there exists <span class="name">a_1</span>,..., <span
   class="name">a_m</span> such that <span
-  class="name">defining_exp_1</span> and  ... and <span class="name">defining_exp_n</span>.
+  class="name">defining_exp_1</span> and  ... and <span class="name">defining_exp_n</span>.</p>
   </div>
  
   <p>
@@ -421,11 +520,13 @@
 as the existence of an underlying entity generated by one activity and used by the
 other.</p>
 
-<div class='definition' id='wasInformedBy-definition'>Given two activities identified by <span class="name">a1</span> and <span class="name">a2</span>, 
+<div class='definition' id='wasInformedBy-definition'>
+<p>
+Given two activities identified by <span class="name">a1</span> and <span class="name">a2</span>, 
 <span class="name">wasInformedBy(-;a2,a1)</span>
 holds <span class='conditional'>IF AND ONLY IF</span>
  there is an entity  with some identifier <span class="name">e</span>,
-such that <span class="name">wasGeneratedBy(-;e,a1,-,)</span> and <span class="name">used(-;a2,e,-)</span> hold.
+such that <span class="name">wasGeneratedBy(-;e,a1,-,)</span> and <span class="name">used(-;a2,e,-)</span> hold.</p>
 </div>
 
 <p>The relationship <span class="name">wasInformedBy</span> is not
@@ -454,11 +555,12 @@
 <p>Start of <span class="name">a2</span> by activity <span
 class="name">a1</span> is <a title="definition">defined</a> as follows.</p>
 
-<div class='definition' id='wasStartedByActivity-definition'>Given two activities with identifiers <span class="name">a1</span> and <span class="name">a2</span>, 
+<div class='definition' id='wasStartedByActivity-definition'>
+<p>Given two activities with identifiers <span class="name">a1</span> and <span class="name">a2</span>, 
  <span class="name">wasStartedBy(-;a2,e,a1,-)</span>
 holds <span class='conditional'>IF AND ONLY IF</span>
  <span class="name">wasGeneratedBy(-;e,a1,-,-)</span> 
- and <span class="name">wasStartedBy(-;a2,e,-,-)</span> hold.
+ and <span class="name">wasStartedBy(-;a2,e,-,-)</span> hold.</p>
 </div>
 
 
@@ -571,6 +673,7 @@
 and association events are not explicit in the instance, they can
 be inferred.
 <div class='inference' id='attribution-implication'>
+<p>
 <span class='conditional'>IF</span>
 <span class="name">wasAttributedTo(-;e,ag)</span> holds for some identifiers
 <span class="name">e</span> and <span class="name">ag</span>,  
@@ -580,6 +683,7 @@
 wasGeneratedBy(-; e, a, -)
 wasAssociatedWith(-; a, ag, -)
 </pre>
+</p>
 </div>
 
 <p> Delegation relates agents where one agent acts on behalf of
@@ -601,9 +705,9 @@
 by the following inferences:
 
 <div class='inference' id='traceability-inference'>
+<p>
 Given two identifiers <span class="name">e2</span> and  <span class="name">e1</span> for entities, 
-the following statements hold:
-
+the following statements hold:</p>
 <ol> 
 <li><span class='conditional'>IF</span>  <span class="name">wasDerivedFrom(e2,e1,a,g2,u1)</span> holds, for some <span class="name">a</span>, <span class="name">g2</span>, <span
 class="name">u1</span>, <span class='conditional'>THEN</span>  <span class="name">tracedTo(e2,e1)</span> also holds.</li>
@@ -1355,13 +1459,14 @@
 
 
 <div class='constraint' id='derivation-usage-generation-ordering'>
+<p>
       <span class="conditional">IF</span>
 <span class="name">wasDerivedFrom(d;e2,e1,a,g2,u1)</span> 
 <span class="conditional">THEN</span>
 <span class="name">u1</span> 
 <a>precedes</a>
 <span class="name">g2</span>.  
-
+</p>
 </div>
 <hr />
 
@@ -1372,6 +1477,7 @@
 
 <div class='constraint'
   id='derivation-generation-generation-ordering'>
+<p>
  <span class="conditional">IF</span>
 <span class="name">wasDerivedFrom(-;e2,e1,attrs)</span>
   and
@@ -1382,6 +1488,7 @@
 <span class="name">gen1</span> 
 <a>precedes</a>
 <span class="name">gen2</span>.  
+</p>
   </div>
 
 <p>Note that event ordering is between generations of <span class="name">e1</span>