com.hp.hpl.jena.ontology
Class OntModelSpec

java.lang.Object
  extended by com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
      extended by com.hp.hpl.jena.ontology.OntModelSpec
All Implemented Interfaces:
ModelSource, ModelSpec

public class OntModelSpec
extends com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
implements ModelSpec

Encapsulates a description of the components of an ontology model, including the storage scheme, reasoner and language profile.

Version:
CVS $Id: OntModelSpec.java,v 1.41 2005/10/06 14:41:27 chris-dollin Exp $
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static OntModelSpec DAML_MEM
          A specification for DAML models that are stored in memory and do no additional entailment reasoning
static OntModelSpec DAML_MEM_RDFS_INF
          A specification for DAML models that are stored in memory and use the RDFS inferencer for additional entailments
static OntModelSpec DAML_MEM_RULE_INF
          A specification for DAML models that are stored in memory and use a subset of the DAML semantic model additional entailments
static OntModelSpec DAML_MEM_TRANS_INF
          A specification for DAML models that are stored in memory and use the transitive reasoner for entailments
static OntModelSpec OWL_DL_MEM
          A specification for OWL DL models that are stored in memory and do no additional entailment reasoning
static OntModelSpec OWL_DL_MEM_RDFS_INF
          A specification for OWL DL models that are stored in memory and use the RDFS inferencer for additional entailments
static OntModelSpec OWL_DL_MEM_RULE_INF
          A specification for OWL DL models that are stored in memory and use the OWL rules inference engine for additional entailments
static OntModelSpec OWL_DL_MEM_TRANS_INF
          A specification for OWL DL models that are stored in memory and use the transitive inferencer for additional entailments
static OntModelSpec OWL_LITE_MEM
          A specification for OWL Lite models that are stored in memory and do no entailment additional reasoning
static OntModelSpec OWL_LITE_MEM_RDFS_INF
          A specification for OWL Lite models that are stored in memory and use the RDFS inferencer for additional entailments
static OntModelSpec OWL_LITE_MEM_RULES_INF
          A specification for OWL Lite models that are stored in memory and use the OWL rules inference engine for additional entailments
static OntModelSpec OWL_LITE_MEM_TRANS_INF
          A specification for OWL Lite models that are stored in memory and use the transitive inferencer for additional entailments
static OntModelSpec OWL_MEM
          A specification for OWL models that are stored in memory and do no additional entailment reasoning
static OntModelSpec OWL_MEM_MICRO_RULE_INF
          A specification for OWL models that are stored in memory and use the micro OWL rules inference engine for additional entailments
static OntModelSpec OWL_MEM_MINI_RULE_INF
          A specification for OWL models that are stored in memory and use the mini OWL rules inference engine for additional entailments
static OntModelSpec OWL_MEM_RDFS_INF
          A specification for OWL models that are stored in memory and use the RDFS inferencer for additional entailments
static OntModelSpec OWL_MEM_RULE_INF
          A specification for OWL models that are stored in memory and use the OWL rules inference engine for additional entailments
static OntModelSpec OWL_MEM_TRANS_INF
          A specification for OWL models that are stored in memory and use the transitive inferencer for additional entailments
static OntModelSpec RDFS_MEM
          A specification for RDFS ontology models that are stored in memory and do no additional entailment reasoning
static OntModelSpec RDFS_MEM_RDFS_INF
          A specification for RDFS ontology models that are stored in memory and use the RDFS inferencer for additional entailments
static OntModelSpec RDFS_MEM_TRANS_INF
          A specification for RDFS ontology models that are stored in memory and use the transitive reasoner for entailments
 
Fields inherited from class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
emptyModel, emptyResource
 
Constructor Summary
OntModelSpec(Model description)
          Initialise an OntModelSpec from an RDF description using the JenaModelSpec vocabulary.
OntModelSpec(ModelMaker baseMaker, ModelMaker importsMaker, OntDocumentManager docMgr, ReasonerFactory rFactory, java.lang.String languageURI)
          Construct a new ontology model specification from the supplied components.
OntModelSpec(ModelMaker importsMaker, OntDocumentManager docMgr, ReasonerFactory rFactory, java.lang.String languageURI)
          Construct a new ontology model specification with the given specification parameters
OntModelSpec(OntModelSpec spec)
          Create one model spec as a copy of another.
OntModelSpec(Resource root, Model description)
          Initialise an OntModelSpec from an RDF description using the JenaModelSpec vocabulary.
