# Linguistic Patterns and Linguistic Styles for Requirements Specification: Focus on Data Entities
## 4 Data Entities' Linguistic Patterns and Linguistic Styles
### Data Attribute, DataPrimitiveType and DataEnumeration
#### 4.2.3 Examples  
Considering the BillingSystem example, we can capture text fragments that might suggest attributes and other aspects associated with them. We identify and annotate these fragments as follows: data entity attributes (text marked with light gray), e.g., product name, product values, VAT code and value, and data enumeration values (text marked with light green), for instance, Small, Regular and Large in the text fragment below:  
A **VAT** consists of the following information: VAT code, rate, name, and value: The |VAT** rates consider the following values: standard, reduced, and special. [... ] The system shall maintain the following information for **products**: name, price, VAT rate, VAT value, and size category; a size category consists of one of the following sizes: Small, Regular, large, Extralarge. [... ] If relevant, we classify each data attribute according to some primitive data type (e.g., Integer, Float, Boolean, String, Date) or some predefined data enumeration. For example, with the knowledge from the domain analysis, we can define the attributes of the VAT and Product entities as follows:With the CNL-A Style (ls2-cnl-a):  
```
SizeKindDatEnumerationwithvalues:SmallRegularLargeExtralarge
```  
VARTRateKindDatEnumerationwithvalues:Standard,Reduced,Special ```
e_VATReferenceDataEntitywithattributes:Code,Rate,Name,Value
```

e_ProductMasterDataEntitywithattributes:|ID,Name,VATCode,VATValue ```
ValueWithoutVAT,valueWithVAT,size
```  
With the CNL-B Style (ls2-cnl-b):  
```
DataEnumerationSizeKindwithvalues(SmallRegularLargeExtralarge)
```  
DataEnumerationVARTRateKindwithvalues(Standard,Reduced,Special) ```
DataEntity_VAT(VATCategory)isaReference
```

attributeCodeisaInteger|,

attributeRateisa[DataEnumerationVARTRateKind],

attributeNameisaString(30),

attributeValue\"VATClassValue\"isaDecimal(2.1)|. DataEntity_Product(Product)isaMaster ```
attributeID\"ProductID\"isaInteger,

attributeName\"Name\"isaString(50)|,

attributeVATCode\"VATCode\"isaInteger|,

attributeVATValue\"VATValue\"isaDecimal(2.2)|,

attributeValueWithoutVAT\"PriceWithoutVAT\"isaDecimal(16.2)|,

attributevalueWithVAT\"PriceWithVAT\"isaDecimal(16.2)|,

attributesize\"SizeCategory\"isaDataEnumerationSizeKind|. ### Data Constraint

#### 4.3.1 Linguistic Pattern

A data constraint denotes a particular constraint on the values of an attribute or the data entity as a complete element. Some of these constraints can be assigned directly to a given attribute by setting a predefined property (e.g., NotNull or Unique); other constraints correspond to referential integrity among data entities; and still others can express customized constraints. The following rules define the linguistic patterns DataEntityConstraint and DataAttributeConstraint (lp3). ``` DataEntityConstraint: <isReadOnly:Boolean>?//falsebydefault <isEncrypted:Boolean>?//falsebydefault <checks:Check>* ```  
DataAttributeConstraint:: <multiplicity:STRING>? <isPrimaryKey:Boolean>?//falsebydefault <isNotNull:Boolean>?//falsebydefault <isUnique:Boolean>?//falsebydefault (<isDerived:Boolean><expression:String>? )//falsebydefault lp3 <isReadOnly:Boolean>?//falsebydefault <isEncrypted:Boolean>?//falsebydefault <foreignKey:ForeignKey>? <checks:Check>* ForeignKey: <targetEntity:DataEntity> {<onDeleteType:ForeignKeyOnDeleteType>}? enumForeignKeyOnDeleteType:: CASCADE|PROTect|SET_NULLDataEntityConstraint involves the setting of the following data entity's constraints: read-only (isReadOnly) and encrypted (isEncrypted); also customized constraints (checks) can be set. DataAttributeConstraint involves the setting of the following attribute constraints: multiplicity (e.g., \"0.1\", \"0.\", \"1\"), primary-key (isPrimaryKey), not-null (isNotNull), unique (isUnique), derived or calculated from other attributes (isDerived) and being possible to express the respective derived expression (expression), read-only (isReadOnly) and encrypted (isEncrypted); also, it is possible to define a ForeignKey constraint (foreignKey), and other customized constraints (checks).