dbTalk Databases Forums  

Using the RM for ADTs

comp.databases.theory comp.databases.theory


Discuss Using the RM for ADTs in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David BL
 
Posts: n/a

Default Using the RM for ADTs - 07-02-2009 , 04:28 AM






Consider a requirement to record electronic circuits in a relational
database. Circuits are abstract mathematical objects (i.e. "values")
independent of physical layout. There is no requirement to label
individual components (e.g. all 1 ohm resistors are
indistinguishable), nor any requirement to label circuit nodes.

The reason for recording circuit values in a physical database is
outside the scope of this discussion.

Two circuits are equivalent if they are isomorphic. A model for a
circuit value must define exactly when circuits are identical. Failure
to do so would mean for example that a set of circuit values is ill-
defined (e.g. one cannot determine the cardinality of the set).

In principle a very large circuit can consist of thousands of
components, wired up in a complex network. Recursive types cannot
eliminate the need for abstract identifiers.

One approach is to use abstract identifiers for the circuit nodes, and
use relations such as:

resistor(N1,N2,R) :- there is a resistor of value R
connected between nodes N1,N2.

This raises the question of whether the following symmetry

resistor(N1,N2,R) <=> resistor(N2,N1,R)

should be an integrity constraint. If so then in the logical model
information is represented twice and it complicates updates. If not
then there are potential surprises when using the relation. Do we
take the union of the resistors connected from N1 to N2, and N2 to
N1?

Two or more resistors connected in parallel between a given pair of
nodes are always equivalent to some single resistor value, so in
theory we could make {N1,N2} the key. If we want to model resistors
in parallel then even if the key is {N1,N2,R} there cannot be multiple
resistors of the same value. To model that we could instead use:

resistor'(N1,N2,R,M) :- there are M resistors
of value R connected (in parallel) between
nodes N1,N2.

I find it curious that we would only tend to record the tuples where
M>0. Normally under a closed world assumption one expects the set of
tuples for a given relation to be uniquely defined. However in this
case, under CWA, a tuple with M=0 can be removed without changing the
circuit value. Note as well that a similar issue would occur in the
relation

resistor''(N1,N2,C) :- there is a resistor with
conductance C (in siemens) connected between
nodes N1,N2.

because resistors with zero conductance are equivalent to no resistor
at all. I find this interesting because it complicates the definition
of circuit identity. One could apply the integrity constraint C>0,
however that somehow seems artificial in a logical model, and more
like a rule an implementation would impose.

I'd like to know whether circuit identity can be implicit in the
database schema by treating abstract identifiers specially. If there's
still ambiguity in the model then a comparison operator must be
separately and explicitly defined. Is that acceptable given that
C.Date says the relations *are* the logical model?

Tuples have a well defined definition of equality (they must have the
same attribute names and values), and so also for relations which are
sets of tuples. One can't mess with these definitions! It follows
that a tuple with relation valued attributes cannot really be used to
define a possrep for a circuit if it fails to define logical
equivalence as we would like. The missing concept seems to be
encapsulation in the sense used for an ADT defined in terms of a
private implementation.

Reply With Quote
  #2  
Old   
Cimode
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-02-2009 , 05:58 AM






On 2 juil, 11:28, David BL <davi... (AT) iinet (DOT) net.au> wrote:
Quote:
Consider a requirement to record electronic circuits in a relational
database. Circuits are abstract mathematical objects (i.e. "values")
independent of physical layout. There is no requirement to label
individual components (e.g. all 1 ohm resistors are
indistinguishable), nor any requirement to label circuit nodes.

The reason for recording circuit values in a physical database is
outside the scope of this discussion.

Two circuits are equivalent if they are isomorphic. A model for a
circuit value must define exactly when circuits are identical. Failure
to do so would mean for example that a set of circuit values is ill-
defined (e.g. one cannot determine the cardinality of the set).

In principle a very large circuit can consist of thousands of
components, wired up in a complex network. Recursive types cannot
eliminate the need for abstract identifiers.

One approach is to use abstract identifiers for the circuit nodes, and
use relations such as:

* * resistor(N1,N2,R) :- there is a resistor of value R
* * * * connected between nodes N1,N2.

This raises the question of whether the following symmetry

* * * * resistor(N1,N2,R) <=> resistor(N2,N1,R)

should be an integrity constraint. If so then in the logical model
information is represented twice and it complicates updates. If not
then there are potential surprises when using the relation. *Do we
take the union of the resistors connected from N1 to N2, and N2 to
N1?