OntModelSpec(java.lang.String baseModelName, ModelMaker baseMaker, ModelMaker importsMaker, OntDocumentManager docMgr, ReasonerFactory rFactory, java.lang.String languageURI)
          Construct a new ontology model specification from the supplied components.
 
Method Summary
 Model addDescription(Model d, Resource self)
          Add the description of this OntModelSpec to the given model under the given resource.
 Model createBaseModel()
          Answer a base model constructed according to this specificiation.
 Model doCreateModel()
          Create an OntModel according to this model specification.
static ModelMaker getBaseMaker(Model description, Resource root)
          Answer the ModelMaker to be used to construct models that are used for the base model of an OntModel.
 ModelMaker getBaseModelMaker()
          Answer the model maker used for creating base models.
static OntModelSpec getDefaultSpec(java.lang.String languageURI)
          Answer a default specification for the given language URI.
 OntDocumentManager getDocumentManager()
          Answer the document manager for this model specification.
static OntDocumentManager getDocumentManager(Model description, Resource root)
          Answer an OntDocumentManager satisfying the docManager part of this description.
static ModelMaker getImportMaker(Model description, Resource root)
          Answer the ModelMaker to be used to construct models that are used for the imports of an OntModel.
 ModelMaker getImportModelMaker()
          Answer the model maker used for creating imported models.
 java.lang.String getLanguage()
          Answer the URI of the ontology lanuage to use when constructing models from this specification.
static java.lang.String getLanguage(Model description, Resource root)
          Answer the URI string of the ontology language in this description.
 Property getMakerProperty()
          Answer the RDFS property used to attach this ModelSpec to its ModelMaker; used by the parent classes when constructing the RDF description for this Spec.
 ModelMaker getModelMaker()
          Deprecated. use getImportModelMaker() or getBaseModelMaker()
 Profile getProfile()
          Answer the language profile for this ontology specification
 Reasoner getReasoner()
          Answer the reasoner that will be used to infer additional entailed triples in the ontology model.
 ReasonerFactory getReasonerFactory()
          Answer the current reasoner factory
static ReasonerFactory getReasonerFactory(Model description, Resource root)
          Answer a ReasonerFactory as described by the reasonsWith part of this discription, or null if no reasoner specification has been supplied.
 Model implementCreateModelOver(java.lang.String name)
          Create an OntModel according to this model specification.
 void setBaseModelMaker(ModelMaker m)
          Set the model maker used for base models.
 void setDocumentManager(OntDocumentManager docMgr)
          Set the document manager in this specification
 void setImportModelMaker(ModelMaker maker)
          Set the model maker that will be used when the ontology model needs to create an additional container for an imported ontology
 void setLanguage(java.lang.String languageURI)
          Set the URI of the ontology to use for models that conform to this specification.
 void setModelMaker(ModelMaker m)
          Deprecated. use setImportModelMaker(com.hp.hpl.jena.rdf.model.ModelMaker) or setBaseModelMaker(com.hp.hpl.jena.rdf.model.ModelMaker)
 void setReasoner(Reasoner reasoner)
          Set the reasoner that will be used by ontology models that conform to this specification to compute entailments.
 void setReasonerFactory(ReasonerFactory rFactory)
          Set the factory object that will be used to generate the reasoner object for this model specification.
 
Methods inherited from class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
createDefaultModel, createFreshModel, createMaker, createMaker, createMakerByRoot, createModel, createModelOver, createValue, findRootByType, getDescription, getDescription, getMaker, getModel, getValue, openModel, openModel, openModelIfPresent, readModel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.ModelSpec
createModelOver, getDescription, getDescription, openModel, openModel
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.ModelSource
createDefaultModel, createFreshModel, createModel, getModel, openModelIfPresent
 

Field Detail

OWL_MEM

public static final OntModelSpec OWL_MEM
A specification for OWL models that are stored in memory and do no additional entailment reasoning


OWL_MEM_RDFS_INF

public static final OntModelSpec OWL_MEM_RDFS_INF
A specification for OWL models that are stored in memory and use the RDFS inferencer for additional entailments


OWL_MEM_TRANS_INF

public static final OntModelSpec OWL_MEM_TRANS_INF
A specification for OWL models that are stored in memory and use the transitive inferencer for additional entailments


OWL_MEM_RULE_INF

public static final OntModelSpec OWL_MEM_RULE_INF
A specification for OWL models that are stored in memory and use the OWL rules inference engine for additional entailments


OWL_MEM_MICRO_RULE_INF

public static final OntModelSpec OWL_MEM_MICRO_RULE_INF
A specification for OWL models that are stored in memory and use the micro OWL rules inference engine for additional entailments


