dommlite.tx 6.05 KB

DOMMLiteModel:
	"model" name=ID (shortDesc=STRING)? (longDesc=STRING)?
	((dataTypes+=UserDataType)|
	(constraintTypes+=ConstraintType))*
	packages*=Package;

PackageElement:
	Package|Classifier;
	
Classifier:
	Entity|Service|ValueObject|Exception|DataType|ConstraintType;
	
DataType:
	BuildInDataType|UserDataType|Enumeration;

ConstraintType:
	ValidatorType|TagType;

ValidatorType:
	UserValidatorType|BuildInValidatorType;

TagType:
	UserTagType|BuildInTagType;

Feature:
	Property|Operation;

TypedElement:
	Feature|Parameter;

NamedElement:
	DOMMLiteModel|PackageElement|FeatureCompartment|OperationCompartment|EnumerationLiteral|TypedElement;


/* Ugradeni elementi modela ne bi trebalo da se definisu u modelu vec trebaju biti automatski prisutni u svakom modelu*/
BuildInDataType:
	"buildinDataType" name=ID 
	(shortDesc=STRING)? (longDesc=STRING)?;
	
BuildInValidatorType:
	"buildinValidator" name=ID 
		("("(parameters+=ConstraintTypeParameter)?(","parameters+=ConstraintTypeParameter)* ")")? 
		("appliesTo" 	
			((appliesToEntity?="_entity") |
			(appliesToProperty?="_prop") | 
			(appliesToParameter?="_param") | 
			(appliesToOperation?="_op") |
			(appliesToService?="_service") | 
			(appliesToValueObject?="_valueObject"))*)? 
	(shortDesc=STRING)? (longDesc=STRING)?;
	
BuildInTagType:
	"buildinTagType" name=ID 
		("("(parameters+=ConstraintTypeParameter)?(","parameters+=ConstraintTypeParameter)* ")")? 
		("appliesTo" 	
			((appliesToEntity?="_entity") |
			(appliesToProperty?="_prop") | 
			(appliesToParameter?="_param") | 
			(appliesToOperation?="_op") |
			(appliesToService?="_service") | 
			(appliesToValueObject?="_valueObject"))*)? 
	(shortDesc=STRING)? (longDesc=STRING)?;


UserDataType:
	"dataType" name=ID (shortDesc=STRING)? (longDesc=STRING)?;

UserTagType:
	"tagType" name=ID 
		("("(parameters+=ConstraintTypeParameter)?(","parameters+=ConstraintTypeParameter)* ")")? 
		("appliesTo" 	
			((appliesToEntity?="_entity") |
			(appliesToProperty?="_prop") | 
			(appliesToParameter?="_param") | 
			(appliesToOperation?="_op") |
			(appliesToService?="_service") | 
			(appliesToValueObject?="_valueObject"))*)? 
		(shortDesc=STRING)? (longDesc=STRING)?;

UserValidatorType:
	"validatorType" name=ID 
		("("(parameters+=ConstraintTypeParameter)?(","parameters+=ConstraintTypeParameter)* ")")? 
		("appliesTo" 	
			((appliesToEntity?="_entity") |
			(appliesToProperty?="_prop") | 
			(appliesToParameter?="_param") | 
			(appliesToOperation?="_op") |
			(appliesToService?="_service") | 
			(appliesToValueObject?="_valueObject"))*)? 
		(shortDesc=STRING)? (longDesc=STRING)?;

Enum ConstraintTypeParameter:
	string="_string"|
	int="_int" | 
	ref="_ref" | 
	ellipsis="..."
;

Package:
	"package" name=ID (shortDesc=STRING)? (longDesc=STRING)? "{"
		(packageElements+=PackageElement)*
	"}";
	
