Re: PicoLisp relations and UML

2013-02-01 Thread Thorsten Jolitz
Alexander Burger  writes:

Hi Alex,

> 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

I see, thanks, so in theory this should work too with other Lisps that
have a function equivalent to 'println'. 


>>,
>>| (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).  

Ok, then I have seen all possibilities except the 'number'. 

> 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.

So I need to remember the +Cls1 info in case there is a +Joint until the
parser reaches +Cls2. 

>> >> ,---
>> >> | (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"?

that would work, since tables are presented in class-boxes in UML. 

>> 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).

Ok, thanks for the tips. 

-- 
cheers,
Thorsten

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


Re: PicoLisp relations and UML

2013-02-01 Thread Alexander Burger
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


Re: PicoLisp relations and UML

2013-01-31 Thread Thorsten Jolitz
Alexander Burger  writes:

Hi Alex,

> You could read and print the data in a "flat" format to some file, e.g.:
>
>(out "er.flat"
>   (in "myApp/er.l"
>  (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?

>> ,---
>> | (rel exp (+List +Link) NIL (+Abc))# why the NIL?
>> `---
>
> Good question. Where did you find this? It is definitely wrong, because
> '+List' doesn't take any arguments.
>
>(rel exp (+List +Link) (+Abc))

I just made it up, should have cared more about the wrong or right. 

   ,
   | (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
- ...  ?

>> ,--
>> | (rel ord (+Dep +Joint) (itm) pos (+Ord))   #  why the (itm) ?
>> `--
>
> The 'itm' goes with the '+Dep' (dependency) class. It means that this
> 'ord' relation depends on the 'itm' (item) relation in the same object.
> When the 'itm' link is cut off (for example, because the item in that
> position is removed), then the whole position will be cut off (become
> garbage).

I see, but have no idea how to express that in UML - I guess its
impossible. 

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?

>> ,---
>> | (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.

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?

-- 
cheers,
Thorsten

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


Re: PicoLisp relations and UML

2013-01-31 Thread Alexander Burger
Hi Thorsten,

> I have a few questions with regards to representing PicoLisp relations
> in UML notation:

Hmm, as I have no experiences with UML, and can't help with that.
However, concerning some of your other questions:


> ,---
> | (rel ord (+Dep +Joint) # Order
> |(itm)
> |pos (+Ord) )
> `---
> 
> a syntactic outlier in PicoLisp code, or do I have to expect this to
> happen? Its _much_ more difficult to deal with this via regexp than with
> this: 
> 
> ,--
> | (rel ord (+Dep +Joint) (itm) pos (+Ord))  # Order
> `--

You could read and print the data in a "flat" format to some file, e.g.:

   (out "er.flat"
  (in "myApp/er.l"
 (while (read) (println @)) ) )

This gives one top-level expression per line which can be easily
'regexp'ed.



> ,---
> | (rel exp (+List +Link) NIL (+Abc))# why the NIL?
> `---

Good question. Where did you find this? It is definitely wrong, because
'+List' doesn't take any arguments.

   (rel exp (+List +Link) (+Abc))


> ,--
> | (rel ord (+Dep +Joint) (itm) pos (+Ord))   #  why the (itm) ?
> `--

The 'itm' goes with the '+Dep' (dependency) class. It means that this
'ord' relation depends on the 'itm' (item) relation in the same object.
When the 'itm' link is cut off (for example, because the item in that
position is removed), then the whole position will be cut off (become
garbage).


> ,--
> | (rel ord (+Dep +List +Joint) pos (+Ord)) 
> `--
> ...
> ,--
> | (rel ord (+Dep +List +Joint) pos (+List +Ord)) # possible?
> `--

These two are not correct, because the argument for '+Dep' is
missing.

In the second one, the '+List' in (+List +Ord) is also not right. This
is an argument to '+Joint', which expects an +Entity type while '+List'
is a relation class.



> ,---
> | (rel pos (+List +Bag) # Positions
> |  ((+Ref +Link) NIL (+Item)) # Item
> |  ((+Number) 2) # Price
> |  ((+Number)) # Quantity
> |  ((+String)) # Memo text
> |  ((+Number) 2) ) # Total amount
> `---

This looks all right.

Hope this helps a little (though not with the central questions).

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


PicoLisp relations and UML

2013-01-31 Thread Thorsten Jolitz

Hi List, 

I have a few questions with regards to representing PicoLisp relations
in UML notation:

1. Syntactic outlier?

Is this:

,---
| (rel ord (+Dep +Joint) # Order
|(itm)
|pos (+Ord) )
`---

a syntactic outlier in PicoLisp code, or do I have to expect this to
happen? Its _much_ more difficult to deal with this via regexp than with
this: 

,--
| (rel ord (+Dep +Joint) (itm) pos (+Ord))  # Order
`--

[Probably not, see +Bag example below (*sigh**) ...]

2. Link, Joint and Bag

How to represent in UML notation, and how to determine the
'quantification' (one-to-many etc.)?

- Link

Aggregation?

,---
| (rel exp (+List +Link) NIL (+Abc))# why the NIL?
`---

=> 1 --- * ?

,---
| (rel exp (+Link) (+Abc))
`---

=> 1 --- 1 ?

- Joint

Simple bidirectional Association? 

,--
| (rel ord (+Dep +Joint) (itm) pos (+Ord))   #  why the (itm) ?
`--

=> 1 --- 1 ?

,--
| (rel ord (+Dep +List +Joint) pos (+Ord)) 
`--

=> 1 --- * ?

,--
| (rel ord (+Dep +List +Joint) pos (+List +Ord)) # possible?
`--

=> * --- * ?

- Bag

Aggregation? Composition?

,---
| (rel pos (+List +Bag) # Positions
|  ((+Ref +Link) NIL (+Item)) # Item
|  ((+Number) 2) # Price
|  ((+Number)) # Quantity
|  ((+String)) # Memo text
|  ((+Number) 2) ) # Total amount
`---

How to present this in UML?
Its like 1 Link and 4 unnamed attributes, I'm not sure how to translate
to a UML class diagram?

-- 
cheers,
Thorsten


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