Is there a way to take a priori knowledge out of field definitions?

H

Hendrik van Rooyen

Hi,

It is possible to build a system where the fields are "self defining" : -

One way is to keep a dictionary of tags and descriptors, and to keep "the data"
in a dictionary using the same tags as keys, with values - an oversimplified
example:

DefinitionDict = {1:'Quantity',2:'Price',3:'Value'}

DataItemDict = {1:10,2:3.50,3:35.00}

This is conceptually not much different to putting headers on columns in a
database table or a spreadsheet, with the data item being a row, or to HT or
XML.

Now obviously the definitions need not be single valued strings, but could be
multivalues, for use at different times, such as for gui displaying, for
printing, etc, and could also hold type information, as most databases do.

Up to this point, there is no a priori human knowledge mixed in with the data
that has not been written down.

However, when we want to make say a validation rule, such as Quantity times
Price must equal Value, then we are using a priori knowledge about the data to
formulate this.

At this point, if a routine is written to check that DataItemDict[1] multiplied
by DataItemDict[2] is indeed equal to DataItemDict[3], then we are casting the
meanings into stone, and the flexibility of the structure is to a large extent
lost.

Now if I want to make a system where these sort of rules, as well as more
complicated ones, are also definable - Is there a way to do it simply and
cleanly - a way to expand the DefinitionDict so that it contains all of what we
know about the structure and relationships of and between the items of data?

It seems to me that if this could be done, then it could be used to dynamically
generate the routines needed for validation, update, etc...

But my brain strains when I try to think about how to do it...

- Hendrik
 
B

Bruno Desthuilliers

Hendrik said:
Hi,

It is possible to build a system where the fields are "self defining" : -

One way is to keep a dictionary of tags and descriptors, and to keep "the data"
in a dictionary using the same tags as keys, with values - an oversimplified
example:

DefinitionDict = {1:'Quantity',2:'Price',3:'Value'}

DataItemDict = {1:10,2:3.50,3:35.00}

This is conceptually not much different to putting headers on columns in a
database table or a spreadsheet, with the data item being a row, or to HT or
XML.

Now obviously the definitions need not be single valued strings, but could be
multivalues, for use at different times, such as for gui displaying, for
printing, etc, and could also hold type information, as most databases do.

Up to this point, there is no a priori human knowledge mixed in with the data
that has not been written down.

However, when we want to make say a validation rule, such as Quantity times
Price must equal Value, then we are using a priori knowledge about the data to
formulate this.

At this point, if a routine is written to check that DataItemDict[1] multiplied
by DataItemDict[2] is indeed equal to DataItemDict[3], then we are casting the
meanings into stone, and the flexibility of the structure is to a large extent
lost.

Now if I want to make a system where these sort of rules, as well as more
complicated ones, are also definable - Is there a way to do it simply and
cleanly - a way to expand the DefinitionDict so that it contains all of what we
know about the structure and relationships of and between the items of data?

Looks a lot like a RDBMS...
It seems to me that if this could be done, then it could be used to dynamically
generate the routines needed for validation, update, etc...

But my brain strains when I try to think about how to do it...

You may want to have a look at the descriptor protocol and packages like
traits and FormEncode.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top