lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5552] Validate input sequences


From: Greg Chicares
Subject: [lmi-commits] [5552] Validate input sequences
Date: Mon, 27 Aug 2012 14:33:29 +0000

Revision: 5552
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5552
Author:   chicares
Date:     2012-08-27 14:33:28 +0000 (Mon, 27 Aug 2012)
Log Message:
-----------
Validate input sequences

Modified Paths:
--------------
    lmi/trunk/cell.xsd
    lmi/trunk/types.rnc
    lmi/trunk/types.xsd

Modified: lmi/trunk/cell.xsd
===================================================================
--- lmi/trunk/cell.xsd  2012-08-27 10:41:19 UTC (rev 5551)
+++ lmi/trunk/cell.xsd  2012-08-27 14:33:28 UTC (rev 5552)
@@ -319,7 +319,7 @@
       <xs:documentation>Custom-blend rates by smoking.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="CashValueEnhancementRate" type="xs:string">
+  <xs:element name="CashValueEnhancementRate" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Negative surrender charge as proportion of total 
account value.</xs:documentation>
     </xs:annotation>
@@ -365,12 +365,12 @@
       <xs:documentation>Corporation's name.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="CorporationPayment" type="xs:string">
+  <xs:element name="CorporationPayment" type="payment_sequence">
     <xs:annotation>
       <xs:documentation>Corporation's planned premium.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="CorporationPaymentMode" type="xs:string">
+  <xs:element name="CorporationPaymentMode" type="mode_sequence">
     <xs:annotation>
       <xs:documentation>Corporation's premium mode.</xs:documentation>
     </xs:annotation>
@@ -385,7 +385,7 @@
       <xs:documentation>Corporation's address: state.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="CorporationTaxBracket" type="xs:string">
+  <xs:element name="CorporationTaxBracket" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Corporation's tax bracket.</xs:documentation>
     </xs:annotation>
@@ -410,7 +410,7 @@
       <xs:documentation>User-designed supplemental illustration: elected or 
not.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="CurrentCoiMultiplier" type="xs:string">
+  <xs:element name="CurrentCoiMultiplier" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Multiplier for current COI rates.</xs:documentation>
     </xs:annotation>
@@ -420,7 +420,7 @@
       <xs:documentation>Insured's date of birth.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="DeathBenefitOption" type="xs:string">
+  <xs:element name="DeathBenefitOption" type="dbo_sequence">
     <xs:annotation>
       <xs:documentation>Death benefit option.</xs:documentation>
     </xs:annotation>
@@ -492,7 +492,7 @@
       <xs:documentation>Tax basis of 1035 exchange from a different 
insurer.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="ExtraCompensationOnAssets" type="xs:string">
+  <xs:element name="ExtraCompensationOnAssets" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Extra charge on separate-account assets. The 
motivation is to
 let end users add a negotiated asset trailer without changing
@@ -500,21 +500,21 @@
 charge in the nature of M&amp;E.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="ExtraCompensationOnPremium" type="xs:string">
+  <xs:element name="ExtraCompensationOnPremium" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Extra premium load. The motivation is to let end users 
add a
 negotiated commission without changing the product database,
 but the field may be used for any extra load on premium.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="ExtraMonthlyCustodialFee" type="xs:string">
+  <xs:element name="ExtraMonthlyCustodialFee" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Extra policy fee. The motivation is to let end users 
add an
 additional monthly custodial fee for a custom fund, but the
 field may be used for any extra monthly fee.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="FlatExtra" type="xs:string">
+  <xs:element name="FlatExtra" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Annual flat extra per thousand of specified 
amount.</xs:documentation>
     </xs:annotation>
@@ -534,7 +534,7 @@
       <xs:documentation>Insured's gender for insurance 
purposes.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="GeneralAccountRate" type="xs:string">
+  <xs:element name="GeneralAccountRate" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>General-account interest rate as a decimal: e.g., 
'0.03' for 3%.</xs:documentation>
     </xs:annotation>
