www.altova.com
Previous  Top  Next

Creating Classes


In this tutorial, we will build the ontology using a generally top-down approach. Whatever approach one chooses, it is usual to start by defining classes. In this section you will learn how to create three classes in RDF/OWL View: Product, XMLSpy, and Edition, and check the ontology for correct syntax and semantics.

 

 

Creating new classes

SemanticWorks enables you to name classes so that they are represented in the RDF/XML serialization using either (i) namespace prefixes to stand for the namespace URI,  or (ii) the full URIref (that is, with the prefix expanded). You will create the classes Product and XMLSpy using a different serialization method for each. Do this as follows:

 

1.In the Classes tab of RDF/OWL View, click the Add New button and select owl:Class.

 

ss_tut_add_new_class

 

This creates a line for the class in the Classes Overview.

2.With urn:Unnamed-1 in the newly created class entry line highlighted, type in prod:Product, and press Enter.

 

ss_tut_new_class_created

 

This creates a class with a URIref of  http://www.altova.com/ontologies/product#Product. Switch to Text View to see how the class has been serialized in RDF/XML. You will see something like this:

 

<rdf:Description rdf:about="http://www.altova.com/ontologies/product#Product">

   <rdf:type>

       <rdf:Description rdf:about="http://www.w3.org/2002/07/owl#Class"/>

   </rdf:type>

</rdf:Description>

 

Notice that the class name has been serialized as an expanded URIref. This is because the Expand URIref Prefixes option (Tools | Expand URIref Prefixes in RDF/OWL View) has been toggled on. Notice also that, although the URIref has been expanded in its serialized form, it is shown in RDF/OWL View as prod:Product, that is, with a prefix for the namespace part of the URIref. In RDF/OWL View, URIrefs are shown in the form in which they are entered.

3.In RDF/OWL View, create two new classes and name them prod:XMLSpy and prod:Edition. In Text View, you will see that the two new classes have been serialized as expanded URIrefs. In RDF/OWL View, the URIrefs are shown in the form in which they were entered (that is, prod:XMLSpy and prod:Edition).

 

 

URIrefs with Prefixes, and How to Delete a Class

 

If you wish to serialize the RDF/XML using URIref prefixes instead of expanded URIrefs, click the Expand URIref Prefixes toolbar icon ic_expand_uriref_prefixes so as to deselect it. Identifiers created from now onwards (and till this option is toggled on again) will be serialized with names in the form prefix:localname.

 

From now on, every input is solely understood as a URI (absolute or relative) and is not understood as prefix-and-local-name. That is, prefixes that would have been expanded to a URI part when the option is activated are now simply used as the scheme part of the URI that is entered. Note that all relative URIs will be resolved against the document's global base URI. Furthermore, note that choices offered by dropdown boxes are also affected by this option; so if the setting is that URIref prefixes are not expanded, dropdown boxes always show full URIs instead of abbreviated URIrefs.

 

To see how unexpanded URIrefs are serialized, do the following:

 

1.Delete the class XMLSpy (by selecting it and clicking Edit | Delete).
2.Deselect Expand URIref Prefixes so it is toggled off.
3.Re-create the class XMLSpy, naming it prod:XMLSpy.

 

The Text View will show the class serialized as prod:XMLSpy with the prefix unexpanded.

 

If you do try this out, be sure to once again delete the XMLSpy class and re-create it as it was originally created, that is with URIref prefixes expanded.

 

 

Checking the ontology

You now have a simple ontology that declares three URIrefs to be three unrelated OWL classes. To check the syntax of the ontology, click the Syntax Check icon ic_well_formedness in the toolbar (RDF/OWL menu). The message This ontology is well-formed appears in the Errors Window. Now check the semantics of the ontology by clicking the Semantics Check icon ic_validate in the toolbar. The message This ontology is at least partially consistent appears in the Errors Window. This is a valid ontology (has correct syntax and is partially consistent), but does not provide much information about the three classes. (For more information on consistency evaluation, see Semantics Check.)

 

In the next sections of the tutorial, you will create the class hierarchy, which will link classes semantically with each other.

 


Previous  Top  Next

© 2008 Altova