|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface OntModel
An enhanced view of a Jena model that is known to contain ontology
data, under a given ontology vocabulary (such as OWL).
This class does not by itself compute the deductive extension of the graph
under the semantic rules of the language. Instead, we wrap an underlying
model with this ontology interface, that presents a convenience syntax for accessing
the language elements. Depending on the inference capability of the underlying model,
the OntModel will appear to contain more or less triples. For example, if
this class is used to wrap a plain memory or database model, only the
relationships asserted by the document will be reported through this
convenience API. Alternatively, if the OntModel wraps an OWL inferencing model,
the inferred triples from the extension will be reported as well. For
example, assume the following ontology fragment:
In a non-inferencing model, the
:A rdf:type owl:Class .
:B rdf:type owl:Class ; rdfs:subClassOf :A .
:widget rdf:type :B .
rdf:type of the widget will be
reported as class :B only. In a model that can process the OWL
semantics, the widget's types will include :B, :A,
and owl:Thing.
Note: that OntModel is an extension to the
InfModel interface. This is to support the case where an ontology model
wraps an inference graph, and we want to make the special capabilities of the
InfModel, for example global consistency checking, accessible to
client programs. Since not all ont models use a reasoner, using these methods
may result in a runtime exception, though the typical behaviour is that such
calls will be silently ignored.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.hp.hpl.jena.shared.PrefixMapping |
|---|
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedException |
| Field Summary |
|---|
| Fields inherited from interface com.hp.hpl.jena.shared.PrefixMapping |
|---|
Extended, Standard |
| Fields inherited from interface com.hp.hpl.jena.rdf.model.ModelLock |
|---|
READ, WRITE |
| Method Summary | |
|---|---|
void |
addLoadedImport(java.lang.String uri)
Record that this model has now imported the document with the given URI, so that it will not be re-imported in the future. |
void |
addSubModel(Model model)
Add the given model as one of the sub-models of the enclosed ontology union model. |
void |
addSubModel(Model model,
boolean rebind)
Add the given model as one of the sub-models of the enclosed ontology union model. |
int |
countSubModels()
Answer the number of sub-models of this model, not including the base model. |
AllDifferent |
createAllDifferent()
Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct. |
AllDifferent |
createAllDifferent(RDFList differentMembers)
Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct. |
AllValuesFromRestriction |
createAllValuesFromRestriction(java.lang.String uri,
Property prop,
Resource cls)
Answer a class description defined as the class of those individuals for which all values of the given property belong to the given class |
AnnotationProperty |
createAnnotationProperty(java.lang.String uri)
Answer a resource that represents an annotation property in this model. |
CardinalityQRestriction |
createCardinalityQRestriction(java.lang.String uri,
Property prop,
int cardinality,
OntClass cls)
Answer a class description defined as the class of those individuals that have exactly the given number of values for the given property, all values of which belong to the given class. |
CardinalityRestriction |
createCardinalityRestriction(java.lang.String uri,
Property prop,
int cardinality)
Answer a class description defined as the class of those individuals that have exactly the given number of values for the given property. |
OntClass |
createClass()
Answer a resource that represents an anonymous class description in this model. |
OntClass |
createClass(java.lang.String uri)
Answer a resource that represents a class description node in this model. |
ComplementClass |
createComplementClass(java.lang.String uri,
Resource cls)
Answer a resource representing the class that is the complement of the given argument class |
DataRange |
createDataRange(RDFList literals)
Answer a data range defined as the given set of concrete data values. |
DatatypeProperty |
createDatatypeProperty(java.lang.String uri)
Answer a resource that represents datatype property in this model, and that is not a functional property. |
DatatypeProperty |
createDatatypeProperty(java.lang.String uri,
boolean functional)
Answer a resource that represents datatype property in this model. |
EnumeratedClass |
createEnumeratedClass(java.lang.String uri,
RDFList members)
Answer a resource representing the class that is the enumeration of the given list of individuals |
HasValueRestriction |
createHasValueRestriction(java.lang.String uri,
Property prop,
RDFNode value)
Answer a class description defined as the class of those individuals that have the given resource as the value of the given property |
Individual |
createIndividual(Resource cls)
Answer a resource that represents an Individual node in this model. |
Individual |
createIndividual(java.lang.String uri,
Resource cls)
Answer a resource that represents an Individual node in this model. |
IntersectionClass |
createIntersectionClass(java.lang.String uri,
RDFList members)
Answer a resource representing the class that is the intersection of the given list of class descriptions. |
InverseFunctionalProperty |
createInverseFunctionalProperty(java.lang.String uri)
Answer a resource representing an inverse functional property |
InverseFunctionalProperty |
createInverseFunctionalProperty(java.lang.String uri,
boolean functional)
Answer a resource representing an inverse functional property, which is optionally also functional. |
MaxCardinalityQRestriction |
createMaxCardinalityQRestriction(java.lang.String uri,
Property prop,
int cardinality,
OntClass cls)
Answer a class description defined as the class of those individuals that have at most the given number of values for the given property, all values of which belong to the given class. |
MaxCardinalityRestriction |
createMaxCardinalityRestriction(java.lang.String uri,
Property prop,
int cardinality)
Answer a class description defined as the class of those individuals that have at most the given number of values for the given property. |
MinCardinalityQRestriction |
createMinCardinalityQRestriction(java.lang.String uri,
Property prop,
int cardinality,
OntClass cls)
Answer a class description defined as the class of those individuals that have at least the given number of values for the given property, all values of which belong to the given class. |
MinCardinalityRestriction |
createMinCardinalityRestriction(java.lang.String uri,
Property prop,
int cardinality)
Answer a class description defined as the class of those individuals that have at least the given number of values for the given property. |
ObjectProperty |
createObjectProperty(java.lang.String uri)
Answer a resource representing an object property in this model, and that is not a functional property. |
ObjectProperty |
createObjectProperty(java.lang.String uri,
boolean functional)
Answer a resource that represents an object property in this model. |
Ontology |
createOntology(java.lang.String uri)
Answer a resource that represents an ontology description node in this model. |
OntProperty |
createOntProperty(java.lang.String uri)
Answer a resource representing an generic property in this model. |
OntResource |
createOntResource(java.lang.Class javaClass,
Resource rdfType,
java.lang.String uri)
Answer a resource that represents a generic ontology node in this model. |
OntResource |
createOntResource(java.lang.String uri)
Answer a resource presenting the OntResource facet, which has the
given URI. |
Restriction |
createRestriction(Property p)
Answer a resource that represents an anonymous property restriction in this model. |
Restriction |
createRestriction(java.lang.String uri,
Property p)
Answer a resource that represents a property restriction in this model. |
SomeValuesFromRestriction |
createSomeValuesFromRestriction(java.lang.String uri,
Property prop,
Resource cls)
Answer a class description defined as the class of those individuals that have at least one property with a value belonging to the given class |
SymmetricProperty |
createSymmetricProperty(java.lang.String uri)
Answer a resource representing a symmetric property |
SymmetricProperty |
createSymmetricProperty(java.lang.String uri,
boolean functional)
Answer a resource representing a symmetric property, which is optionally also functional. |
TransitiveProperty |
createTransitiveProperty(java.lang.String uri)
Answer a resource representing a transitive property |
TransitiveProperty |
createTransitiveProperty(java.lang.String uri,
boolean functional)
Answer a resource representing a transitive property, which is optionally also functional. |
UnionClass |
createUnionClass(java.lang.String uri,
RDFList members)
Answer a resource representing the class that is the union of the given list of class descriptions |
AllValuesFromRestriction |
getAllValuesFromRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals for which all values of the given property belong to the given class. |
AnnotationProperty |
getAnnotationProperty(java.lang.String uri)
Answer a resource that represents an annotation property in this model. |
Model |
getBaseModel()
Answer the base model of this model. |
CardinalityQRestriction |
getCardinalityQRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have a property p, with cardinality N, all values of which are members of a given class. |
CardinalityRestriction |
getCardinalityRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have exactly the given number of values for the given property. |
ComplementClass |
getComplementClass(java.lang.String uri)
Answer a resource representing the class that is the complement of another class. |
DatatypeProperty |
getDatatypeProperty(java.lang.String uri)
Answer a resource that represents datatype property in this model. . |
OntDocumentManager |
getDocumentManager()
Answer a reference to the document manager that this model is using to manage ontology <-> mappings, and to load the imports closure. |
boolean |
getDynamicImports()
Answer true if the imports closure of the model will be dynamically updated as imports statements are added and removed. |
EnumeratedClass |
getEnumeratedClass(java.lang.String uri)
Answer a resource representing the class that is the enumeration of a list of individuals. |
com.hp.hpl.jena.ontology.event.OntEventManager |
getEventManager()
Answer the ontology event manager for this model. |
HasValueRestriction |
getHasValueRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have the given resource as the value of the given property. |
OntModel |
getImportedModel(java.lang.String uri)
Answer an OntModel representing the imported ontology
with the given URI. |
ModelMaker |
getImportModelMaker()
Answer the model maker associated with this model (used for constructing the constituent models of the imports closure). |
Individual |
getIndividual(java.lang.String uri)
Answer a resource that represents an Individual node in this model. |
IntersectionClass |
getIntersectionClass(java.lang.String uri)
Answer a resource representing the class that is the intersection of a list of class descriptions. |
InverseFunctionalProperty |
getInverseFunctionalProperty(java.lang.String uri)
Answer a resource representing an inverse functional property. |
MaxCardinalityQRestriction |
getMaxCardinalityQRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have a property p, with max cardinality N, all values of which are members of a given class. |
MaxCardinalityRestriction |
getMaxCardinalityRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have at most the given number of values for the given property. |
MinCardinalityQRestriction |
getMinCardinalityQRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have a property p, with minimum cardinality N, all values of which are members of a given class. |
MinCardinalityRestriction |
getMinCardinalityRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have at least the given number of values for the given property. |
ModelMaker |
getModelMaker()
Deprecated. use getImportModelMaker instead for consistency with name changes to OntModelSpec to avoid ambiguity with base vs import makers. |
ObjectProperty |
getObjectProperty(java.lang.String uri)
Answer a resource representing an object property in this model. |
OntClass |
getOntClass(java.lang.String uri)
Answer a resource that represents a class description node in this model. |
Ontology |
getOntology(java.lang.String uri)
Answer a resource that represents an ontology description node in this model. |
OntProperty |
getOntProperty(java.lang.String uri)
Answer a resource representing an generic property in this model. |
OntResource |
getOntResource(Resource res)
Answer a resource presenting the OntResource facet, which
corresponds to the given resource but attached to this model. |
OntResource |
getOntResource(java.lang.String uri)
Answer a resource presenting the OntResource facet, which has the given
URI. |
Resource |
getOWLLanguageLevel(java.util.List problems)
If this OntModel is presenting an OWL model, answer the minimum OWL language level that the constructs used in this model lie entirely within. |
Profile |
getProfile()
Answer the language profile (for example, OWL or DAML+OIL) that this model is working to. |
QualifiedRestriction |
getQualifiedRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have a property p, all values of which are members of a given class. |
Restriction |
getRestriction(java.lang.String uri)
Answer a resource that represents a property restriction in this model. |
SomeValuesFromRestriction |
getSomeValuesFromRestriction(java.lang.String uri)
Answer a class description defined as the class of those individuals that have at least one property with a value belonging to the given class. |
OntModelSpec |
getSpecification()
Answer the ontology model specification that was used to construct this model |
java.util.List |
getSubGraphs()
Answer the sub-graphs of this model. |
SymmetricProperty |
getSymmetricProperty(java.lang.String uri)
Answer a resource representing a symmetric property. |
TransitiveProperty |
getTransitiveProperty(java.lang.String uri)
Answer a resource representing a transitive property. |
UnionClass |
getUnionClass(java.lang.String uri)
Answer a resource representing the class that is the union of a list of class descriptions. |
boolean |
hasLoadedImport(java.lang.String uri)
Answer true if this model has had the given URI document imported into it. |
boolean |
isInBaseModel(RDFNode node)
Answer true if the given node is a member of the base model of this ontology model. |
boolean |
isInBaseModel(Statement stmt)
Answer true if the given statement is defined in the base model of this ontology model. |
ExtendedIterator |
listAllDifferent()
Answer an iterator that ranges over the nodes that denote pair-wise disjointness between sets of classes. |
ExtendedIterator |
listAllOntProperties()
Answer an iterator over all of the ontology properties in this model, including object properties, datatype properties, annotation properties, etc. |
ExtendedIterator |
listAnnotationProperties()
Answer an iterator that ranges over the properties in this model that are declared to be annotation properties. |
ExtendedIterator |
listClasses()
Answer an iterator that ranges over all of the various forms of class description resource in this model. |
ExtendedIterator |
listComplementClasses()
Answer an iterator that ranges over the complement class-descriptions in this model, i.e. the class resources specified to have a property complementOf (or equivalent) and a list of values. |
ExtendedIterator |
listDataRanges()
Answer an iterator over the DataRange objects in this ontology, if there are any. |
ExtendedIterator |
listDatatypeProperties()
Answer an iterator that ranges over the datatype property resources in this model, i.e. the resources with rdf:type DatatypeProperty or equivalent. |
ExtendedIterator |
listEnumeratedClasses()
Answer an iterator that ranges over the enumerated class class-descriptions in this model, i.e. the class resources specified to have a property oneOf (or equivalent) and a list of values. |
ExtendedIterator |
listFunctionalProperties()
Answer an iterator that ranges over the functional property resources in this model, i.e. the resources with rdf:type FunctionalProperty or equivalent. |
ExtendedIterator |
listHierarchyRootClasses()
Answer an iterator over the classes in this ontology model that represent the uppermost nodes of the class hierarchy. |
ExtendedIterator |
listImportedModels()
Deprecated. This method has been re-named to listSubModels,
but note that to obtain the same behaviour as listImportedModels
from Jena 2.4 and earlier, callers should invoke listSubModels(boolean)
with parameter true. |
java.util.Set |
listImportedOntologyURIs()
Answer a list of the imported URI's in this ontology model. |
java.util.Set |
listImportedOntologyURIs(boolean closure)
Answer a list of the imported URI's in this ontology model, and optionally in the closure of this model's imports. |
ExtendedIterator |
listIndividuals()
Answer an iterator that ranges over the individual resources in this model, i.e. the resources with rdf:type corresponding to a class defined
in the ontology. |
ExtendedIterator |
listIndividuals(Resource cls)
Answer an iterator that ranges over the resources in this model that are instances of the given class. |
ExtendedIterator |
listIntersectionClasses()
Answer an iterator that ranges over the intersection class-descriptions in this model, i.e. the class resources specified to have a property intersectionOf (or equivalent) and a list of values. |
ExtendedIterator |
listInverseFunctionalProperties()
Answer an iterator that ranges over the inverse functional property resources in this model, i.e. the resources with rdf:type InverseFunctionalProperty or equivalent. |
ExtendedIterator |
listNamedClasses()
Answer an iterator that ranges over the named class-descriptions in this model, i.e. resources with rdf:type
Class (or equivalent) and a node URI. |
ExtendedIterator |
listObjectProperties()
Answer an iterator that ranges over the object property resources in this model, i.e. the resources with rdf:type ObjectProperty or equivalent. |
ExtendedIterator |
listOntologies()
Answer an iterator that ranges over the ontology resources in this model, i.e. the resources with rdf:type Ontology or equivalent. |
ExtendedIterator |
listOntProperties()
Answer an iterator that ranges over the property resources in this model, i.e. the resources with rdf:type Property or equivalent. |
ExtendedIterator |
listRestrictions()
Answer an iterator that ranges over the property restriction class-descriptions in this model, i.e. resources with rdf:type
Restriction (or equivalent). |
ExtendedIterator |
listSubModels()
Answer an iterator over the ontology models that are sub-models of this model. |
ExtendedIterator |
listSubModels(boolean withImports)
Answer an iterator over the ontology models that are sub-models of this model. |
ExtendedIterator |
listSymmetricProperties()
Answer an iterator that ranges over the symmetric property resources in this model, i.e. the resources with rdf:type SymmetricProperty or equivalent. |
ExtendedIterator |
listTransitiveProperties()
Answer an iterator that ranges over the transitive property resources in this model, i.e. the resources with rdf:type TransitiveProperty or equivalent. |
ExtendedIterator |
listUnionClasses()
Answer an iterator that ranges over the union class-descriptions in this model, i.e. the class resources specified to have a property unionOf (or equivalent) and a list of values. |
void |
loadImports()
Determine which models this model imports (by looking for, for example, owl:imports statements, and load each of those models as an
import. |
ExtendedIterator |
queryFor(BindingQueryPlan query,
java.util.List altQueries,
java.lang.Class asKey)
Answer the iterator over the resources from the graph that satisfy the given query, followed by the answers to the alternative queries (if specified). |
void |
removeLoadedImport(java.lang.String uri)
Record that this model no longer imports the document with the given URI. |
void |
removeSubModel(Model model)
Remove the given model as one of the sub-models of the enclosed ontology union model. |
void |
removeSubModel(Model model,
boolean rebind)
Remove the given model as one of the sub-models of the enclosed ontology union model. |
void |
setDynamicImports(boolean dynamic)
Set the flag that controls whether adding or removing imports statements into the model will result in the imports closure changing dynamically. |
void |
setStrictMode(boolean strict)
Set the checking mode to strict or non-strict. |
boolean |
strictMode()
Answer true if this model is currently in strict checking mode. |
Model |
write(java.io.OutputStream out)
Write a serialization of this model as an XML document. |
Model |
write(java.io.OutputStream out,
java.lang.String lang)
Write a serialized representation of this model in a specified language. |
Model |
write(java.io.OutputStream out,
java.lang.String lang,
java.lang.String base)
Write a serialized representation of a model in a specified language. |
Model |
write(java.io.Writer writer)
Write the model as an XML document. |
Model |
write(java.io.Writer writer,
java.lang.String lang)
Write a serialized representation of a model in a specified language. |
Model |
write(java.io.Writer writer,
java.lang.String lang,
java.lang.String base)
Write a serialized representation of a model in a specified language. |
Model |
writeAll(java.io.OutputStream out,
java.lang.String lang,
java.lang.String base)
Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. |
Model |
writeAll(java.io.Writer writer,
java.lang.String lang,
java.lang.String base)
Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. |
| Methods inherited from interface com.hp.hpl.jena.rdf.model.InfModel |
|---|
getDeductionsModel, getDerivation, getRawModel, getReasoner, listStatements, prepare, rebind, reset, setDerivationLogging, validate |
| Methods inherited from interface com.hp.hpl.jena.rdf.model.ModelGraphInterface |
|---|
asRDFNode, asStatement, getGraph, queryHandler |
| Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFReaderF |
|---|
getReader, getReader, setReaderClassName |
| Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFWriterF |
|---|
getWriter, getWriter, setWriterClassName |
| Methods inherited from interface com.hp.hpl.jena.shared.PrefixMapping |
|---|
expandPrefix, getNsPrefixMap, getNsPrefixURI, getNsURIPrefix, lock, qnameFor, removeNsPrefix, samePrefixMappingAs, setNsPrefix, setNsPrefixes, setNsPrefixes, shortForm, withDefaultMappings |
| Methods inherited from interface com.hp.hpl.jena.shared.Lock |
|---|
enterCriticalSection, leaveCriticalSection |
| Method Detail |
|---|
ExtendedIterator listOntologies()
Answer an iterator that ranges over the ontology resources in this model, i.e.
the resources with rdf:type Ontology or equivalent. These resources
typically contain metadata about the ontology document that contains them.
Specifically, the resources in this iterator will those whose type corresponds
to the value given in the ontology vocabulary associated with this model, see
Profile.ONTOLOGY().
ExtendedIterator listOntProperties()
Answer an iterator that ranges over the property resources in this model, i.e.
the resources with rdf:type Property or equivalent. An OntProperty
is equivalent to an rdfs:Property in a normal RDF graph; this type is
provided as a common super-type for the more specific ObjectProperty and
DatatypeProperty property types.
Note This method searches for nodes in the underlying model whose
rdf:type is rdf:Property. This type is entailed by
specific property sub-types, such as owl:ObjectProperty. An important
consequence of this is that in models without an attached reasoner (e.g. in the
OWL_MEM OntModelSpec), the entailed type will not be present
and this method will omit such properties from the returned iterator.
Solution There are two
ways to address to this issue: either use a reasoning engine to ensure that type entailments
are taking place correct