@@ -557,7 +557,7 @@
 special interest rate, with no monthly deductions taken.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="HoneymoonValueSpread" type="xs:string">
+  <xs:element name="HoneymoonValueSpread" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Interest spread for honeymoon value, which grows at 
the net
 general account rate less this decrement.</xs:documentation>
@@ -600,7 +600,7 @@
       <xs:documentation>[obsolete]</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="Inforce7702AAmountsPaidHistory" type="xs:string">
+  <xs:element name="Inforce7702AAmountsPaidHistory" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>7702A "amounts paid" for each "contract year" since 
beginning
 of most recent seven-pay period; zero if not in a seven-pay
@@ -911,7 +911,7 @@
 reinsurance.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="NewLoan" type="xs:string">
+  <xs:element name="NewLoan" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>New loan taken in cash (excluding capitalized 
interest).</xs:documentation>
     </xs:annotation>
@@ -944,17 +944,17 @@
       <xs:documentation>Override investment management fee: used only with 
custom funds.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="PartialMortalityMultiplier" type="xs:string">
+  <xs:element name="PartialMortalityMultiplier" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Multiplier applied to partial-mortality 
table.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="Payment" type="xs:string">
+  <xs:element name="Payment" type="payment_sequence">
     <xs:annotation>
       <xs:documentation>Insured's planned premium.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="PaymentMode" type="xs:string">
+  <xs:element name="PaymentMode" type="mode_sequence">
     <xs:annotation>
       <xs:documentation>Insured's premium mode.</xs:documentation>
     </xs:annotation>
@@ -976,7 +976,7 @@
       <xs:documentation>Product (plan): enumerators depend on run-time 
context.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="ProjectedSalary" type="xs:string">
+  <xs:element name="ProjectedSalary" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Projected salary: used for salary-based 
benefits.</xs:documentation>
     </xs:annotation>
@@ -1015,7 +1015,7 @@
 intended to represent basic group term coverage.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="SeparateAccountRate" type="xs:string">
+  <xs:element name="SeparateAccountRate" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Separate-account hypothetical rate as a decimal: e.g., 
'0.06' for 6%.</xs:documentation>
     </xs:annotation>
@@ -1102,7 +1102,7 @@
       <xs:documentation>Parameter to be solved for.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="SpecifiedAmount" type="xs:string">
+  <xs:element name="SpecifiedAmount" type="specamt_sequence">
     <xs:annotation>
       <xs:documentation>Specified amount for each policy year since issue. 
Inforce
 extracts require only the current scalar value.</xs:documentation>
@@ -1229,7 +1229,7 @@
       <xs:documentation>Presumed policy year of death, for partial 
mortality.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="TaxBracket" type="xs:string">
+  <xs:element name="TaxBracket" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Insured's tax bracket.</xs:documentation>
     </xs:annotation>
@@ -1308,7 +1308,7 @@
       <xs:documentation>Reinterpret input withdrawals as loans after tax basis 
recovered.</xs:documentation>
     </xs:annotation>
   </xs:element>
-  <xs:element name="Withdrawal" type="xs:string">
+  <xs:element name="Withdrawal" type="numeric_sequence">
     <xs:annotation>
       <xs:documentation>Partial surrender.</xs:documentation>
     </xs:annotation>

Modified: lmi/trunk/types.rnc
===================================================================
--- lmi/trunk/types.rnc 2012-08-27 10:41:19 UTC (rev 5551)
+++ lmi/trunk/types.rnc 2012-08-27 14:33:28 UTC (rev 5552)
@@ -24,13 +24,21 @@
 # This schema is meant not for standalone use, but rather for
 # inclusion from other schemata.
 
-# It is infeasible to validate an input sequence with a regex.
+# Input sequences. Description:
+#   http://www.nongnu.org/lmi/sequence_input.html
+# The regular-expression patterns are generated by this code:
+#   http://svn.sv.nongnu.org/svn/lmi/lmi/trunk/regex_test.cpp
+# Inforce data from external systems should generally give a string of
+# semicolon-delimited year-by-year values, e.g.:
+#   1000; 2000; 3000
+# although a simple scalar suffices when historical data don't vary by
+# year.
 
