Question

I asked a similar question earlier, but posed it as a language-specific question. I realized that my issue is at the modelling level.

How should I represent the following in the object model:

I have:

  • Data objects
  • Parameter objects
  • Rules objects

A rule specifies how to modify a data object it receives; it requires additional parameters to be fully defined. A rule may use other rules (either referring to them internally, or being told to do so in the parameter object).

The rule is not written in some custom language that someone needs to parse; rather it simply consists of the code that should be executed. This may sound like an implementation solution ahead of the design, but it's actually one of the requirements (system users are programmers who want to be able to write their own rules and add them to the system easily).

The main activity happens when a data object, a parameter object, and a rule object meet; at that time, the data object gets modified.

The user tells the system which rule, which parameter, and which data object he wants to meet, and expects to get back the modified data object.

UPDATE:

Examples of data objects:

All data objects can be logically represented as SQL tables.

Data object ID #7: a SQL table

Data object ID #13: a SQL table

Examples of parameter objects:

All parameter objects have the same layout: a text file, where each line looks like

<PARAMETER_NAME> = <VALUE>

Parameter object ID #52:

RULE = 'regression'

DATA ID = 7

Y = 'cost'

X = 'maximum speed'

R = 'error in cost estimate'

Parameter object #59:

RULE = 'average'

DATA ID = 13

COLUMNS = 'min speed', 'max speed'

AVERAGE = 'avg speed'

Examples of rules objects:

Rule object 'regression':

Performs linear regression; parameters named 'Y' and 'X' specify column names to be used as dependent and independent variables; parameter named 'R' specifies the column name to be added to the table that will contain the residuals from the regression.

Rule object 'average':

Calculates the average of the numbers specified in columns listed in parameter 'COLUMNS', and stores the result in the column specified in parameter 'AVERAGE'.

Was it helpful?

Solution

Define them As UML stereotypes. Create a metaclass for your three meta types. DataObject, ParameteObject, and RulesObject. Add the specific details to the metaclass, then apply that stereotype of the Metaclass to the real item objects in your model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top