- From: Mark Birbeck <Mark.Birbeck@iedigital.net>
- Date: Tue, 27 Jun 2000 14:34:22 +0100
- To: www-rdf-interest@w3.org
I think what you have to be careful of is the fact that RDF does not define how restrictions are enforced. So if you define a range as being any object of type Person, say, that doesn't mean that anything will necessarily happen if a property contains a reference to a class that is not of type Person - or a sub-class of it. That said, one solution is to first define the class that defines the range and then specify the possible objects that instantiate that class. So we define the class: <rdfs:Class rdf:ID="Month" /> and then instantiate: <Month rdf:ID="Jan" /> <Month rdf:ID="Feb" /> <Month rdf:ID="Mar" /> . . . <Month rdf:ID="Dec" /> Now in what manner your application enforces or makes use of this: <rdf:Property ID="month"> <rdfs:range rdf:resource="#Month" /> <rdfs:domain rdf:resource="#Date"/> </rdf:Property> is going to be up to your application. If it is a data entry tool then it can find instances of #Month and show a drop-box with all of the possible months in to choose from. Alternatively, if presented with this: <Date ...> <Month rdf:resource="#Jan" /> </Date> a validator could look up #Jan, then check the type of the object that #Jan is. The solution that you seem to be hinting at is to add properties to the RDFS class 'Range'. I think this is an altogether different kettle of fish because the only way you could do this would be to extend the RDF Schema definitions, and you couldn't guarantee that other processes would pick up your extensions - or even work out the base class of your objects should it ignore your extensions. First, what you seem to be trying to do is extend the Range class, which is not very OO, because you only want the range tests on properties of type Day, Month and Year, and NOT all classes. Second, if you introduce a new class called x:monthRange that is a sub-class of rdfs:Range that then has your properties, I don't know whether other processors are forced to follow the subclass in situations like this: <rdf:Property ID="month"> <x:monthRange rdf:resource="#Month" /> <rdfs:domain rdf:resource="#Date"/> </rdf:Property> In other words, will a parser check the base type of x:monthRange, or will it just be ignored because it is not in the RDF or RDFS namespaces? Anyone else got any thoughts on this issue? Best regards, Mark Birbeck x-port.net > -----Original Message----- > From: Tom Van Eetvelde [mailto:tom.van_eetvelde@alcatel.be] > Sent: 27 June 2000 11:27 > To: www-rdf-interest@w3.org > Subject: How to restrict the possible values of a class? > > > Hello RDF community, > > I have the following practical problem: how can I restrict > classes/properties to certain values? I > ran into this problem with the creation of a Date class: > > <rdfs:Class rdf:ID="Range"> > <rdfs:Label> Range </rdfs:Label> > <rdfs:comment> > This class represents an interval. > </rdfs:comment> > <rdfs:subClassOf rdf:resource="#CompositeValue"/> > </rdfs:Class> > > <rdfs:Property rdf:ID="gr"> > <rdfs:label> gr </rdfs:label> > <rdfs:comment> > The 'GReater than' property. Defines a lower boundary of > the range. > </rdfs:comment> > <rdfs:domain rdf:resource="#Range"/> > </rdfs:Property> > > <rdfs:Property rdf:ID="ge"> > <rdfs:label> ge </rdfs:label> > <rdfs:comment> > The 'Greater than or Equals' property. Defines a lower > boundary of the range. > </rdfs:comment> > <rdfs:domain rdf:resource="#Range"/> > </rdfs:Property> > > <rdfs:Property rdf:ID="ls"> > <rdfs:label> ls </rdfs:label> > <rdfs:comment> > The 'LeSs than' property. Defines an upper boundary of the range. > </rdfs:comment> > <rdfs:domain rdf:resource="#Range"/> > </rdfs:Property> > > <rdfs:Property rdf:ID="le"> > <rdfs:label> le </rdfs:label> > <rdfs:comment> > The 'Less than or Equals' property. Defines an upper > boundary of the range. > </rdfs:comment> > <rdfs:domain rdf:resource="#Range"/> > </rdfs:Property> > > <rdfs:Class rdf:ID="Date"> > <rdfs:Label> Date </rdfs:Label> > <rdfs:comment> > This class represents a date in the format DD/MM/YYYY > (day-month-year). > </rdfs:comment> > <rdfs:subClassOf rdf:resource="#CompositeValue"/> > </rdfs:Class> > > <rdfs:Property rdf:ID="day"> > <rdfs:label> day </rdfs:label> > <rdfs:comment> > The day part of the date. > </rdfs:comment> > <rdfs:domain rdf:resource="#Date"/> > <rdfs:range rdf:resource="#DayRange"/> > </rdfs:Property> > > <rdfs:Property rdf:ID="month"> > <rdfs:label> month </rdfs:label> > <rdfs:comment> > The month part of the date. > </rdfs:comment> > <rdfs:domain rdf:resource="#Date"/> > <rdfs:range rdf:resource="#MonthRange"/> > </rdfs:Property> > > <rdfs:Property rdf:ID="year"> > <rdfs:label> year </rdfs:label> > <rdfs:comment> > The year part of the date. > </rdfs:comment> > <rdfs:domain rdf:resource="#Date"/> > <rdfs:range rdf:resource="#YearRange"/> > </rdfs:Property> > > The RDF Shema Spec literally says that 'domain' and 'range' > may only have values of the type > 'class'. I wanted to make DayRange an instance of the Range > class with properties ge = 1 and le = > 31. But clearly, the Spec forbids this as I would have a > value type of Range <> Class. So, how can I > indicate that the Dayrange runs from 1 to 31 (similar > question for month and year)? > > Regards, > > Tom. >
Received on Tuesday, 27 June 2000 09:29:12 UTC