Two or more resistors connected in parallel between a given pair of
nodes are always equivalent to some single resistor value, so in
theory we could make {N1,N2} the key. *If we want to model resistors
in parallel then even if the key is {N1,N2,R} there cannot be multiple
resistors of the same value. *To model that we could instead use:

* * resistor'(N1,N2,R,M) :- there are M resistors
* * * * of value R connected (in parallel) between
* * * * nodes N1,N2.

I find it curious that we would only tend to record the tuples where
M>0. *Normally under a closed world assumption one expects the set of
tuples for a given relation to be uniquely defined. *However in this
case, under CWA, a tuple with M=0 can be removed without changing the
circuit value. *Note as well that a similar issue would occur in the
relation

* * resistor''(N1,N2,C) :- there is a resistor with
* * * *conductance C (in siemens) connected between
* * * *nodes N1,N2.

because resistors with zero conductance are equivalent to no resistor
at all. I find this interesting because it complicates the definition
of circuit identity. One could apply the integrity constraint C>0,
however that somehow seems artificial in a logical model, and more
like a rule an implementation would impose.

I'd like to know whether circuit identity can be implicit in the
database schema by treating abstract identifiers specially. If there's
still ambiguity in the model then a comparison operator must be
separately and explicitly defined. Is that acceptable given that
C.Date says the relations *are* the logical model?

Tuples have a well defined definition of equality (they must have the
same attribute names and values), and so also for relations which are
sets of tuples. *One can't mess with these definitions! It follows
that a tuple with relation valued attributes cannot really be used to
define a possrep for a circuit if it fails to define logical
equivalence as we would like. The missing concept seems to be
encapsulation in the sense used for an ADT defined in terms of a
private implementation.
The definition of an entity relation according to its properties or to
a specific context is not a relational definition.

Reply With Quote
  #3  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-02-2009 , 04:23 PM



"Cimode" <cimode (AT) hotmail (DOT) com> wrote

On 2 juil, 11:28, David BL <davi... (AT) iinet (DOT) net.au> wrote:
Quote:
Consider a requirement to record electronic circuits in a relational
database. Circuits are abstract mathematical objects (i.e. "values")
independent of physical layout. There is no requirement to label
individual components (e.g. all 1 ohm resistors are
indistinguishable), nor any requirement to label circuit nodes.

The reason for recording circuit values in a physical database is
outside the scope of this discussion.

Two circuits are equivalent if they are isomorphic. A model for a
circuit value must define exactly when circuits are identical. Failure
to do so would mean for example that a set of circuit values is ill-
defined (e.g. one cannot determine the cardinality of the set).

In principle a very large circuit can consist of thousands of
components, wired up in a complex network. Recursive types cannot
eliminate the need for abstract identifiers.

One approach is to use abstract identifiers for the circuit nodes, and
use relations such as:

resistor(N1,N2,R) :- there is a resistor of value R
connected between nodes N1,N2.

This raises the question of whether the following symmetry

resistor(N1,N2,R) <=> resistor(N2,N1,R)

should be an integrity constraint. If so then in the logical model
information is represented twice and it complicates updates. If not
then there are potential surprises when using the relation. Do we
take the union of the resistors connected from N1 to N2, and N2 to
N1?
What identifies a resistor is an unordered pair of nodes and a resistance,
so the relation representing resistors could reflect that--e.g.
resistor{Nodes,R} where Nodes is a set of nodes. At first I thought that if
the domain of nodes is a total order, then a constraint can be specified
that forces N1 < N2. But that introduces unnecessary structure that might
complicate the algorithm for determining whether two circuits are
isomorphic.

Incidentally, most resistors are labeled with color bands that are read from
left to right, or with verbiage indicating the resistance, precision and
power rating. When resistors are inserted into a board so that the bands or
verbiage are not oriented as expected, automated optical inspectors might
reject the board, even though the circuit would work regardless of the
orientation of the resistor.

I think it might be simpler to assign artificial identifiers to the
components instead of the nodes. It is certainly more intuitive. Each
component has a finite number of leads, and each lead can connect with zero
or more components, possibly other leads on the same component. For
example, a NOR gate becomes an inverter if you tie the inputs together. The
circuits can then be represented entirely as a set of unordered pairs:

{{component, lead}, {component, lead}}

And then isomorphism between circuits can be determined by substituting the
symbols for the components--something like how alpha conversion works in the
lambda calculus. Treat each set of pairs as a function where the artificial
identifiers for each component are bound variables in the function, then if
the functions are equivalent modulo alpha conversion, then the circuits are
equivalent whenever the component properties are identical.

