dbTalk Databases Forums  

Demo: Typed Quantites with Units

comp.databases.object comp.databases.object


Discuss Demo: Typed Quantites with Units in the comp.databases.object forum.



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

Default Demo: Typed Quantites with Units - 11-05-2004 , 05:05 PM






The XDb2 script listed below creates a 2kg dog named fido and a 2.2kg
cat named miffy. Each mass (2kg and 2.2kg) has a quantity (2 and 2.2)
and units (kg). In addition, the quantities (2 and 2.2) are typed as
integer or float in the db. See www.xdb2.com/Example/Ex110.asp for
details.

// Create necessary classes
CREATE2 *mass.cls = thing;
CREATE2 *qty.cls = thing;
CREATE2 *unit.cls = thing;
CREATE2 *type.cls = thing;

// Create qty 2 and type it as an integer
CREATE2 *;
CREATE2 it.name = +'2';
CREATE2 it.cls = qty;
CREATE2 it.type = +integer;

// Create qty 2.2 and type it as a float
CREATE2 *;
CREATE2 it.name = +'2.2';
CREATE2 it.cls = qty;
CREATE2 it.type = +float;

// Create mass 2kg
CREATE2 *;
CREATE2 it.cls = mass;
CREATE2 it.qty = (%.cls=qty & %.name='2');
CREATE2 it.unit = +kg;

// Create mass 2.2kg
CREATE2 *;
CREATE2 it.cls = mass;
CREATE2 it.qty = (%.cls=qty & %.name='2.2');
CREATE2 it.unit = +kg;

// Create a dog named fido and set his mass to 2kg
CREATE2 *dog.cls = thing;
CREATE2 *fido.cls = dog;
CREATE2 fido.mass = (%.cls=mass & %.qty=2 & %.unit=kg);

// Create a cat named miffy and set her mass to 2kg
CREATE2 *cat.cls = thing;
CREATE2 *miffy.cls = cat;
CREATE2 miffy.mass = (%.cls=mass & %.qty=2.2 & %.unit=kg);

// Query to find things whose mass is in units of kg
// Finds fido and miffy
SELECT2 %.mass=(%.cls=mass & %.unit=kg);

// Query to find mass instances whose qty is typed as float
// Finds 2.2 kg
SELECT2 %.cls=mass & %.qty=(%.type=float);

Reply With Quote
  #2  
Old   
Gene Wirchenko
 
Posts: n/a

Default Re: Demo: Typed Quantites with Units - 11-05-2004 , 07:55 PM






neo55592 (AT) hotmail (DOT) com (Neo) wrote:

Quote:
The XDb2 script listed below creates a 2kg dog named fido and a 2.2kg
cat named miffy. Each mass (2kg and 2.2kg) has a quantity (2 and 2.2)
I sure wish I could create a dog and cat out of nothing. OK,
maybe not. I am not allowed to have pets in my apartment.

[snip]

Sincerely,

Gene Wirchenko

Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.


Reply With Quote
  #3  
Old   
Neo
 
Posts: n/a

Default Re: Demo: Typed Quantites with Units - 11-06-2004 , 12:01 PM



Quote:
The XDb2 script listed below creates a 2kg dog named fido ...

I sure wish I could create a dog and cat out of nothing ...
Please show how to represent/query the equivalent (or similar) things
using your preferred methodology (ie RM, Objects, Haskell, C++, Third
Manifesto, Tutorial D, etc)?


Reply With Quote
  #4  
Old   
Laconic2
 
Posts: n/a

Default Re: Demo: Typed Quantites with Units - 11-06-2004 , 01:51 PM




"Neo" <neo55592 (AT) hotmail (DOT) com> wrote


Quote:
Please show how to represent/query the equivalent (or similar) things
using your preferred methodology (ie RM, Objects, Haskell, C++, Third
Manifesto, Tutorial D, etc)?
The above message is both redundant and NULL.

It's redundant because it's about the hundredth time you've started a
message with "Please show how".

It's NULL because it is content free.





Reply With Quote
  #5  
Old   
Lemming
 
Posts: n/a

Default Re: Demo: Typed Quantites with Units - 11-06-2004 , 07:25 PM



On Sat, 6 Nov 2004 14:51:31 -0500, "Laconic2" <laconic2 (AT) comcast (DOT) net>
wrote:

Quote:
"Neo" <neo55592 (AT) hotmail (DOT) com> wrote in message
news:4b45d3ad.0411061001.3d81ced8 (AT) posting (DOT) google.com...

Please show how to represent/query the equivalent (or similar) things
using your preferred methodology (ie RM, Objects, Haskell, C++, Third
Manifesto, Tutorial D, etc)?

The above message is both redundant and NULL.
Just like it's author.

Lemming
--
Curiosity *may* have killed Schrodinger's cat.


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.