Can this be done with one or more asserts?

 

From: Garriss Jr., James P.
Sent: Tuesday, March 05, 2013 8:43 AM
To: dfdl-wg@ogf.org
Subject: unordered sequence with constrained occurrences

 

Suppose text data has 3 constructs:  a, b, and c.

 

·       a must occur 1 time

·       b can occur 0 or 1 time

·       c can occur any number of times, 0 or more

 

These 3 constructs can appear in any order.

 

So these are valid inputs:

 

abc

a

bcccca

 

But these are not:

 

ccbcc  

abbc

abcabc

 

Can data like this be modeled with DFDL?

 

The unordered sequence can be modeled with a data array, like this:

 

Array (0 to unbounded)

Sequence

  a (0 to 1)

  b (0 to 1)

  c (0 to 1)

/Sequence

/Array

 

But I don’t know how to constrain the total number of occurrences. 

 

Appreciate any ideas!