I think that for components with two leads that can operate in either
orientation, if the lead identifiers were also treated like bound variables,
along with the component identifiers, then circuits would still be
considered equivalent even if one or more of the components that can be
reversed are.

Quote:
Two or more resistors connected in parallel between a given pair of
nodes are always equivalent to some single resistor value, so in
theory we could make {N1,N2} the key. If we want to model resistors
in parallel then even if the key is {N1,N2,R} there cannot be multiple
resistors of the same value. To model that we could instead use:

resistor'(N1,N2,R,M) :- there are M resistors
of value R connected (in parallel) between
nodes N1,N2.

I find it curious that we would only tend to record the tuples where
M>0. Normally under a closed world assumption one expects the set of
tuples for a given relation to be uniquely defined. However in this
case, under CWA, a tuple with M=0 can be removed without changing the
circuit value. Note as well that a similar issue would occur in the
relation

resistor''(N1,N2,C) :- there is a resistor with
conductance C (in siemens) connected between
nodes N1,N2.

because resistors with zero conductance are equivalent to no resistor
at all. I find this interesting because it complicates the definition
of circuit identity. One could apply the integrity constraint C>0,
however that somehow seems artificial in a logical model, and more
like a rule an implementation would impose.

I'd like to know whether circuit identity can be implicit in the
database schema by treating abstract identifiers specially. If there's
still ambiguity in the model then a comparison operator must be
separately and explicitly defined. Is that acceptable given that
C.Date says the relations *are* the logical model?

Tuples have a well defined definition of equality (they must have the
same attribute names and values), and so also for relations which are
sets of tuples. One can't mess with these definitions! It follows
that a tuple with relation valued attributes cannot really be used to
define a possrep for a circuit if it fails to define logical
equivalence as we would like. The missing concept seems to be
encapsulation in the sense used for an ADT defined in terms of a
private implementation.
The definition of an entity relation according to its properties or to
a specific context is not a relational definition.

Reply With Quote
  #4  
Old   
David BL
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-02-2009 , 08:27 PM



On Jul 3, 5:23 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:

Quote:
I think it might be simpler to assign artificial identifiers to the
components instead of the nodes. It is certainly more intuitive. Each
component has a finite number of leads, and each lead can connect with zero
or more components, possibly other leads on the same component. For
example, a NOR gate becomes an inverter if you tie the inputs together. The
circuits can then be represented entirely as a set of unordered pairs:

{{component, lead}, {component, lead}}
Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.

Note that netlists used by circuit simulation programs like SPICE tend
to use something similar to what I discussed - i.e. for each component
list all the nodes to which it is connected. One difference is that
they require component labels as well as node labels.


Quote:
I think that for components with two leads that can operate in either
orientation, if the lead identifiers were also treated like bound variables,
along with the component identifiers, then circuits would still be
considered equivalent even if one or more of the components that can be
reversed are.
You might to be onto something there. I've also been thinking that the
concept of bound variables could be relevant. I came at this by
thinking about the idea of instantiating circuit values within
containing circuits. To achieve circuit reuse I was thinking that
circuit values must be named (so they can be referenced by name in
order to be instantiated within another circuit).


Quote:
The definition of an entity relation according to its properties or to
a specific context is not a relational definition.
You're repeating Cimode?

Reply With Quote
  #5  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-02-2009 , 11:58 PM



"David BL" <davidbl (AT) iinet (DOT) net.au> wrote

Quote:
On Jul 3, 5:23 am, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:

I think it might be simpler to assign artificial identifiers to the
components instead of the nodes. It is certainly more intuitive. Each
component has a finite number of leads, and each lead can connect with
zero
or more components, possibly other leads on the same component. For
example, a NOR gate becomes an inverter if you tie the inputs together.
The
circuits can then be represented entirely as a set of unordered pairs:

{{component, lead}, {component, lead}}

Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.
I see your point, but I still think that assigning components artificial
identifiers is better: the unordered pairs could be replaced with or
preprocessed into a single set per node prior to the determination of
isomorphism. For example,

{resistor1:lead1,capacitor2:lead1,transistor1:lead 2}

discribes a node that connects a resistor and a capacitor to the base of a
transistor.

The above contains the same information as the unordered pairs

{{resistor1:lead1,capacitor2:lead1},
{resistor1:lead1,transistor1:lead2}}

without either the arbitrariness or the redundancy you seek to avoid.

Quote:
Note that netlists used by circuit simulation programs like SPICE tend
to use something similar to what I discussed - i.e. for each component
list all the nodes to which it is connected. One difference is that
they require component labels as well as node labels.


