![]() |
| Previous Top Next |
Declaring Namespaces |
In this part of the tutorial, you are creating an OWL Lite ontology for Altova products using a custom-made vocabulary which belongs to a unique namespace. Before starting to use this vocabulary in the ontology, you must, in the interests of good practice, declare the namespace for the vocabulary, as well as any other namespaces you require. Declaring the required namespaces is what you will do in this section. In the course of carrying out these steps, you will also see the RDF/XML format of your ontology in Text View.
Text View of SemanticWorks
To see how the RDF/XML representation of the newly created ontology looks, click the Text View button at the bottom of the Main Window. The Text View will look something like this.

Notice that there is a single element rdf:RDF, which is the root element of every OWL ontology. It has three namespace declarations (for the RDF, RDFS, and OWL namespaces). SemanticWorks inserts the RDF, RDFS, and OWL namespaces by default; they are required so as to be able to use RDF, RDFS, and OWL elements and attributes in the ontology document.
Note: You can configure Text View fonts in the Options dialog (Tools | Options).
Declaring namespaces for the ontology document
Your Altova product vocabulary will use the namespace http://www.altova.com/ontologies/product#, and this needs to be declared. You will also need to declare the XML Schema namespace so you can use the XML Schema datatypes for OWL datatype properties. Declare namespaces as follows:
| 1. | Select RDF/OWL View. |
| 2. | Select the command Tools | URIref Prefixes. This pops up the URIref Prefixes dialog. |

| 3. | In this dialog, click the Add button to add a line for a new namespace declaration. |
| 4. | In the Prefix column, enter prod. In the URI column, enter http://www.altova.com/ontologies/product#. |
| 5. | Next, add the XML Schema namespace http://www.w3.org/2001/XMLSchema#, giving it a prefix of xsd. The URIref Prefixes dialog will look something like this: |

| 5. | Switch to Text View to check that the newly declared namespaces have been correctly added. |
You have now declared all the namespaces for your ontology, and you can now start creating ontology items.
Note:
| • | It is important to declare namespaces at the very outset. This ensures that URIref prefixes used in the names of ontology items are correctly expanded to the relevant namespaces when a new ontology item is created. If a namespace has not been declared, then the URIref prefix associated with that namespace, when used in the name of an item, will not be expanded to that namespace. |
| • | The expansion of a URIref prefix to a namespace will not take place even if: (i) the relevant namespace is declared subsequent to the creation of an item; or (ii) if the ontology item is renamed after the namespace is declared but was created before the namespace was declared. |
| • | Ontology items with unexpanded prefixes might not be correctly recognized. |
|