<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=iso-8859-1 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16490"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT size=2 face=Calibri>Hi list,</FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>I need to create some objects from their oid. But
I noticed that there is always created an object of the given type even if
there is no object stored with the passed oid or if there is stored another
object (another class) with the passed oid.</FONT></DIV>
<DIV><FONT size=2 face=Calibri>Here is a simple example of this
problem:</FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>CL-USER> (elephant:defpclass TopicC
()<BR> ((id :accessor id<BR>
:initarg :id<BR> :index
t)<BR> (name :accessor
name<BR> :initarg
:name<BR> :index t))<BR> (:index
t))<BR>#<ELEPHANT:PERSISTENT-METACLASS TOPICC><BR>CL-USER>
(elephant:defpclass OccurrenceC ()<BR> ((id
:accessor id<BR> :initarg :id<BR> :index
t)<BR> (value :accessor
value<BR> :initarg
:value<BR> :index
t))<BR> (:index
t))<BR>#<ELEPHANT:PERSISTENT-METACLASS OCCURRENCEC></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Calibri>CL-USER> (make-instance 'TopicC :id "top-1"
:name "name-1")<BR>#<TOPICC oid:2><BR>CL-USER> (make-instance
'OccurrenceC :id "occ-1" :value "value-1")<BR>#<OCCURRENCEC
oid:5></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Calibri>CL-USER> (make-instance 'TopicC :from-oid
5)<BR>#<TOPICC oid:5><BR>CL-USER> (type-of (make-instance 'TopicC
:from-oid 5))<BR>TOPICC</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=Calibri>CL-USER> (id (make-instance 'TopicC :from-oid
5))<BR>"occ-1"<BR>CL-USER> (name (make-instance 'TopicC :from-oid
5))<BR>;causes the following error:<BR>;The slot NAME is unbound in the object
#<TOPICC oid:5>.<BR>; [Condition of type
UNBOUND-SLOT]<BR>CL-USER> (value (make-instance 'TopicC :from-oid
5))<BR>;causes the following error:<BR>;There is no applicable method for the
generic function<BR>; #<STANDARD-GENERIC-FUNCTION VALUE
(1)><BR>;when called with arguments<BR>; (#<TOPICC
oid:5>).<BR>; [Condition of type SIMPLE-ERROR]</FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>CL-USER> (make-instance 'TopicC :from-oid 999)
;works even if the passed oid does not exist<BR>#<TOPICC
oid:999></FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>So when I use an oid that stores an object that
is not of the given class, there is no error thrown or no warning.</FONT></DIV>
<DIV><FONT size=2 face=Calibri>Is there any possibility to be sure that the
given oid stores an object of the given class?</FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>Best regards</FONT></DIV>
<DIV><FONT size=2 face=Calibri></FONT> </DIV>
<DIV><FONT size=2 face=Calibri>Lukas</FONT></DIV></BODY></HTML>