I think that for components with two leads that can operate in either
orientation, if the lead identifiers were also treated like bound
variables,
along with the component identifiers, then circuits would still be
considered equivalent even if one or more of the components that can be
reversed are.

You might to be onto something there. I've also been thinking that the
concept of bound variables could be relevant. I came at this by
thinking about the idea of instantiating circuit values within
containing circuits. To achieve circuit reuse I was thinking that
circuit values must be named (so they can be referenced by name in
order to be instantiated within another circuit).


The definition of an entity relation according to its properties or to
a specific context is not a relational definition.

You're repeating Cimode?
I don't know what happened. I thought I replied to your post, but I must
have replied to his instead. I was as surprised as you to see that.

Reply With Quote
  #6  
Old   
David BL
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-03-2009 , 03:48 AM



On Jul 3, 12:58 pm, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
Quote:
"David BL" <davi... (AT) iinet (DOT) net.au> wrote in message

Quote:
Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.

I see your point, but I still think that assigning components artificial
identifiers is better: the unordered pairs could be replaced with or
preprocessed into a single set per node prior to the determination of
isomorphism. For example,

{resistor1:lead1,capacitor2:lead1,transistor1:lead 2}

discribes a node that connects a resistor and a capacitor to the base of a
transistor.

The above contains the same information as the unordered pairs

{{resistor1:lead1,capacitor2:lead1},
{resistor1:lead1,transistor1:lead2}}

without either the arbitrariness or the redundancy you seek to avoid.
I cannot tell which approach is better. Anyway, the point I find
interesting is that in both cases nesting can ensure the schema meets
the given requirements for logical equivalence of circuit values.

Reply With Quote
  #7  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-04-2009 , 05:13 AM



"David BL" <davidbl (AT) iinet (DOT) net.au> wrote

Quote:
On Jul 3, 12:58 pm, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
"David BL" <davi... (AT) iinet (DOT) net.au> wrote in message


Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.

I see your point, but I still think that assigning components artificial
identifiers is better: the unordered pairs could be replaced with or
preprocessed into a single set per node prior to the determination of
isomorphism. For example,

{resistor1:lead1,capacitor2:lead1,transistor1:lead 2}

discribes a node that connects a resistor and a capacitor to the base of
a
transistor.

The above contains the same information as the unordered pairs

{{resistor1:lead1,capacitor2:lead1},
{resistor1:lead1,transistor1:lead2}}

without either the arbitrariness or the redundancy you seek to avoid.

I cannot tell which approach is better. Anyway, the point I find
interesting is that in both cases nesting can ensure the schema meets
the given requirements for logical equivalence of circuit values.
I think that this is the perfect counterexample to some of the myths that
are perpetuated here on cdt. It illustrates valid uses of both artificial
identifiers and nesting. I think one would be hard pressed to come up with
a solution that doesn't involve the use of artificial identifiers. The
nesting can, of course, be dispensed with through the introduction of
additional artificial identifiers.

Reply With Quote
  #8  
Old   
Roy Hann
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-06-2009 , 03:17 AM



Brian Selzer wrote:

Quote:
"David BL" <davidbl (AT) iinet (DOT) net.au> wrote in message
news:095c8b9d-eb68-4a39-acdf-942d5db07b2e (AT) y10g2000prf (DOT) googlegroups.com...
On Jul 3, 12:58 pm, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
"David BL" <davi... (AT) iinet (DOT) net.au> wrote in message


Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.

I see your point, but I still think that assigning components artificial
identifiers is better: the unordered pairs could be replaced with or
preprocessed into a single set per node prior to the determination of
isomorphism. For example,

{resistor1:lead1,capacitor2:lead1,transistor1:lead 2}

discribes a node that connects a resistor and a capacitor to the base of
a
transistor.

The above contains the same information as the unordered pairs

{{resistor1:lead1,capacitor2:lead1},
{resistor1:lead1,transistor1:lead2}}

without either the arbitrariness or the redundancy you seek to avoid.

I cannot tell which approach is better. Anyway, the point I find
interesting is that in both cases nesting can ensure the schema meets
the given requirements for logical equivalence of circuit values.

I think that this is the perfect counterexample to some of the myths that
are perpetuated here on cdt. It illustrates valid uses of both artificial
identifiers and nesting. I think one would be hard pressed to come up with
a solution that doesn't involve the use of artificial identifiers. The
nesting can, of course, be dispensed with through the introduction of
additional artificial identifiers.
I think it is a perfect example of wondering why chisels don't make
good screwdrivers.

--
Roy

