Progress on well-formed tests, not done yet
authorDave Reynolds <dave@epimorphics.com>
Mon, 04 Mar 2013 18:21:32 +0000
changeset 335 1056da1e530b
parent 334 fed08911c41c
child 336 b4ffa5812d09
Progress on well-formed tests, not done yet
data-cube/index.html
respec/gld-bib.js
--- a/data-cube/index.html	Mon Mar 04 13:13:08 2013 +0000
+++ b/data-cube/index.html	Mon Mar 04 18:21:32 2013 +0000
@@ -20,7 +20,7 @@
 dl.vocab_reference dt { margin-top: 1em; }
 .bordered-table { border: black 1px solid;}
 .bordered-table th { border-bottom: black 1px solid;}
-.bordered-table td { padding-right: 1em;}
+.bordered-table td { padding-right: 1em; background: #fcfaee }
 
   </style>
 </head>
@@ -333,14 +333,12 @@
 <section id="conformance">
 <h2>Conformance</h2>
 
-@@TODO improve references to WF section
-
 <p>A data interchange, however that interchange occurs, is conformant
   with Data Cube if:
 <ul>
 <li>it uses terms (classes and properties) from Data Cube in a way consistent with
   their semantics as declared in this specification, in particular the exchanged RDF graphs constitute
-  either <em><a href="wf">well-formed</a></em> or <em><a href="wf">well-formed abbreviated</a></em> Data Cubes;</li>
+  either <em><a>well-formed</a></em> or <em><a>well-formed abbreviated</a></em> Data Cubes;</li>
 <li>it does <strong>not</strong> use terms from other vocabularies <strong>instead</strong> of ones defined
  in this vocabulary that could reasonably be used (use of such
  terms <strong>in addition</strong> to Data Cube terms is permissible).</li>
@@ -1507,7 +1505,7 @@
 <p>We define these notions by means of a transformation algorithm
   which can normalize an abbreviated Data Cube to a flattened
   representation. We express this transformation using the SPARQL 1.1
-  Update language [[!RDF-SPARQL-UPDATE]]. Use of this notation does not imply that
+  Update language [[!SPARQL-UPDATE-11]]. Use of this notation does not imply that
   the transformation must be implemented this way. Information
   exchanges using Data Cube may retain data in abbreviated form and
   use other techniques such as query rewriting to ease access, may
@@ -1620,6 +1618,18 @@
            qb:observation ?obs .
 };
 