OWL_MEM_MINI_RULE_INF

public static final OntModelSpec OWL_MEM_MINI_RULE_INF
A specification for OWL models that are stored in memory and use the mini OWL rules inference engine for additional entailments


OWL_DL_MEM

public static final OntModelSpec OWL_DL_MEM
A specification for OWL DL models that are stored in memory and do no additional entailment reasoning


OWL_DL_MEM_RDFS_INF

public static final OntModelSpec OWL_DL_MEM_RDFS_INF
A specification for OWL DL models that are stored in memory and use the RDFS inferencer for additional entailments


OWL_DL_MEM_TRANS_INF

public static final OntModelSpec OWL_DL_MEM_TRANS_INF
A specification for OWL DL models that are stored in memory and use the transitive inferencer for additional entailments


OWL_DL_MEM_RULE_INF

public static final OntModelSpec OWL_DL_MEM_RULE_INF
A specification for OWL DL models that are stored in memory and use the OWL rules inference engine for additional entailments


OWL_LITE_MEM

public static final OntModelSpec OWL_LITE_MEM
A specification for OWL Lite models that are stored in memory and do no entailment additional reasoning


OWL_LITE_MEM_TRANS_INF

public static final OntModelSpec OWL_LITE_MEM_TRANS_INF
A specification for OWL Lite models that are stored in memory and use the transitive inferencer for additional entailments


OWL_LITE_MEM_RDFS_INF

public static final OntModelSpec OWL_LITE_MEM_RDFS_INF
A specification for OWL Lite models that are stored in memory and use the RDFS inferencer for additional entailments


OWL_LITE_MEM_RULES_INF

public static final OntModelSpec OWL_LITE_MEM_RULES_INF
A specification for OWL Lite models that are stored in memory and use the OWL rules inference engine for additional entailments


DAML_MEM

public static final OntModelSpec DAML_MEM
A specification for DAML models that are stored in memory and do no additional entailment reasoning


DAML_MEM_TRANS_INF

public static final OntModelSpec DAML_MEM_TRANS_INF
A specification for DAML models that are stored in memory and use the transitive reasoner for entailments


DAML_MEM_RDFS_INF

public static final OntModelSpec DAML_MEM_RDFS_INF
A specification for DAML models that are stored in memory and use the RDFS inferencer for additional entailments


DAML_MEM_RULE_INF

public static final OntModelSpec DAML_MEM_RULE_INF
A specification for DAML models that are stored in memory and use a subset of the DAML semantic model additional entailments


RDFS_MEM

public static final OntModelSpec RDFS_MEM
A specification for RDFS ontology models that are stored in memory and do no additional entailment reasoning


RDFS_MEM_TRANS_INF

public static final OntModelSpec RDFS_MEM_TRANS_INF
A specification for RDFS ontology models that are stored in memory and use the transitive reasoner for entailments


RDFS_MEM_RDFS_INF

public static final OntModelSpec RDFS_MEM_RDFS_INF
A specification for RDFS ontology models that are stored in memory and use the RDFS inferencer for additional entailments

Constructor Detail

OntModelSpec

public OntModelSpec(ModelMaker importsMaker,
                    OntDocumentManager docMgr,
                    ReasonerFactory rFactory,
                    java.lang.String languageURI)

Construct a new ontology model specification with the given specification parameters

Parameters:
importsMaker - The model maker, which will be used to construct stores for statements in the imported ontologies and the base ontology. Use null to get a default (memory) model maker.
docMgr - The document manager, or null for the default document manager.
rFactory - The factory for the reasoner to use to infer additional triples in the model, or null for no reasoner
languageURI - The URI of the ontology language. Required.

OntModelSpec

public OntModelSpec(ModelMaker baseMaker,
                    ModelMaker importsMaker,
                    OntDocumentManager docMgr,
                    ReasonerFactory rFactory,
                    java.lang.String languageURI)
Construct a new ontology model specification from the supplied components.

Parameters:
baseMaker - the model-maker to use for the base model
importsMaker - the model-maker to use for imported models
docMgr - the document manager (null for the default manager)
rFactory - the reasoner (null for no reasoner)
languageURI - the ontology language URI (must not be null)

OntModelSpec

public OntModelSpec(java.lang.String baseModelName,
                    ModelMaker baseMaker,
                    ModelMaker importsMaker,
                    OntDocumentManager docMgr,
                    ReasonerFactory rFactory,
                    java.lang.String languageURI)
Construct a new ontology model specification from the supplied components.

