www.altova.com
Previous  Top  Next

Describing Classes and Their Instances


In this section you will make class descriptions that specify restrictions and define detailed relationships between classes. Specifically, we wish to define that:

 

The WebPage class is a union of the EnglishWebPage and GermanWebPage classes.
The WebPage class has a restriction specifying that all its instances must have a dc:format property with an object that is the HTML instance.
An instance of the EnglishWebPage class must be an instance of the WebPage class, with the restriction that its dc:language property have an object that is the EN instance.
An instance of the GermanWebPage class must be an instance of the WebPage class, with the restriction that its dc:language property have an object that is the DE instance.

 

After creating these descriptions, you will create instances of these classes to test the validity of the axioms you have defined.

 

 

Defining a class as a restricted union of classes

To define the WebPage class as a union of the EnglishWebPage and GermanWebPage classes, with a restriction that instances of the class have a dc:format property having a value that is the HTML instance, do the following:

 

1.In the Classes Overview, click the Detail View button of WebPage.
2.In the Detail View of WebPage, right-click the WebPage class box and select Add unionOf.
3.Right-click the unionOf connector, click Add Class from the context menu, and select doc:EnglishWebPage.
4.Right-click the unionOf connector, click Add Class from the context menu, and select doc:GermanWebPage.
5.Right-click the unionOf connector, click Add Restriction from the context menu, and select dc:format.
6.Right-click the Restriction box and select Add hasValue.
7.Right-click the hasValue box, click Add Resource Object, and select doc:HTML.

 

The Detail View should look like this:

 

ss_tut_odl_webpage_1

 

 

Defining a class as a restriction of another class

To define the EnglishWebPage class as an intersection of the WebPage class and the property dc:language having the EN instance as its object, do the following:

 

1.In the Classes Overview, click the Detail View button of EnglishWebPage.
2.In the Detail View of EnglishWebPage, right-click the subclassOf connector, click Add Restriction from the context menu, and select dc:language.
3.Right-click the Restriction box and select Add hasValue.
4.Right-click the hasValue box, click Add Resource Object, and select doc:EN.
5.Right-click the EnglishWebPage box, and select Add disjointWith.
6.Right-click the disjointWith box, click Add Class, and select doc:GermanWebPage.

 

The Detail View should look like this:

 

ss_tut_odl_englishwebpage_1

 

Define the GermanWebPage class similarly, with the difference that the dc:language restriction should be set to doc:DE and the class should be disjoint with the EnglishWebPage class.

 

 

Creating instances of restricted classes

Let us create an instance to denote the index page of the HTML version of the English user manual of the XMLSpy Enterprise edition. Create and define this instance as follows:

 

1.In the Instances Overview, click the Add New button to create an entry for a new instance. Name the instance doc:XMLSpyEnterpriseUserManualENHTML.
2.In the Detail View of the doc:XMLSpyEnterpriseUserManualENHTML instance, expand the rdf:type predicate box, double-click in the Resource Object box to pop up a down arrow on the right of the Resource Object box, and select doc:EnglishWebPage.

 

Run a semantics check. You will get a message saying that the ontology appears to be inconsistent. This is because an instance of the EnglishWebPage class must have the dc:format and dc:language properties set, to HTML and EN, respectively. Make these settings, together with that for the dc:date property, as follows:

 

1.Right-click the Instance box, click Add Predicate from the context menu, and select dc:format.
2.Right-click the predicate box, click Add Resource Object from the context menu, and select doc:HTML.
3.Right-click the Instance box, click Add Predicate from the context menu, and select dc:language.
4.Right-click the predicate box, click Add Resource Object from the context menu, and select doc:EN.
5.Run a semantics check to confirm adequate consistency.
6.Right-click the Instance box, click Add Predicate from the context menu, and select dc:date.
7.Right-click the predicate box, click Add Literal Object from the context menu, and type 2006-10-03 in the newly created Literal Object box. Select the datatype toggle (by clicking DT in the bottom half of the ic_datatype icon). Then click the down arrow of the combo box to display a dropdown list of available XML Schema datatypes, and select xsd:date.
8.Run a semantics check to confirm adequate consistency.

 

The Detail View should look like this:

 

ss_tut_odl_inst_spyumanhtmlen

 

Create and define an instance called doc:XMLSpyEnterpriseUserManualDEHTML similarly, with the difference that (i) this will be an instance of the GermanWebPage class,  and (ii) the dc:language predicate should take doc:DE as its object.

 


Previous  Top  Next

© 2008 Altova