Reply With Quote
  #9  
Old   
David BL
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-06-2009 , 07:18 AM



On Jul 6, 4:17 pm, Roy Hann <specia... (AT) processed (DOT) almost.meat> wrote:
Quote:
Brian Selzer wrote:

I think that this is the perfect counterexample to some of the myths that
are perpetuated here on cdt. It illustrates valid uses of both artificial
identifiers and nesting. I think one would be hard pressed to come up with
a solution that doesn't involve the use of artificial identifiers. The
nesting can, of course, be dispensed with through the introduction of
additional artificial identifiers.

I think it is a perfect example of wondering why chisels don't make
good screwdrivers.
Are you suggesting the RM is poorly suited to representing circuit
values? I think this is an important question. I don't see much
evidence that the RM is particularly useful here.

For example, to perform a nodal analysis one may associate a voltage
with each labelled node and use Kirchoff's voltage and current laws to
create a large system of simultaneous equations. This in turn may
require sparse matrix techniques for efficient computation. I don't
see anything in the RA that will help do numerical analysis.

In fact I'm not entirely sure why one would want to use the RA at
all. Is it useful to find all the resistors connected to a 5pF
capacitor? If pattern matching is useful I expect the RA isn't as
appropriate as some kind of graph based unification technique.

Nevertheless, complex circuits may contain millions of components and
as data it needs to be managed - i.e. there needs to be a DBMS
providing persistence, multi-user support, data entry validation etc.

Reply With Quote
  #10  
Old   
Brian Selzer
 
Posts: n/a

Default Re: Using the RM for ADTs - 07-07-2009 , 10:43 AM



"Roy Hann" <specially (AT) processed (DOT) almost.meat> wrote

Quote:
Brian Selzer wrote:


"David BL" <davidbl (AT) iinet (DOT) net.au> wrote in message
news:095c8b9d-eb68-4a39-acdf-942d5db07b2e (AT) y10g2000prf (DOT) googlegroups.com...
On Jul 3, 12:58 pm, "Brian Selzer" <br... (AT) selzer-software (DOT) com> wrote:
"David BL" <davi... (AT) iinet (DOT) net.au> wrote in message


Consider a node to which n components are connected and n is large.
Using pairwise connections can either be exceedingly arbitrary (by
only representing n-1 pairs) or it makes for enormous redundancy (by
representing all n(n-1)/2 pairs).

I think this is much worse that the symmetry problem with resistors.

I see your point, but I still think that assigning components
artificial
identifiers is better: the unordered pairs could be replaced with or
preprocessed into a single set per node prior to the determination of
isomorphism. For example,

{resistor1:lead1,capacitor2:lead1,transistor1:lead 2}

discribes a node that connects a resistor and a capacitor to the base
of
a
transistor.

The above contains the same information as the unordered pairs

{{resistor1:lead1,capacitor2:lead1},
{resistor1:lead1,transistor1:lead2}}

without either the arbitrariness or the redundancy you seek to avoid.

I cannot tell which approach is better. Anyway, the point I find
interesting is that in both cases nesting can ensure the schema meets
the given requirements for logical equivalence of circuit values.

I think that this is the perfect counterexample to some of the myths that
are perpetuated here on cdt. It illustrates valid uses of both
artificial
identifiers and nesting. I think one would be hard pressed to come up
with
a solution that doesn't involve the use of artificial identifiers. The
nesting can, of course, be dispensed with through the introduction of
additional artificial identifiers.

I think it is a perfect example of wondering why chisels don't make
good screwdrivers.
I don't understand why you scoff:

Here is a case in which what defines something is how it stands in relation
to other things rather than just a collection of properties. A typical
circuit template may call for several 1K resistors, but apart from the
resistance, precision and power rating, what defines each include the nodes
that its leads are connected to. This is also a case in which what defines
something is a collection of other things rather than just a collection of
properties. Each node in a circuit template is defined entirely by the
component leads that it connects. In a circuit template, resistors and
capacitors or just components in general are not physical objects--neither
are nodes, yet despite their lack of substance, it is intuitively obvious
that each component or node should still be distinguishable from all other
components and nodes in the same template; however, the expression of that
intuition in a first-order language without assigning arbitrary names
(artifical identifiers) to each component or to each node is anything but
obvious.

But what I find most interesting is the compactness and lack of redundancy
in the design above where each node is modeled as a single collection of two
or more component leads as opposed to the one where each node is modeled as
one or more uniform pairs of component leads. Of course the former would
require a constraint that guarantees that the collections be pairwise
disjoint.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.