Parameters:
baseModelName - the name of the model in the baseModelMaker
baseMaker - the model-maker to use for the base model
importsMaker - the model-maker to use for imported models
docMgr - the document manager (null for the default manager)
rFactory - the reasoner (null for no reasoner)
languageURI - the ontology language URI (must not be null)

OntModelSpec

public OntModelSpec(OntModelSpec spec)

Create one model spec as a copy of another. This is useful when what is required is similar to an existing spec, but with some changes. Note: this is only a shallow copy, so the structured objects (reasoners, document managers, etc) are not themselves copied. Thus, even after calling this copy constructor, making a change to the document manager in the copy specification will also affect the one that the copy was made from. The correct idiom is to replace the object before side-effecting it, e.g:

   OntModelSpec newSpec = new OntModelSpec( existingSpec );
   newSpec.setDocumentManager( new OntDocumentManager() );
   newSpec.getDocumentManager().setMetaDataSearchPath( "..." );
 

Parameters:
spec -

OntModelSpec

public OntModelSpec(Model description)

Initialise an OntModelSpec from an RDF description using the JenaModelSpec vocabulary. See the modelspec howto for the description of the OntModel used. The root of the description is the unique resource with type jms:OntMakerClass.

Parameters:
description - an RDF model using the JenaModelSpec vocabulary

OntModelSpec

public OntModelSpec(Resource root,
                    Model description)

Initialise an OntModelSpec from an RDF description using the JenaModelSpec vocabulary. See the modelspec howto for the description of the OntModel used. The root of the description is supplied as a parameter (so the description may describe several different OntModels).

Parameters:
description - an RDF model using the JenaModelSpec vocabulary
root - the root of the sub-graph to use for the specification
Method Detail

getModelMaker

public ModelMaker getModelMaker()
Deprecated. use getImportModelMaker() or getBaseModelMaker()

Answer the model maker used for creating imported models.

Overrides:
getModelMaker in class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
Returns:
the embedded ModelMaker

getImportModelMaker

public ModelMaker getImportModelMaker()
Answer the model maker used for creating imported models.

Returns:
The ModelMaker that is used to get or create a model used to hold imports to an OntModel.

getBaseModelMaker

public ModelMaker getBaseModelMaker()
Answer the model maker used for creating base models.


getDefaultSpec

public static OntModelSpec getDefaultSpec(java.lang.String languageURI)

Answer a default specification for the given language URI. This default will typically use a memory model and have minimal inferencing capabilities. Specifically, OWL and RDFS languages will have RDFS level inferencing capability (chosen to give a reasonable balance between power and efficiency of computation), and DAML language will have the minimal DAML rule reasoner. To get other (more powerful or less powerful) reasoning capabilities, users should create ontology models by passing an explicit OntModelSpec parameter to the model factory.

Parameters:
languageURI - The ontology language we want a default model spec for
Returns:
The default model spec for that language
Throws:
OntologyException - if the URI is not a recognised name of an ontology language

getDocumentManager

public OntDocumentManager getDocumentManager()

Answer the document manager for this model specification. Defaults to a standard instance of OntDocumentManager

Returns:
The document manager to be used by models matching this specification

setDocumentManager

public void setDocumentManager(OntDocumentManager docMgr)

Set the document manager in this specification

Parameters:
docMgr - The new document manager

setImportModelMaker

public void setImportModelMaker(ModelMaker maker)

Set the model maker that will be used when the ontology model needs to create an additional container for an imported ontology

Parameters:
maker - The new model maker to use

setModelMaker

public void setModelMaker(ModelMaker m)
Deprecated. use setImportModelMaker(com.hp.hpl.jena.rdf.model.ModelMaker) or setBaseModelMaker(com.hp.hpl.jena.rdf.model.ModelMaker)

Set the model maker used for imported models. OntModelSpecs now have separate model makers for imported and base models - use the correct one.


setBaseModelMaker

public void setBaseModelMaker(ModelMaker m)

Set the model maker used for base models.

Parameters:
m - The model maker that is used to create the base model if one is not supplied when a model is created.

getReasoner

public Reasoner getReasoner()

Answer the reasoner that will be used to infer additional entailed triples in the ontology model.

Returns:
The reasoner for this specification

setReasoner

public void setReasoner(Reasoner reasoner)

Set the reasoner that will be used by ontology models that conform to this specification to compute entailments. Note: The reasoner is generated on demand by the reasoner factory. To prevent this spec from having a reasoner, set the reasoner factory to null, see setReasonerFactory(com.hp.hpl.jena.reasoner.ReasonerFactory).

Parameters:
reasoner - The new reasoner