Entity:
	"entity" name=ID
		("extends" extends=[Entity])?
		("depends" depends+=[Service] ("," depends+=[Service])*)? 
		(shortDesc=STRING)? (longDesc=STRING)? 
	"{"
		key=BusinessKey
		("repr" repr+=ReprParameter ("+" repr+=ReprParameter)*)?
		("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
		(features+=Feature)* 		
		(featureCompartments+=FeatureCompartment)*
	"}";

ReprParameter:
	ReprParameterStr|ReprParameterRef;
ReprParameterStr:
	paramValue=STRING;
ReprParameterRef:
	paramValue=[Property];


BusinessKey:
	"key" "{"
		(properties+=Property)+
	"}";

ConstraintSpec:
	 type=[ConstraintType] ("(" (parameters+=ConstraintParameter)?  ("," parameters+=ConstraintParameter)* ")")? 
	
;

ConstraintParameter:
	ConstraintIntParameter|ConstraintRefParameter|ConstraintStrParameter
;

ConstraintStrParameter:
	paramValue=STRING
;

ConstraintIntParameter:
	paramValue=INT
;
	
ConstraintRefParameter:
	paramValue = [Property] 
;

Exception:
	"exception" name=ID (shortDesc=STRING)? (longDesc=STRING)? "{"
		(properties+=Property)* 		
	"}";

FeatureCompartment:
	"compartment" name=ID (shortDesc=STRING)? (longDesc=STRING)? "{"
		(features+=Feature)* 
	"}";
	
	
Service:
	"service" name=ID
	("extends" extends=[Service])?
	("depends" depends+=[Service] ("," depends+=[Service])*)?
	(shortDesc=STRING)? (longDesc=STRING)? 
	"{"
		("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
		(operations+=Operation)*
		(operationCompartmens+=OperationCompartment)*
	"}";	
	
OperationCompartment:
	"compartment" name=ID (shortDesc=STRING)? (longDesc=STRING)? "{"
		(operations+=Operation)* 
	"}";
	
	
ValueObject:
	"valueObject" name=ID
	("extends" extends=[ValueObject])?
	("depends" depends+=[Entity] ("," depends+=[Entity])*)? 
	(shortDesc=STRING)? (longDesc=STRING)? 
	"{"
		("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
		(properties+=Property)* 
	"}";
	
Operation:
	"op" ( (ordered?="ordered") |
		(unique?="unique") | 
		(required?="required"))*
		type=[Classifier] (many?="[" (multiplicity=INT)? "]")? 
		name=ID "("(parameters+=Parameter)?(","parameters+=Parameter)* ")"
		("throws" exceptions+=[Exception] ("," exceptions+=[Exception])?)?
		("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
		(shortDesc=STRING)? (longDesc=STRING)?;

/*
	Atribut i referenca su objedinjeni u jedinstvenom konceptu property
*/
Property:
	"prop" 
		( (ordered?="ordered") |
		(unique?="unique") | 
		(readonly?="readonly") | 
		(required?="required") )* 
		(containment?="+")? 
		type=[Classifier] (many?="[" (multiplicity=INT)? "]")?  name=ID 
		("<>" oppositeEnd=[Property])? 
		("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
		(shortDesc=STRING)? (longDesc=STRING)? 
		;


Parameter:
	( (ordered?="ordered") |
	  (unique?="unique") | 
	  (required?="required") )*
	type=[Classifier] (many?="[" (multiplicity=INT)? "]")?  name=ID  
	("[" constraints+=ConstraintSpec ("," constraints+=ConstraintSpec)* "]")?
	(shortDesc=STRING)? (longDesc=STRING)?
; 

Enumeration:
	"enum" name=ID (shortDesc=STRING)? (longDesc=STRING)? "{"
		(literals+=EnumerationLiteral)+
	"}";
	
EnumerationLiteral:
	name=ID value=STRING (shortDesc=STRING)? (longDesc=STRING)?;



// Enum DataType:
//	Str="string"|Integer="int"|Boolean="bool"|DateTime="datetime"|Void="void"|Float="float";