Hi Thorsten,

> >          (while (read) (println @)) ) )
> >
> > This gives one top-level expression per line which can be easily
> > 'regexp'ed.
> 
> Thats a nice tip, thanks ... not that I understand it, the magic must be
> in the (println @), right?

Yes. 'println' prints one or more expressions and a newline, without any
further formatting. So if you 'read' an expression like

   (a
      (b
         (c d
            (e f) ) ) )

it will be printed as

   (a (b (c d (e f))))


>    ,------------------------------------------------
>    | (rel exp (+Class1 +Class2 ...) {xxx} (+Class3))
>    `------------------------------------------------
> 
> My real question was what can happen in the {xxx} part above (just from
> the point of view of parsing the section with regexp:
> 
> - {empty}
> - NIL
> - sym
> - (list) sym
> - ...  ?

Yes depending on the class(es) in the relation type (the first list). It
may also be a number (e.g. for '+Number' (an optional scale) or '+Snx'
(the minimum string length)).

'+Link' takes a type (a list of classes), while '+Joint' as an extension
to '+Link' takes an additional symbol (the slot in the "opposite"
object).


> So it will probably been shown as a bidirectional association:
> 
>  ,------------------------------------------
>  | (rel ord (+List +Joint) pos (+Ord)) 
>  `------------------------------------------
> 
> one-to-many?
> 
>  ,------------------------------------------
>  | (rel ord (+Joint) pos (+Ord)) 
>  `------------------------------------------
> 
> one-to-one?

These two lines cannot be seen independently. Together, they describe a
1-to-N relation.

If you just see

   (rel ord (+Joint) pos (+Ord)) 

it may be a 1-to-1 or a 1-to-N, depending on the opposite side.

Note that also

   (class +Cls1 +Entity)
   (rel var1 (+List +Joint) var2 (+Cls2)) 
   ...
   (class +Cls2 +Entity)
   (rel var2 (+List +Joint) var1 (+Cls1)) 

is possible, describing a N-to-N relation.




> >> ,-----------------------------------
> >> | (rel pos (+List +Bag) # Positions
> >> |  ((+Ref +Link) NIL (+Item)) # Item
> >> |  ((+Number) 2) # Price
> >> |  ((+Number)) # Quantity
> >> |  ((+String)) # Memo text
> >> |  ((+Number) 2) ) # Total amount
> >> `-----------------------------------
> 
> I think I'll have to figure out a trick how to deal with bags, way to
> much effort to get all this info into an UML diagram.

Perhaps (+List +Bag) can be seen as an object-local "table"?


> BTW, one more question:
> 
> The vars sometimes specified in the comment beyond a class definition:
> 
> ,-----------------
> | (class ...
> | # var1 var2 var3
> | ...)
> `-----------------
> 
> can be considered as a kind of 'private instance (or class) variables?

Yes. I would not use "private" here, as it sounds like information
hiding, which is not the case.

"Instance variables" fits best. BTW, there are also "class variables"
(http://software-lab.de/doc/refV.html#var).

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to