471,353 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,353 software developers and data experts.

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

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

Sep 11 '06 #1
1 856
Hendrik van Rooyen wrote:
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.

--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Sep 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Maarten van Reeuwijk | last post: by
1 post views Thread by Yasso Picasso | last post: by
36 posts views Thread by zouyongbin | last post: by
3 posts views Thread by perfectclick.ng | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.