setReasonerFactory

public void setReasonerFactory(ReasonerFactory rFactory)

Set the factory object that will be used to generate the reasoner object for this model specification. Note that the reasoner itself is cached, so setting the factory after a call to getReasoner() will have no effect.

Parameters:
rFactory - The new reasoner factory, or null to prevent any reasoner being used

getReasonerFactory

public ReasonerFactory getReasonerFactory()

Answer the current reasoner factory

Returns:
The reasoner factory, or null.

getLanguage

public java.lang.String getLanguage()

Answer the URI of the ontology lanuage to use when constructing models from this specification. Well known language URI's are available from the ProfileRegistry

Returns:
The ontology language URI

setLanguage

public void setLanguage(java.lang.String languageURI)

Set the URI of the ontology to use for models that conform to this specification.

Parameters:
languageURI - The new language URI
Throws:
OntologyException - if the URI does not map to a known language profile

getProfile

public Profile getProfile()

Answer the language profile for this ontology specification

Returns:
An ontology langauge profile object

doCreateModel

public Model doCreateModel()

Create an OntModel according to this model specification. The base model comes from the attached base ModelMaker.

Specified by:
doCreateModel in class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
Returns:
an OntModel satisfying this specification

implementCreateModelOver

public Model implementCreateModelOver(java.lang.String name)

Create an OntModel according to this model specification. The base model comes from the underlying ModelMaker and is named by the given name.

Specified by:
implementCreateModelOver in class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
See Also:
ModelSpec.createModelOver(java.lang.String)

getImportMaker

public static ModelMaker getImportMaker(Model description,
                                        Resource root)

Answer the ModelMaker to be used to construct models that are used for the imports of an OntModel. The ModelMaker is specified by the properties of the resource which is the object of the root's jms:importMaker property. If no importMaker is specified, a MemModelMaker is returned as a default.

Parameters:
description - the description model for this OntModel
root - the root of the description for the OntModel
Returns:
a ModelMaker fitting the given description

getBaseMaker

public static ModelMaker getBaseMaker(Model description,
                                      Resource root)

Answer the ModelMaker to be used to construct models that are used for the base model of an OntModel. The ModelMaker is specified by the properties of the resource which is the object of the root's jms:maker property. If no importMaker is specified, a MemModelMaker is returned as a default.

Parameters:
description - the description model for this OntModel
root - the root of the description for the OntModel
Returns:
a ModelMaker fitting the given description

getLanguage

public static java.lang.String getLanguage(Model description,
                                           Resource root)
Answer the URI string of the ontology language in this description.

Parameters:
description - the Model from which to extract the description
Returns:
the language string
Throws:
something - if the value isn't a URI resource

getDocumentManager

public static OntDocumentManager getDocumentManager(Model description,
                                                    Resource root)
Answer an OntDocumentManager satisfying the docManager part of this description. Currently restricted to one where the object of JenaModelSpec.docManager is registered with the value table held in ModelSpecImpl. If there's no such property, or if its bnode has no associated value, returns null.

Parameters:
description - the description of the OntModel
root - the root of the description
Returns:
the OntDocumentManager of root's JenaModelSpec.docManager

getReasonerFactory

public static ReasonerFactory getReasonerFactory(Model description,
                                                 Resource root)
Answer a ReasonerFactory as described by the reasonsWith part of this discription, or null if no reasoner specification has been supplied.

Parameters:
description - the description of this OntModel
root - the root of this OntModel's description
Returns:
a ReasonerFactory with URI given by root's reasonsWith's reasoner.

addDescription

public Model addDescription(Model d,
                            Resource self)
Add the description of this OntModelSpec to the given model under the given resource. This same description can be used to create an equivalent OntModelSpec. Serialising the description will lose the DocumentManager description. TODO allow the DocumentManager to be [de]serialised

Specified by:
addDescription in interface ModelSpec
Overrides:
addDescription in class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
Parameters:
d - the model to which the description is to be added
self - the resource to which the properties are to be added
Returns:
the model m (for cascading and convenience)

getMakerProperty

public Property getMakerProperty()
Answer the RDFS property used to attach this ModelSpec to its ModelMaker; used by the parent classes when constructing the RDF description for this Spec.

Specified by:
getMakerProperty in class com.hp.hpl.jena.rdf.model.impl.ModelSpecImpl
Returns:
JenaModelSpec.importMaker

createBaseModel

public Model createBaseModel()
Answer a base model constructed according to this specificiation. This is used for the "base" (ie non-imported) model for an OntModel.



Copyright © 2000, 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP