Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: object algebra

Re: object algebra

From: Neo <neo55592_at_hotmail.com>
Date: 25 Feb 2004 17:09:33 -0800
Message-ID: <4b45d3ad.0402251709.7cc08a69@posting.google.com>


> And now please write a query that returns an aggregate age of all persons.
> In this schema with SQL, or with Neo's school science fair project.

// Psuedo code to calc age of all unique persons under selected node // Step thru unique descendant's of God

   int ageTotal = 0;
   int* pDesc_a[kMAX_TREE_DEPTH] = {pGod};    while (int i = T_Relatives(pDesc_a, kCREATURE, kUNIQUE)){

     int* pThing = pDesc_a[i];
     if (IsAncestorOf(pPersonCls, pThing)){
       int* pAge = T_Property_get(pThing, pAgeCls);
       if (pAge){
         sAge = T_Symbol_get(pAge);
         ageTotal = ageTotal + ConvertSymbolToInteger(sAge);
       }
     }

   }

XDb1 has transitive closure.
For actual code to a related problem, see www.xdb1.com/Example/Ex075b.asp Received on Wed Feb 25 2004 - 19:09:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US