+# Dimension values on slices
+INSERT {
+    ?obs  ?comp ?value
+} WHERE {
+    ?spec    qb:componentProperty ?comp .
+    ?comp a  qb:DimensionProperty .
+    ?dataset qb:structure [qb:component ?spec];
+             qb:slice ?slice .
+    ?slice ?comp ?value;
+           qb:observation ?obs .
+};
+
 # Measure property attachments
 INSERT {
     ?obs  ?comp ?value
@@ -1643,12 +1653,82 @@
 </section>
 
 <section id="wf">
-<h2>Validating well-formed cubes</h2>
+<h2>Well-formed cubes</h2>
 
-<p>@@TODO</p>
+<p>An instance of an RDF Data Cube should conform to a set of
+  integrity constraints which we define in this section.</p>
 
-Check list
-   - componentRequired only applied to attributes
+<p>A <dfn>well-formed</dfn> RDF Data Cube is an a RDF graph describing
+  one or more instances of <code><a>qb:DataSet</a></code> for which
+  each of the integrity checks defined here passes.</p>
+
+<p>A <dfn>well-formed abbreviated</dfn> RDF Data Cube is an a RDF
+  graph which, when expanded using
+  the <a href="#normalize-algorithm">normalization algorithm</a>
+yields a <a>well-formed RDF Data Cube</a>.</p>
+
+<section id="wf-rules">
+<h3>Integrity constraints</h3>
+
+<p>Each integrity constraint is expressed as narrative prose and, where possible, a SPARQL
+  [[!SPARQL-QUERY-11]] ASK query which will return <em>true</em>
+  if the constraint has been violated. Using SPARQL queries to
+  define the integrity constraints does not imply that integrity
+  checking must be performed this way. Implementations are free
+  to use alternative query formulations or alternative implementation
+  techniques to perform equivalent checks. For example the queries given
+  here may not be practically scalable to large cubes.</p>
+
+<p>The complete set of constraints is listed below.</p>
+
+<table id="ic-0" class="bordered-table">
+  <thead>
+    <tr>
+      <th>IC-0</th>
+      <th>Datatype consistency</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr><td colspan="2">
+The RDF graph must be consistent under RDF D-entailment [[!RDF-MT]]
+using a datatype map containing all the datatypes used within the graph.
+    </td></tr>
+  </tbody>
+</table>
+
+</section>
+<pre>
+
+1. Every Observation has a unique associated DataSet
+
+2. Every DataSet has a unique associated DataStructureDefinition
+3. Every DSD must include a measure
+4. Every Dimension must have a declared range
+5. Every Dimension with range skos:concept must have a codeList
+6. Only attributes may be marked optional
+
+7. Every SliceKey must be associated with a DataStructureDefinition
+8. SliceKey components must be subset of the DSD's component
+9. Every Slice must have exactly one sliceStructure
+
+10. Every Slice must have a value for every dimension in its sliceStructure
+
+11. Every observation has a value for each declared dimension
+12. No two observations in the same cube may have the same value for all dimensions
+13. Every observation has a value for each non-optional attribute
+14. Every observation in a non-measureType cube must have a value for every measure
+15. Every observation in a measureType cube must have a value for only one measure
+16. In a measureType cube if there is an observation for one measure, there must be a corresponding observation for all other measures at the same dimension values
+
+17. if A qb:slice B and B qb:observation C then C qb:dataSet A
+
+18. If a dimension property has a qb:codeList, then the value of the dimension property on every observation must be in the code list
+
+19. If a dimension property has a hierarchical code list with a parentChildProperty then the value of that dimension property on every observation must be reachable from a root of hierarchy using zero or more hops along the parentChildProperty links.
+20. If a dimension property has a hierarchical code list with an inverse parentChildProperty then the value of that dimension property on every observation must be reachable from a root of hierarchy using zero or more hops along the inverse parentChildProperty links.
+
+</pre>
+
 </section>
 
 <section id="vocab-reference">
--- a/respec/gld-bib.js	Mon Mar 04 13:13:08 2013 +0000
+++ b/respec/gld-bib.js	Mon Mar 04 18:21:32 2013 +0000
@@ -20,6 +20,29 @@
         "publisher": "W3C"
     },
     "SDMX20": "SDMX Information Model: UML Conceptual Design (Version 2.0), November 2005, Statistical Data and Metadata Exchange Initiative. URL: <a href=\"http://sdmx.org/docs/2_0/SDMX_2_0%20SECTION_02_InformationModel.pdf\">http://sdmx.org/docs/2_0/SDMX_2_0%20SECTION_02_InformationModel.pdf</a>",
+    "SPARQL-QUERY-11": {
+        "authors": [
+	    "Steve Harris",
+            "Andy Seaborne"
+        ],
+        "href": "http://www.w3.org/TR/2012/PR-sparql11-query-20121108/",
+        "title": "SPARQL 1.1 Query Language",
+        "date": "8 November 2012",
+        "status": "W3C Proposed Recommendation",
+        "publisher": "W3C"
+    },
+    "SPARQL-UPDATE-11": {
+        "authors": [
+            "Paul Gearon",
+	    "Alexandre Passant",
+ 	    "Axel Polleres"
+        ],
+        "href": "http://www.w3.org/TR/2012/PR-sparql11-update-20121108/",
+        "title": "SPARQL 1.1 Update",
+        "date": "W3C Proposed Recommendation",
+        "status": "8 November 2012",
+        "publisher": "W3C"
+    }
 
 }