Importing OWL Files into a SADL Model

Last revised 2010-03-12 by A. W. Crapo.


SADL exists to help create models expressed in the Web Ontology Language (OWL). Of course the idea is that we will reuse models rather than reinvent them where ever possible. Obviously SADL should support the reuse of existing OWL models. In the modular world of the Semantic Web, reusing an OWL model means to import the model, extend it as necessary by adding or refining concepts or by adding rules, and then exercise the model for some purpose.

Namespace Versus Location

When a model is persisted in a file, whether the file be a SADL model or an OWL model, there are two concepts at play. First, what is the default or base namespace of the model. This is the namespace that a concept is assumed to be in if a namespace isn't explicitly stated. The second is the location of the file--the actual URL from which the file content can retrieved.

You will recall that in a SADL model, the namespace of the model is the first statement in the model. Here are the name statements from two models:

        uri "http://sadl.imp/Exercise10t".

The location of SADL model is the location of the file. Since the file is a resource in an Eclipse project, we can specify the location in a relative manner, making it easy for a project to be moved to other locations and used by other people. Obviously the location of a file should not be contained within the file itself. When a SADL model imports another SADL model the file name (the relative location rather than the namespace) of the imported model is used to identify it. Here's the namespace and the import statement from a model that imports "http://sadl.imp/Exercise10t":

      uri "http://sadl.imp/Exercise10a".
"file://Exercise10t.sadl" as Exercise10t.

However, once translated to OWL both the importing model and the imported model will be identified by namespace, not location, in the importing model. The import above, in OWL RDF/XML, looks like this:

    <owl:Ontology rdf:about="http://sadl.imp/Exercise10a">
        <owl:imports rdf:resource="http://sadl.imp/Exercise10t"/>

Importing OWL into SADL

It is expected that an OWL file will probably not exist inside of a SADL Eclipse project, or if it does that it is only a copy of the file placed there for convenience, e.g., to make it accessible even if network connectivity is not available. With this anticipation, when we import an OWL model into a SADL model, we will reference the imported model by its namespace URI. Note that the namespace URI may or may not correspond to an actual URL from which content can be retrieved. The missing piece is the mapping from namespace URI to actual location. Since the SADL-IDE uses the Jena Framework, we will use the Jena mechanism to accomplish this mapping.

In Jena terminology, the namespace URI is sometimes called the "publicURI" whereas the actual location is called the "altURL". Jena captures the mapping between the two, along with some additional information, in an RDF format in a file named, by default, "ont-policy.rdf". If you are importing OWL models into your SADL models, you will need to place an "ont-policy.rdf" file in the OwlModels project folder and provide an "OntologySpec" for each OWL model you wish to import.

As an example, consider the OWL model whose publicURI is "". The necessary segment of the ont-policy.rdf file in the OwlModels folder will look like this:

            <altURL rdf:resource="file:///D:/testsadl/sadl/eclipse/workspace/SemanticsForSmartGridModels/OtherOwlAltUrl/time.owl"/>
            <language rdf:resource=""/>
            <publicURI rdf:resource=""/>

The altURL must be altered for any specific application to reflect the actual location of the file on the host filesystem. Note that the publicURI does NOT change but is a property of the referenced model itself.