Re: How to restrict the possible values of a class?

Thanks to all the people that contributed to the brainstorm!

Below solution is the one I was looking for. Can you put a name to this technique Pierre-Antoine? I
am not an OO expert. Your solution looks like multiple inheritance, but I am sure it is not. You
once mentioned Meta-classes. Is this what they are: instances that are classes themselves?

I tried to come up with an explanation myself and this is my synthesis. A class describes a set of
objects. Instantiating a class means picking out a specific object from the set. In this case,
'Range' is a set of sets. Range objects are e.g. [0,2], [aaa,bbb] (lexical ordering), [-10, 1000],
etc. When I instantiate 'Range', I pick out an object from the set, e.g. [0,2]. This instance
however describes the set of integers from 0 to 2, which is again a set of objects. Therefore, [0,2]
is again a class. Instantiating the class means taking a number, e.g. 1.
So making an instance of 'Range' a subclass of 'Class' is the most elegant way of expressing that
the instance is again a Class!

I think this summarizes the situation, but still, I don't know how this construction is called in OO
terms :-).

Regards,

Tom.

Pierre-Antoine CHAMPIN wrote:

> "McBride, Brian" wrote:
> >
> > >
> > >It does not seem right to me that DayRange be a subclass of Range :
> > >typically, Range is a class and DayRange is the instance,
> > >but DayRange may ALSO be a class (in which case Range is a metaclass)
> > >
> > >This is absolutely possible in RDF,
> > >you just have to declare that Range is a subclass of class
> > >(and that is IS also a class, as you did - both things are different !)
> > >
> >
> > Yup - thats much cleaner.  To answer Tom's request for RDF:
> >
> > <rdfs:Class rdf:ID='DayRange'>
> >   <rdf:type rdf:resource='#Range'/>
> >   <thisNameSpace:ge>0</thisNameSpace:ge>
> >   <thisNameSpace:le>31</thisNameSpace:le>
> > </rdfs:Class>
> >
> > Does that do it?
>
> absolutely, furthermore, we have
>
> <rdfs:Class rdf:ID='Range'>
>    <rdfs:subClassOf rdf:resource='&rdfs;Class'/>
> </rdfs:Class>
>
> so Range IS a class, then it can have instances
> and it is a SUBCLASS of class, then its instances are also instance of class
> -> DayRange, as an instance of Range, has type Class
>
>  hope this helps
>
>   Pierre-Antoine
>
> --- Quid quid Latine dictum sit, altum viditur
>     Whatever is said in Latin sounds important.

Received on Tuesday, 27 June 2000 12:07:14 UTC