[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] How to implement validation rules in an environment where some data requirements change frequently while others are unchanging?
- From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
- To: XML-Dev Mailing list <xml-dev@lists.xml.org>
- Date: Mon, 20 Aug 2012 11:05:19 -0400
At 2012-08-20 13:19 +0000, you wrote:
>-----------
>Solution
>-----------
>Schematron schemas can be used for the category "enumeration list
>changes." For example, in the XSD schema declare the <Publisher>
>element of type xs:string" and then in the Schematron schema have
>assertions that specify the list of today's valid publishers.
>
>-------------
>Questions
>-------------
>1. Rick Jelliffe says, "the assertions should be dynamically
>loaded." What does that mean? How does one dynamically load Schematron?
Two passes. See Figure D-2 after scrolling down from:
http://docs.oasis-open.org/ubl/prd2-UBL-2.1/UBL-2.1.html#CODELISTS
(the XSLT is created from Schematron, which is from CVA and genericode)
>2. How would "metadata changes" be implemented? For example, how
>would we add to each <Book> element an indication of whether it is in-stock?
To me that isn't metadata. To me metadata is "data about data" and
isn't really very dynamic but needs to be flexible (the two concepts
are different). To me "in-stock" is simply data related to a
book. It isn't metadata regarding the book, just data regarding the
book. Metadata about the book would be a descriptor type (e.g.
"ISBN") of the book number (e.g. "978-1-894049-24-5"). Without
metadata you wouldn't know which scheme the book number was using to
express its information, so the metadata tells you about the data point.
"In-stock" is simply information. Now, an example of metadata about
"in-stock" would be the unit of measure, distinguishing what the data
"2" means in:
<cbc:Quantity unitCode="T3">2</cbc:Quantity> <!--thousand piece-->
<cbc:Quantity unitCode="DPC">2</cbc:Quantity> <!--dozen piece-->
<cbc:Quantity unitCode="H87">2</cbc:Quantity> <!--single piece-->
... as found in:
http://docs.oasis-open.org/ubl/prd2-UBL-2.1/mod/summary/reports/UBL-AllDocuments-2.1.html#t-CommonLibrary-1754
"The quantity that is currently on stock."
... in the instance as follows:
http://docs.oasis-open.org/ubl/prd2-UBL-2.1/mod/summary/reports/UBL-AllDocuments-2.1.html#Table_StockAvailabilityReport
<StockAvailabilityReport>
<cbc:ID>...</cbc:ID>
<cbc:IssueDate>...</cbc:IssueDate>
<cac:StockAvailabilityReportLine>
<cbc:ID>...</cbc:ID>
<cbc:Quantity>...</cbc:Quantity>
<cac:Item>
<cbc:Name>...</cbc:Name>
The units of measure are documented here for UBL 2.1:
http://docs.oasis-open.org/ubl/prd2-UBL-2.1/cva/UBL-DefaultDTQ-2.1.html#d27e1
Sure Schematron could be used to, say, check limits of "In-stock"
(throw an error, say, when the quantity is less than 100), but,
again, that isn't metadata ... it is just data.
>3. I listed two "Categories of Data that Frequently Change." Are
>there other categories? If yes, would you provide an example please?
I don't think the second pass necessarily applies simply to data that
frequently change, rather, to data that need to be flexible between
different users of the inflexible schemas.
In UBL the schemas are normative, the CVA/genericode files are
not. Users can change their value constraints all they want and
still call their instances "UBL Conformant" because their instances
validate against the XSD schemas.
In the above example, I could insist in my legal trading agreement
with my trading partner that quantities for stocking levels always
use "pieces" so that I can reject an instance using "thousand piece"
or "dozen piece" as units of measure (because, say, my software
doesn't comprehend other units of measure than "piece"). I back that
up by creating a custom subset genericode file where "H87" is the
only allowed unit of measure, and then in my CVA file I constrain the
unitCode= attribute of <cbc:Quantity> when a child of
<cac:StockAvailabilityReportLine> to use that custom one-line code
list. Then my second-pass XSLT validation can reject a document that
violates that data point with invalid (per the trading agreement)
information. And we can exchange agreed-upon genericode and CVA
files as declarative codexes of our trading agreement.
This is what Fraser was talking about regarding contextualizing the
subset code lists. I wouldn't want that same "piece" constraint on
<cbc:Quantity> when used as a child of some other element.
Forgive me for always bringing up UBL examples in my posts, but we
have been all over this stuff for a decade now, making mistakes along
the way and arriving at a point where we think the issues are being
successfully addressed for users.
I hope you still find the comments useful.
. . . . . . . . . . Ken
--
Public XSLT, XSL-FO, UBL and code list classes in Europe -- Oct 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]