www.altova.com
Previous  Top  Next

Declaring Instances


So far you have created three classes, Product, XMLSpy, and Edition, and two properties, the object property hasEdition and the datatype property version. You have defined both properties to apply to the XMLSpy class (by making this class the domain of the properties). Further, you have defined (i) the range of the hasEdition property (that is the values this property can take) to be instances of the Edition class, and (ii) the range of the version property to be a literal value of the XML Schema datatype positiveInteger.

 

In this section, you will first create three instances of the Edition class, which will be simple instances, and then three more complex instances of the XMLSpy class.

 

 

Creating simple instances

To create an instance of the Edition class, do the following:

 

1.In the Instances tab of RDF/OWL View, click the Add New button and select Instance. This creates an entry for an instance.
2.Enter prod:Enterprise as the name of the instance (screenshot below).

 

ss_tut_new_instance

 

3.Click the Detail View button of the prod:Enterprise entry to switch to Detail View, which will look something like this:

 

ss_tut_instance_detailview_1

 

4.Expand the rdf:type connector by clicking the plus symbol on its right-hand side. Detail View will now look something like this:

 

ss_tut_instance_detailview_2

 

5.Double-click the owl:Thing box, click the down arrow to drop down the list of available classes of which prod:Enterprise can be made an instance, and select prod:Edition (screenshot below).

 

ss_tut_instance_detailview_3

 

You have created prod:Enterprise as an instance of prod:Edition.

6.Check the syntax and semantics of your ontology. You should get messages saying the ontology is both well-formed and partially consistent.
7.Create two more instances of the Edition class, as described above, and call them prod:Professional and prod:Home, respectively.
8.Check that your ontology is well-formed and partially consistent, which it should be if you have done everything as described above.

 

You now have three instances of the Edition class: Enterprise, Professional, and Home.

 

Note:An alternative way of creating instances of a class is to go to the Detail View of that class, then right-click the class and select Add New Instance. The new instance is created and displayed in the Instances tab of Detail View. Name the instance as required.

 

 

Creating instances that have predicates (properties)

You will now create three instances of the XMLSpy class. These instances will each additionally be defined with the two properties, hasEdition and version, that apply to the XMLSpy class. Create these instances as follows:

 

1.In the Instances tab of RDF/OWL View, click the Add New button and select Instance. Name the instance prod:XMLSpyEnterprise.
2.Click the Detail View button of the prod:XMLSpyEnterprise entry to switch to Detail View.
3.Expand the rdf:type connector and select prod:XMLSpy. This defines XMLSpyEnterprise as an instance of the class XMLSpy. The Detail View will now look something like this:

 

ss_tut_instance_spyent_1

 

4.Right-click the XMLSpyEnterprise instance box, and select Add Predicate (screenshot below).

 

ss_tut_instance_spyent_2

 

5.In the property box, click the down arrow to drop down a list of properties defined for this class, and select prod:hasEdition (screenshot below).

 

ss_tut_instance_spyent_3

 

6.Right-click the prod:hasEdition property box and select Add Resource Object (screenshot below).

 

ss_tut_instance_spyent_4

 

7.Click the down arrow of the Resource Object box and click prod:Enterprise from the dropdown list of available instances (screenshot below).

 

ss_tut_instance_spyent_5

 

This defines that the object property hasEdition has the instance Enterprise (of the class Edition) as its object. Recall that you have set the range of the hasEdition property to be instances of the class Edition. If you check the semantics of the ontology, you will see that the ontology is valid (well-formed and partially consistent).

8.Double-click the Enterprise Resource Object box, select XMLSpyEnterprise, and do a semantic check. You will receive an error message saying that the resource object XMLSpyEnterprise is not within the range defined for the property hasEdition. Double-click the Enterprise Resource Object box, and select Enterprise again, which is what we want.
9.Right-click the XMLSpyEnterprise instance box, and select Add Predicate to add a second property.
10.Select the property prod:version from the dropdown list to add this property as a predicate.
11.Right-click and select Add Literal Object. (Recall that the version property has a literal value of the XML Schema datatype positiveInteger defined as its range. SemanticWorks automatically provides the correct entry helper.)
12.Enter 2006 at the blinking cursor in the Literal Object box, and click Enter. The Detail View should look something like this:

 

ss_tut_instance_spyent_6

 

The instance XMLSpyEnterprise has therefore been defined to:

 

Be an instance of the class XMLSpy,
Have an object property hasEdition that takes the instance Enterprise as its object, and
Have a datatype property version that takes the positiveInteger value 2006 as its literal value.

 

If you check the semantics of the ontology, you will see a message saying that the ontology is both well-formed and partially consistent. Now complete the ontology by creating two more instances of the XMLSpy class. Call them XMLSpyProfessional and XMLSpyHome, respectively. Define them just as you defined the XMLSpyEnterprise instance, with the only difference being that they should have the Professional and Home instances, respectively, as the objects of the hasEdition property.

 

 

Class instances in Classes Overview

You can see the instances of a selected class in the subsidiary Instances for Class window of the Classes Overview (Classes tab in the Ontology Overview). In the screenshot below, the class XMLSpy is selected. The Instances for Class subsidiary window shows the instances for the XMLSpy class.

 

ss_tut_classes_oview_instances

 

Click the Detail View button of an instance to go directly to the Detail View of that instance.

 


Previous  Top  Next

© 2008 Altova