Return-Path: pg_adm@postgres.berkeley.edu
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA14002; Thu, 3 Dec 92 11:35:35 -0800
Date: Thu, 3 Dec 92 11:35:35 -0800
Message-Id: <9212031935.AA14002@postgres.Berkeley.EDU>
From: dchoman@isrc.sandia.gov (Dan C. Homan)
Subject: Defining Types and Classes
To: postgres@postgres.berkeley.edu
Sender: pg_adm@postgres.berkeley.edu
Cc: dchoman@herring

Confession
  I come from a pre-object-oriented Rdb/VMS relational database background.
  While the concept of objects is pretty straight-forward, I confess to
  some difficulty in adapting to the mindset.
End Confession

What I am trying to put together is an object which contains everything
that a robot could want to know about stations within its workcell.

A STATION contains:
	Station_Type		char16
	Station_ID		ushort
	Station_Position	POSITION
	Home_Position		POSITION
	View_Position(n)	POSITION  [1 or more]
	Handler_Spec(n)		HANDLER   [1 or more]

A HANDLER contains:
	HANDLER_ID		ushort
	APPROACH_PATH		PATH
	Position		POSITION
	DEPART_PATH		PATH

A PATH	contains:
	Position(n)		POSITION  [1 or more]

A POSITION contains:
	POINT  (in caps =  my datatype, not the Postgres type "point")
	ORIENTATION

A POINT contains:
	X			float4
	Y			float4
	Z			float4

An ORIENTAION contains:
	ALPHA			float4
	BETA			float4
	GAMMA			float4

I also need an object of type LINE which is made of two (2) POINTS.


I have taken a few stabs at creating this STATION object, starting at the
bottom, and things have gone OK for a while;

	create POINT3 (x=float4,y=float4,z=float4)

	create ORIENT (alpha=float4,beta=float4,gamma=float4)

	create POSITION (posnum=ushort) inherits (POINT3, ORIENT)

	create PATH (pathname=char16) inherits (POSITION)
		[all is fine up to here]

	create HANDLER_SPEC (id=ushort,approach=char16,
	handler_pos=POSITION,depart=char16)

Query sent to backend is "<create statement above>"
NOTICE:Nov 30 14:52:06:cannot create attribute of type POSITION
 
WARN:Nov 30 14:52:06:use functions to get complex objects
 
The above is the same error that I got when I tried to stick a PATH
directly into the definition (i.e., approach=PATH), so I decided
to break PATH out as a separate relation, indexed by pathname.

There are many examples of failed attempts, but I think you get the
idea.  If any of you out there have any time left after reading this
post, I would *really* appreciate some guidance.

ObGuilt: Of course, I can _always_ do it strictly relationally!  :)

Thanks for your time,

Dan C. Homan
Intelligent Systems and Robotics Center
Department 1671
Sandia National Laboratories
Albuquerque, New Mexico, 87185

email: dchoman@isrc.sandia.gov
voice: (505) 844-9418
fax:   (505) 844-3764