-numeric_sequence = text
-payment_sequence = text
-mode_sequence    = text
-dbo_sequence     = text
-specamt_sequence = text
+numeric_sequence = xsd:string {pattern = " *| *(\-?[0-9.]+)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; *(\-?[0-9.]+)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"}
+payment_sequence = xsd:string {pattern = " *| 
*(\-?[0-9.]+|minimum|target|sevenpay|glp|gsp|corridor|table)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(\-?[0-9.]+|minimum|target|sevenpay|glp|gsp|corridor|table)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"}
+mode_sequence    = xsd:string {pattern = " *| 
*(annual|semiannual|quarterly|monthly)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(annual|semiannual|quarterly|monthly)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"}
+specamt_sequence = xsd:string {pattern = " *| 
*(\-?[0-9.]+|maximum|target|sevenpay|glp|gsp|corridor|salary)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(\-?[0-9.]+|maximum|target|sevenpay|glp|gsp|corridor|salary)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"}
+dbo_sequence     = xsd:string {pattern = " *| *(a|b|rop)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; *(a|b|rop)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"}
 
 # Numeric-range types.
 

Modified: lmi/trunk/types.xsd
===================================================================
--- lmi/trunk/types.xsd 2012-08-27 10:41:19 UTC (rev 5551)
+++ lmi/trunk/types.xsd 2012-08-27 14:33:28 UTC (rev 5552)
@@ -27,7 +27,42 @@
     This schema is meant not for standalone use, but rather for
     inclusion from other schemata.
   -->
-  <!-- It is infeasible to validate an input sequence with a regex. -->
+  <!--
+    Input sequences. Description:
+      http://www.nongnu.org/lmi/sequence_input.html
+    The regular-expression patterns are generated by this code:
+      http://svn.sv.nongnu.org/svn/lmi/lmi/trunk/regex_test.cpp
+    Inforce data from external systems should generally give a string of
+    semicolon-delimited year-by-year values, e.g.:
+      1000; 2000; 3000
+    although a simple scalar suffices when historical data don't vary by
+    year.
+  -->
+  <xs:simpleType name="numeric_sequence">
+    <xs:restriction base="xs:string">
+      <xs:pattern value=" *| *(\-?[0-9.]+)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; *(\-?[0-9.]+)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="payment_sequence">
+    <xs:restriction base="xs:string">
+      <xs:pattern value=" *| 
*(\-?[0-9.]+|minimum|target|sevenpay|glp|gsp|corridor|table)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(\-?[0-9.]+|minimum|target|sevenpay|glp|gsp|corridor|table)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="mode_sequence">
+    <xs:restriction base="xs:string">
+      <xs:pattern value=" *| *(annual|semiannual|quarterly|monthly)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(annual|semiannual|quarterly|monthly)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="specamt_sequence">
+    <xs:restriction base="xs:string">
+      <xs:pattern value=" *| 
*(\-?[0-9.]+|maximum|target|sevenpay|glp|gsp|corridor|salary)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; 
*(\-?[0-9.]+|maximum|target|sevenpay|glp|gsp|corridor|salary)(( +| *, 
*)(address@hidden *[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"/>
+    </xs:restriction>
+  </xs:simpleType>
+  <xs:simpleType name="dbo_sequence">
+    <xs:restriction base="xs:string">
+      <xs:pattern value=" *| *(a|b|rop)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *(; *(a|b|rop)(( +| *, *)(address@hidden 
*[0-9]+|[a-z]+|[\[\(][^;]+[\]\)]))? *)*;? *"/>
+    </xs:restriction>
+  </xs:simpleType>
   <!-- Numeric-range types. -->
   <xs:simpleType name="nonnegative_double">
     <xs:annotation>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]