- All Implemented Interfaces:
OntModel,InfModel,Model,ModelCon,ModelGraphInterface,RDFReaderF,RDFWriterF,Lock,PrefixMapping
Implementation of a model that can process general ontologies in OWL and similar languages.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jena.shared.PrefixMapping
PrefixMapping.Factory, PrefixMapping.IllegalPrefixException, PrefixMapping.JenaLockedException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringThis variable is how the OntModel knows how to construct a syntax checker.Fields inherited from interface org.apache.jena.shared.PrefixMapping
Extended, Standard -
Constructor Summary
ConstructorsConstructorDescriptionOntModelImpl(OntModelSpec spec) Construct a new ontology model from the given specification.OntModelImpl(OntModelSpec spec, Model model) Construct a new ontology model, using the given model as a base. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLoadedImport(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.voidaddSubModel(Model model) Add the given model as one of the sub-models of the enclosed ontology union model.voidaddSubModel(Model model, boolean rebind) Add the given model as one of the sub-models of the enclosed ontology union model.intAnswer the number of sub-models of this model, not including the base model.Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct.createAllDifferent(RDFList differentMembers) Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct.createAllValuesFromRestriction(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 classAnswer a resource that represents an annotation property in this model.createCardinalityQRestriction(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.createCardinalityRestriction(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.Answer a resource that represents an anonymous class description in this model.createClass(String uri) Answer a resource that represents a class description node in this model.createComplementClass(String uri, Resource cls) Answer a resource representing the class that is the complement of the given argument classcreateDataRange(RDFList literals) Answer a data range defined as the given set of concrete data values.Answer a resource that represents datatype property in this model, and that is not a functional property.createDatatypeProperty(String uri, boolean functional) Answer a resource that represents datatype property in this model.createEnumeratedClass(String uri, RDFList members) Answer a resource representing the class that is the enumeration of the given list of individualscreateHasValueRestriction(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 propertycreateIndividual(String uri, Resource cls) Answer a resource that represents an Individual node in this model.createIndividual(Resource cls) Answer a resource that represents an Indvidual node in this model.createIntersectionClass(String uri, RDFList members) Answer a resource representing the class that is the intersection of the given list of class descriptions.Answer a resource representing an inverse functional propertycreateInverseFunctionalProperty(String uri, boolean functional) Answer a resource representing an inverse functional property, which is optionally also functional.Answer a new empty list.createMaxCardinalityQRestriction(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.createMaxCardinalityRestriction(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.createMinCardinalityQRestriction(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.createMinCardinalityRestriction(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.Answer a resource representing an object property in this model, and that is not a functional property.createObjectProperty(String uri, boolean functional) Answer a resource that represents an object property in this model.createOntology(String uri) Answer a resource that represents an ontology description node in this model.createOntProperty(String uri) Answer a resource representing an generic property in this model.<T extends OntResource>
TcreateOntResource(Class<T> javaClass, Resource rdfType, String uri) Answer a resource that represents a generic ontology node in this model.createOntResource(String uri) Answer a resource presenting theOntResourcefacet, which has the given URI.createRestriction(String uri, Property p) Answer a resource that represents a property restriction in this model.Answer a resource that represents an anonymous property restriction in this model.createSomeValuesFromRestriction(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 classAnswer a resource representing a symmetric propertycreateSymmetricProperty(String uri, boolean functional) Answer a resource representing a symmetric property, which is optionally also functional.Answer a resource representing a transitive propertycreateTransitiveProperty(String uri, boolean functional) Answer a resource representing a transitive property, which is optionally also functional.createUnionClass(String uri, RDFList members) Answer a resource representing the class that is the union of the given list of class desctiptionsAnswer a class description defined as the class of those individuals for which all values of the given property belong to the given class.Answer a resource that represents an annotation property in this model.Answer the base-graph of this model.Answer the base model of this model.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.Answer a class description defined as the class of those individuals that have exactly the given number of values for the given property.getComplementClass(String uri) Answer a resource representing the class that is the complement of another class.Answer a resource that represents datatype property in this model. .Returns a derivations model.getDerivation(Statement statement) Return the derivation of the given statement (which should be the result of some previous list operation).Answer a reference to the document manager that this model is using to manage ontology <-> mappings, and to load the imports closure.booleanAnswer true if the imports closure of the model will be dynamically updated as imports statements are added and removed.getEnumeratedClass(String uri) Answer a resource representing the class that is the enumeration of a list of individuals.Answer a class description defined as the class of those individuals that have the given resource as the value of the given property.getImportedModel(String uri) Answer anOntModelrepresenting the imported ontology with the given URI.Answer the model maker associated with this model (used for constructing the constituent models of the imports closure).getIndividual(String uri) Answer a resource that represents an Individual node in this model.Answer a resource representing the class that is the intersection of a list of class descriptions.Answer a resource representing an inverse functional property.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.Answer a class description defined as the class of those individuals that have at most the given number of values for the given property.Answer a class description defined as the class of those individuals that have a property p, with min cardinality N, all values of which are members of a given class.Answer a class description defined as the class of those individuals that have at least the given number of values for the given property.getObjectProperty(String uri) Answer a resource representing an object property in this model.getOntClass(String uri) Answer a resource that represents a class description node in this model.getOntology(String uri) Answer a resource that represents an ontology description node in this model.getOntProperty(String uri) Answer a resource representing an generic property in this model.getOntResource(String uri) Answer a resource presenting theOntResourcefacet, which has the given URI.getOntResource(Resource res) Answer a resource presenting theOntResourcefacet, which corresponds to the given resource but attached to this model.Answer the language profile (for example, OWL or DAML+OIL) that this model is working to.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.Return the raw RDF model being processed (i.e. the argument to the Reasonder.bind call that created this InfModel).Return the Reasoner which is being used to answer queries to this graph.getRestriction(String uri) Answer a resource that represents a property restriction in this model.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.Answer the ontology model specification that was used to construct this modelAnswer the sub-graphs of this model.Answer a resource representing a symmetric property.Answer a resource representing a transitive property.getUnionClass(String uri) Answer a resource representing the class that is the union of a list of class desctiptions.booleanhasLoadedImport(String uri) Answer true if this model has had the given URI document imported into it.booleanisInBaseModel(RDFNode node) Answer true if the given node is a member of the base model of this ontology model.booleanisInBaseModel(Statement stmt) Answer true if the given statement is defined in the base model of this ontology model.Answer an iterator that ranges over the nodes that denote pair-wise disjointness between sets of classes.Answer an iterator over all of the ontology properties in this model, including object properties, datatype properties, annotation properties, etc.Answer an iterator that ranges over the properties in this model that are declared to be annotation properties.Answer an iterator that ranges over all of the various forms of class description resource in this model.Answer an iterator that ranges over the complement class-descriptions in this model, i.e. the class resources specified to have a propertycomplementOf(or equivalent) and a list of values.Answer an iterator over the DataRange objects in this ontology, if there are any.Answer an iterator that ranges over the datatype property resources in this model, i.e. the resources withrdf:type DatatypePropertyor equivalent.Answer an iterator that ranges over the enumerated class class-descriptions in this model, i.e. the class resources specified to have a propertyoneOf(or equivalent) and a list of values.Answer an iterator that ranges over the functional property resources in this model, i.e. the resources withrdf:type FunctionalPropertyor equivalent.Answer an iterator over the classes in this ontology model that represent the uppermost nodes of the class hierarchy.Answer a list of the imported URI's in this ontology model.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.Answer an iterator over the individuals in this model.listIndividuals(Resource cls) Answer an iterator that ranges over the resources in this model that are instances of the given class.Answer an iterator that ranges over the intersection class-descriptions in this model, i.e. the class resources specified to have a propertyintersectionOf(or equivalent) and a list of values.Answer an iterator that ranges over the inverse functional property resources in this model, i.e. the resources withrdf:type InverseFunctionalPropertyor equivalent.Answer an iterator that ranges over the named class-descriptions in this model, i.e. resources withrdf:type Class(or equivalent) and a node URI.Answer an iterator that ranges over the object property resources in this model, i.e. the resources withrdf:type ObjectPropertyor equivalent.Answer an iterator that ranges over the ontology resources in this model, i.e. the resources withrdf:type Ontologyor equivalent.Answer an iterator that ranges over the property resources in this model, i.e. the resources withrdf:type Propertyor equivalent.Answer an iterator that ranges over the property restriction class-descriptions in this model, i.e. resources withrdf:type Restriction(or equivalent).listStatements(Resource subject, Property predicate, RDFNode object, Model posit) Find all the statements matching a pattern.Answer an iterator over the ontology models that are sub-models of this model.listSubModels(boolean withImports) Answer an iterator over the ontology models that are sub-models of this model.Answer an iterator that ranges over the symmetric property resources in this model, i.e. the resources withrdf:type SymmetricPropertyor equivalent.Answer an iterator that ranges over the transitive property resources in this model, i.e. the resources withrdf:type TransitivePropertyor equivalent.Answer an iterator that ranges over the union class-descriptions in this model, i.e. the class resources specified to have a propertyunionOf(or equivalent) and a list of values.voidDetermine which models this model imports (by looking for, for example,owl:importsstatements, and load each of those models as an import.voidprepare()Perform any initial processing and caching.read(InputStream reader, String base) Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).read(InputStream reader, String base, String syntax) Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).voidrebind()Cause the inference model to reconsult the underlying data to take into account changes.voidremoveLoadedImport(String uri) Record that this model no longer imports the document with the given URI.voidremoveSubModel(Model model) Remove the given model as one of the sub-models of the enclosed ontology union model.voidremoveSubModel(Model model, boolean rebind) Remove the given model as one of the sub-models of the enclosed ontology union model.voidreset()Reset any internal caches.voidsetDerivationLogging(boolean logOn) Switch on/off drivation logging.voidsetDynamicImports(boolean dynamic) Set the flag that controls whether adding or removing imports statements into the model will result in the imports closure changing dynamically.voidsetStrictMode(boolean strict) Set the checking mode to strict or non-strict.booleanAnswer true if this model is currently in strict checking mode.validate()Test the consistency of the underlying data.write(OutputStream out) Write a serialization of this model as an XML document.write(OutputStream out, String lang) Write a serialized representation of this model in a specified language.write(OutputStream out, String lang, String base) Write a serialized representation of a model in a specified language.Write the model as an XML document.Write a serialized representation of a model in a specified language.Write a serialized representation of a model in a specified language.writeAll(OutputStream out, String lang) Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents.writeAll(OutputStream out, String lang, String base) Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents.Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents.Write a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents.Methods inherited from class org.apache.jena.rdf.model.impl.ModelCom
abort, adapt, add, add, add, add, add, add, add, add, add, add, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addNamespaces, asModel, asNode, asRDFNode, asStatement, asStatements, asStatements, asStatements, begin, calculateInTxn, clearNsPrefixMap, close, commit, contains, contains, contains, contains, contains, contains, containsAll, containsAll, containsAny, containsAny, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsResource, createAlt, createAlt, createBag, createBag, createList, createList, createLiteral, createLiteral, createLiteral, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createProperty, createProperty, createResource, createResource, createResource, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createStatement, createStatementTerm, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, difference, enterCriticalSection, executeInTxn, expandPrefix, getAlt, getAlt, getBag, getBag, getGraph, getList, getList, getLock, getModelLock, getNsPrefixMap, getNsPrefixURI, getNsURIPrefix, getProperty, getProperty, getProperty, getProperty, getRDFNode, getReader, getRequiredProperty, getRequiredProperty, getResource, getResource, getSeq, getSeq, getWriter, hasNoMappings, independent, intersect, intersection, isClosed, isEmpty, isIsomorphicWith, leaveCriticalSection, listBySubject, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listStatements, listStatements, listStatements, listSubjects, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, lock, notifyEvent, numPrefixes, qnameFor, register, reifiedToString, remove, remove, remove, remove, remove, remove, removeAll, removeAll, removeNsPrefix, samePrefixMappingAs, setNsPrefix, setNsPrefixes, setNsPrefixes, shortForm, size, supportsSetOperations, supportsTransactions, toString, union, unregister, withDefaultMappings, wrapAsResourceMethods inherited from class org.apache.jena.enhanced.EnhGraph
asGraph, equals, getNodeAs, hashCode, isIsomorphicWithMethods inherited from interface org.apache.jena.shared.Lock
enterCriticalSection, leaveCriticalSectionMethods inherited from interface org.apache.jena.rdf.model.Model
abort, add, add, add, add, add, begin, calculateInTxn, clearNsPrefixMap, close, commit, contains, contains, contains, containsAll, containsAll, containsAny, containsAny, containsResource, createList, createList, createLiteral, createLiteral, createProperty, createReifier, createReifier, createResource, createResource, createResource, createResource, createStatement, createStatementTerm, createTypedLiteral, createTypedLiteral, createTypedLiteral, difference, equals, executeInTxn, getLock, getProperty, getProperty, getProperty, getReader, getRequiredProperty, getRequiredProperty, getResource, getResource, getWriter, independent, intersection, isClosed, isEmpty, isIsomorphicWith, listNameSpaces, listObjects, listObjectsOfProperty, listObjectsOfProperty, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listSubjects, listSubjectsWithProperty, listSubjectsWithProperty, notifyEvent, register, remove, remove, remove, removeAll, removeAll, removeNsPrefix, setNsPrefix, setNsPrefixes, setNsPrefixes, size, supportsSetOperations, supportsTransactions, union, unregister, withDefaultMappingsMethods inherited from interface org.apache.jena.rdf.model.ModelCon
add, add, add, add, add, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, addLiteral, contains, contains, contains, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, containsLiteral, createAlt, createAlt, createBag, createBag, createLiteral, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createLiteralStatement, createProperty, createResource, createResource, createSeq, createSeq, createStatement, createStatement, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, createTypedLiteral, getAlt, getAlt, getBag, getBag, getList, getList, getProperty, getRDFNode, getSeq, getSeq, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listLiteralStatements, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listResourcesWithProperty, listStatements, listStatements, listStatements, listSubjectsWithProperty, listSubjectsWithProperty, listSubjectsWithProperty, remove, remove, removeMethods inherited from interface org.apache.jena.rdf.model.ModelGraphInterface
asRDFNode, asStatement, getGraph, wrapAsResourceMethods inherited from interface org.apache.jena.shared.PrefixMapping
expandPrefix, getNsPrefixMap, getNsPrefixURI, getNsURIPrefix, hasNoMappings, lock, numPrefixes, qnameFor, samePrefixMappingAs, shortForm
-
Field Details
-
owlSyntaxCheckerClassName
This variable is how the OntModel knows how to construct a syntax checker. This part of the design may change.
-
-
Constructor Details
-
OntModelImpl
Construct a new ontology model, using the given model as a base. The document manager given in the specification object will be used to build the imports closure of the model if its policy permits.
- Parameters:
model- The base model that may contain existing statements for the ontology. if it is null, a fresh model is created as the base.spec- A specification object that allows us to specify parameters and structure for the ontology model to be constructed.
-
OntModelImpl
Construct a new ontology model from the given specification. The base model is produced using the baseModelMaker.
-
-
Method Details
-
getDocumentManager
Answer a reference to the document manager that this model is using to manage ontology <-> mappings, and to load the imports closure. Note the default ontology model specifications each have a contained default document manager. Changing the document managers specified by these default specification may (in fact, probably will) affect other models built with the same specification policy. This may or may not be as desired by the programmer!
- Specified by:
getDocumentManagerin interfaceOntModel- Returns:
- A reference to this model's document manager, obtained from the specification object
-
listOntologies
Answer an iterator that ranges over the ontology resources in this model, i.e. the resources with
rdf:type Ontologyor 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().Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listOntologiesin interfaceOntModel- Returns:
- An iterator over ontology resources.
-
listOntProperties
Answer an iterator that ranges over the property resources in this model, i.e. the resources with
rdf:type Propertyor equivalent. AnOntPropertyis equivalent to anrdfs:Propertyin a normal RDF graph; this type is provided as a common super-type for the more specificObjectPropertyandDatatypePropertyproperty types.Note This method searches for nodes in the underlying model whose
rdf:typeisrdf:Property. This type is entailed by specific property sub-types, such asowl:ObjectProperty. An important consequence of this is that in models without an attached reasoner (e.g. in theOWL_MEMOntModelSpec), 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 correctly, or calllistAllOntProperties(). Note thatlistAllOntPropertiesis potentially less efficient than this method.The resources returned by this iterator will those whose type corresponds to the value given in the ontology vocabulary associated with this model.
- Specified by:
listOntPropertiesin interfaceOntModel- Returns:
- An iterator over property resources.
-
listAllOntProperties
Answer an iterator over all of the ontology properties in this model, including object properties, datatype properties, annotation properties, etc. This method takes a different approach to calculating the set of property resources to return, and is robust against the absence of a reasoner attached to the model (see note in
listOntProperties()for explanation). However, the calculation used by this method is potentially less efficient than the alternativelistOntProperties(). Users whose models have an attached reasoner are recommended to uselistOntProperties().- Specified by:
listAllOntPropertiesin interfaceOntModel- Returns:
- An iterator over all available properties in a model, irrespective of
whether a reasoner is available to perform
rdf:typeentailments. Each property will appear exactly once in the iterator.
-
listObjectProperties
Answer an iterator that ranges over the object property resources in this model, i.e. the resources with
rdf:type ObjectPropertyor equivalent. An object property is a property that is defined in the ontology language semantics as a one whose range comprises individuals (rather than datatyped literals).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.OBJECT_PROPERTY().Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listObjectPropertiesin interfaceOntModel- Returns:
- An iterator over object property resources.
-
listDatatypeProperties
Answer an iterator that ranges over the datatype property resources in this model, i.e. the resources with
rdf:type DatatypePropertyor equivalent. An datatype property is a property that is defined in the ontology language semantics as a one whose range comprises datatyped literals (rather than individuals).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.DATATYPE_PROPERTY().Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listDatatypePropertiesin interfaceOntModel- Returns:
- An iterator over datatype property resources.
-
listFunctionalProperties
Answer an iterator that ranges over the functional property resources in this model, i.e. the resources with
rdf:type FunctionalPropertyor equivalent. A functional property is a property that is defined in the ontology language semantics as having a unique domain element for each instance of the relationship.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.FUNCTIONAL_PROPERTY().- Specified by:
listFunctionalPropertiesin interfaceOntModel- Returns:
- An iterator over functional property resources.
-
listTransitiveProperties
Answer an iterator that ranges over the transitive property resources in this model, i.e. the resources with
rdf:type TransitivePropertyor equivalent.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.TRANSITIVE_PROPERTY().- Specified by:
listTransitivePropertiesin interfaceOntModel- Returns:
- An iterator over transitive property resources.
-
listSymmetricProperties
Answer an iterator that ranges over the symmetric property resources in this model, i.e. the resources with
rdf:type SymmetricPropertyor equivalent.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.SYMMETRIC_PROPERTY().- Specified by:
listSymmetricPropertiesin interfaceOntModel- Returns:
- An iterator over symmetric property resources.
-
listInverseFunctionalProperties
Answer an iterator that ranges over the inverse functional property resources in this model, i.e. the resources with
rdf:type InverseFunctionalPropertyor equivalent.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.INVERSE_FUNCTIONAL_PROPERTY().- Specified by:
listInverseFunctionalPropertiesin interfaceOntModel- Returns:
- An iterator over inverse functional property resources.
-
listIndividuals
Answer an iterator over the individuals in this model. Where possible, an individual is defined as an instance of the top class in an ontology, i.e.
owl:Thingordaml:Thing. However, since this test relies on the presence of an inference capability, and is not defined in cases where there is no top class (such as RDFS), a secondary heuristic is used when needed: an individual is an instance of a class defined in the ontology (i.e. it is a resource with anrdf:type, where therdf:typeof that resource is a class or restriction in the ontology.- Specified by:
listIndividualsin interfaceOntModel- Returns:
- An iterator over Individuals.
-
listIndividuals
Answer an iterator that ranges over the resources in this model that are instances of the given class.
- Specified by:
listIndividualsin interfaceOntModel- Returns:
- An iterator over individual resources whose
rdf:typeiscls.
-
listClasses
Answer an iterator that ranges over all of the various forms of class description resource in this model. Class descriptions include
enumeratedclasses,unionclasses,complementclasses,intersectionclasses,namedclasses andproperty restrictions.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listClassesin interfaceOntModel- Returns:
- An iterator over class description resources.
-
listHierarchyRootClasses
Answer an iterator over the classes in this ontology model that represent the uppermost nodes of the class hierarchy. Depending on the underlying reasoner configuration, if any, these will be calculated as the classes that have Top (i.e.
owl:Thingordaml:Thing) as a direct super-class, or the classes which have no declared super-class.- Specified by:
listHierarchyRootClassesin interfaceOntModel- Returns:
- An iterator of the root classes in the local class hierarchy
-
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.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listEnumeratedClassesin interfaceOntModel- Returns:
- An iterator over enumerated class resources.
- See Also:
-
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.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listUnionClassesin interfaceOntModel- Returns:
- An iterator over union class resources.
- See Also:
-
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.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listComplementClassesin interfaceOntModel- Returns:
- An iterator over complement class resources.
- See Also:
-
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.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listIntersectionClassesin interfaceOntModel- Returns:
- An iterator over complement class resources.
- See Also:
-
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.Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listNamedClassesin interfaceOntModel- Returns:
- An iterator over named class resources.
-
listRestrictions
Answer an iterator that ranges over the property restriction class-descriptions in this model, i.e. resources with
rdf:type Restriction(or equivalent).Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listRestrictionsin interfaceOntModel- Returns:
- An iterator over restriction class resources.
- See Also:
-
listAllDifferent
Answer an iterator that ranges over the nodes that denote pair-wise disjointness between sets of classes.
Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listAllDifferentin interfaceOntModel- Returns:
- An iterator over AllDifferent nodes.
-
listDataRanges
Answer an iterator over the DataRange objects in this ontology, if there are any.
- Specified by:
listDataRangesin interfaceOntModel- Returns:
- An iterator, whose values are
DataRangeobjects.
-
listAnnotationProperties
Answer an iterator that ranges over the properties in this model that are declared to be annotation properties. Not all supported languages define annotation properties (the category of annotation properties is chiefly an OWL innovation).
Note: the number of nodes returned by this iterator will vary according to the completeness of the deductive extension of the underlying graph. See class overview for more details.
- Specified by:
listAnnotationPropertiesin interfaceOntModel- Returns:
- An iterator over annotation properties.
- See Also:
-
getOntology
Answer a resource that represents an ontology description node in this model. If a resource with the given uri exists in the model, and can be viewed as an Ontology, return the Ontology facet, otherwise return null.
- Specified by:
getOntologyin interfaceOntModel- Parameters:
uri- The uri for the ontology node. Conventionally, this corresponds to the base URI of the document itself.- Returns:
- An Ontology resource or null.
-
getIndividual
Answer a resource that represents an Individual node in this model. If a resource with the given uri exists in the model, and can be viewed as an Individual, return the Individual facet, otherwise return null.
- Specified by:
getIndividualin interfaceOntModel- Parameters:
uri- The URI for the requried individual- Returns:
- An Individual resource or null.
-
getOntProperty
Answer a resource representing an generic property in this model. If a property with the given uri exists in the model, return the OntProperty facet, otherwise return null.
- Specified by:
getOntPropertyin interfaceOntModel- Parameters:
uri- The uri for the property.- Returns:
- An OntProperty resource or null.
-
getObjectProperty
Answer a resource representing an object property in this model. If a resource with the given uri exists in the model, and can be viewed as an ObjectProperty, return the ObjectProperty facet, otherwise return null.
- Specified by:
getObjectPropertyin interfaceOntModel- Parameters:
uri- The uri for the object property. May not be null.- Returns:
- An ObjectProperty resource or null.
-
getTransitiveProperty
Answer a resource representing a transitive property. If a resource with the given uri exists in the model, and can be viewed as a TransitiveProperty, return the TransitiveProperty facet, otherwise return null.
- Specified by:
getTransitivePropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- A TransitiveProperty resource or null
-
getSymmetricProperty
Answer a resource representing a symmetric property. If a resource with the given uri exists in the model, and can be viewed as a SymmetricProperty, return the SymmetricProperty facet, otherwise return null.
- Specified by:
getSymmetricPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- A SymmetricProperty resource or null
-
getInverseFunctionalProperty
Answer a resource representing an inverse functional property. If a resource with the given uri exists in the model, and can be viewed as a InverseFunctionalProperty, return the InverseFunctionalProperty facet, otherwise return null.
- Specified by:
getInverseFunctionalPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- An InverseFunctionalProperty resource or null
-
getDatatypeProperty
Answer a resource that represents datatype property in this model. . If a resource with the given uri exists in the model, and can be viewed as a DatatypeProperty, return the DatatypeProperty facet, otherwise return null.
- Specified by:
getDatatypePropertyin interfaceOntModel- Parameters:
uri- The uri for the datatype property. May not be null.- Returns:
- A DatatypeProperty resource or null
-
getAnnotationProperty
Answer a resource that represents an annotation property in this model. If a resource with the given uri exists in the model, and can be viewed as an AnnotationProperty, return the AnnotationProperty facet, otherwise return null.
- Specified by:
getAnnotationPropertyin interfaceOntModel- Parameters:
uri- The uri for the annotation property. May not be null.- Returns:
- An AnnotationProperty resource or null
-
getOntClass
Answer a resource that represents a class description node in this model. If a resource with the given uri exists in the model, and can be viewed as an OntClass, return the OntClass facet, otherwise return null.
- Specified by:
getOntClassin interfaceOntModel- Parameters:
uri- The uri for the class node, or null for an anonymous class.- Returns:
- An OntClass resource or null.
-
getComplementClass
Answer a resource representing the class that is the complement of another class. If a resource with the given uri exists in the model, and can be viewed as a ComplementClass, return the ComplementClass facet, otherwise return null.
- Specified by:
getComplementClassin interfaceOntModel- Parameters:
uri- The URI of the new complement class.- Returns:
- A complement class or null
-
getEnumeratedClass
Answer a resource representing the class that is the enumeration of a list of individuals. If a resource with the given uri exists in the model, and can be viewed as an EnumeratedClass, return the EnumeratedClass facet, otherwise return null.
- Specified by:
getEnumeratedClassin interfaceOntModel- Parameters:
uri- The URI of the new enumeration class.- Returns:
- An enumeration class or null
-
getUnionClass
Answer a resource representing the class that is the union of a list of class desctiptions. If a resource with the given uri exists in the model, and can be viewed as a UnionClass, return the UnionClass facet, otherwise return null.
- Specified by:
getUnionClassin interfaceOntModel- Parameters:
uri- The URI of the new union class.- Returns:
- A union class description or null
-
getIntersectionClass
Answer a resource representing the class that is the intersection of a list of class descriptions. If a resource with the given uri exists in the model, and can be viewed as a IntersectionClass, return the IntersectionClass facet, otherwise return null.
- Specified by:
getIntersectionClassin interfaceOntModel- Parameters:
uri- The URI of the new intersection class.- Returns:
- An intersection class description or null
-
getRestriction
Answer a resource that represents a property restriction in this model. If a resource with the given uri exists in the model, and can be viewed as a Restriction, return the Restriction facet, otherwise return null.
- Specified by:
getRestrictionin interfaceOntModel- Parameters:
uri- The uri for the restriction node.- Returns:
- A Restriction resource or null
-
getHasValueRestriction
Answer a class description defined as the class of those individuals that have the given resource as the value of the given property. If a resource with the given uri exists in the model, and can be viewed as a HasValueRestriction, return the HasValueRestriction facet, otherwise return null.
- Specified by:
getHasValueRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a has-value restriction or null
-
getSomeValuesFromRestriction
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. If a resource with the given uri exists in the model, and can be viewed as a SomeValuesFromRestriction, return the SomeValuesFromRestriction facet, otherwise return null.
- Specified by:
getSomeValuesFromRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a some-values-from restriction, or null
-
getAllValuesFromRestriction
Answer a class description defined as the class of those individuals for which all values of the given property belong to the given class. If a resource with the given uri exists in the model, and can be viewed as an AllValuesFromResriction, return the AllValuesFromRestriction facet, otherwise return null.
- Specified by:
getAllValuesFromRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing an all-values-from restriction or null
-
getCardinalityRestriction
Answer a class description defined as the class of those individuals that have exactly the given number of values for the given property. If a resource with the given uri exists in the model, and can be viewed as a CardinalityRestriction, return the CardinalityRestriction facet, otherwise return null.
- Specified by:
getCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a has-value restriction, or null
-
getMinCardinalityRestriction
Answer a class description defined as the class of those individuals that have at least the given number of values for the given property. If a resource with the given uri exists in the model, and can be viewed as a MinCardinalityRestriction, return the MinCardinalityRestriction facet, otherwise return null.
- Specified by:
getMinCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a min-cardinality restriction, or null
-
getMaxCardinalityRestriction
Answer a class description defined as the class of those individuals that have at most the given number of values for the given property. If a resource with the given uri exists in the model, and can be viewed as a MaxCardinalityRestriction, return the MaxCardinalityRestriction facet, otherwise return null.
- Specified by:
getMaxCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a mas-cardinality restriction, or null
-
getQualifiedRestriction
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. Typically used with a cardinality constraint. If a resource with the given uri exists in the model, and can be viewed as a QualifiedRestriction, return the QualifiedRestriction facet, otherwise return null.
- Specified by:
getQualifiedRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a qualified restriction, or null
-
getCardinalityQRestriction
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. If a resource with the given uri exists in the model, and can be viewed as a CardinalityQRestriction, return the CardinalityQRestriction facet, otherwise return null.
- Specified by:
getCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a qualified cardinality restriction, or null
-
getMinCardinalityQRestriction
Answer a class description defined as the class of those individuals that have a property p, with min cardinality N, all values of which are members of a given class. If a resource with the given uri exists in the model, and can be viewed as a MinCardinalityQRestriction, return the MinCardinalityQRestriction facet, otherwise return null.
- Specified by:
getMinCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a qualified min cardinality restriction, or null
-
getMaxCardinalityQRestriction
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. If a resource with the given uri exists in the model, and can be viewed as a MaxCardinalityQRestriction, return the MaxCardinalityQRestriction facet, otherwise return null.
- Specified by:
getMaxCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The URI for the restriction- Returns:
- A resource representing a qualified max cardinality restriction, or null
-
createOntology
Answer a resource that represents an ontology description node in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createOntologyin interfaceOntModel- Parameters:
uri- The uri for the ontology node. Conventionally, this corresponds to the base URI of the document itself.- Returns:
- An Ontology resource.
-
createIndividual
Answer a resource that represents an Indvidual node in this model. A new anonymous resource will be created in the updateable sub-graph of the ontology model.
- Specified by:
createIndividualin interfaceOntModel- Parameters:
cls- Resource representing the ontology class to which the individual belongs- Returns:
- A new anoymous Individual of the given class.
-
createIndividual
Answer a resource that represents an Individual node in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createIndividualin interfaceOntModel- Parameters:
cls- Resource representing the ontology class to which the individual belongsuri- The uri for the individual, or null for an anonymous individual.- Returns:
- An Individual resource.
-
createOntProperty
Answer a resource representing an generic property in this model. Effectively this method is an alias for
ModelCom.createProperty(String), except that the return type isOntProperty, which allow more convenient access to a property's position in the property hierarchy, domain, range, etc.- Specified by:
createOntPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- An OntProperty resource.
-
createObjectProperty
Answer a resource representing an object property in this model, and that is not a functional property.
- Specified by:
createObjectPropertyin interfaceOntModel- Parameters:
uri- The uri for the object property. May not be null.- Returns:
- An ObjectProperty resource.
- See Also:
-
createObjectProperty
Answer a resource that represents an object property in this model. An object property is defined to have a range of individuals, rather than datatypes. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createObjectPropertyin interfaceOntModel- Parameters:
uri- The uri for the object property. May not be null.functional- If true, the resource will also be typed as aFunctionalProperty, that is, a property that has a unique range value for any given domain value.- Returns:
- An ObjectProperty resource, optionally also functional.
-
createTransitiveProperty
Answer a resource representing a transitive property
- Specified by:
createTransitivePropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- An TransitiveProperty resource
- See Also:
-
createTransitiveProperty
Answer a resource representing a transitive property, which is optionally also functional. Note: although it is permitted in OWL full to have functional transitive properties, it makes the language undecideable. Functional transitive properties are not permitted in OWL Lite or OWL DL.
- Specified by:
createTransitivePropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.functional- If true, the property is also functional- Returns:
- An TransitiveProperty resource, optionally also functional.
-
createSymmetricProperty
Answer a resource representing a symmetric property
- Specified by:
createSymmetricPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- An SymmetricProperty resource
- See Also:
-
createSymmetricProperty
Answer a resource representing a symmetric property, which is optionally also functional.
- Specified by:
createSymmetricPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.functional- If true, the property is also functional- Returns:
- An SymmetricProperty resource, optionally also functional.
-
createInverseFunctionalProperty
Answer a resource representing an inverse functional property
- Specified by:
createInverseFunctionalPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.- Returns:
- An InverseFunctionalProperty resource
- See Also:
-
createInverseFunctionalProperty
Answer a resource representing an inverse functional property, which is optionally also functional.
- Specified by:
createInverseFunctionalPropertyin interfaceOntModel- Parameters:
uri- The uri for the property. May not be null.functional- If true, the property is also functional- Returns:
- An InverseFunctionalProperty resource, optionally also functional.
-
createDatatypeProperty
Answer a resource that represents datatype property in this model, and that is not a functional property.
- Specified by:
createDatatypePropertyin interfaceOntModel- Parameters:
uri- The uri for the datatype property. May not be null.- Returns:
- A DatatypeProperty resource.
- See Also:
-
createDatatypeProperty
Answer a resource that represents datatype property in this model. A datatype property is defined to have a range that is a concrete datatype, rather than an individual. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createDatatypePropertyin interfaceOntModel- Parameters:
uri- The uri for the datatype property. May not be null.functional- If true, the resource will also be typed as aFunctionalProperty, that is, a property that has a unique range value for any given domain value.- Returns:
- A DatatypeProperty resource.
-
createAnnotationProperty
Answer a resource that represents an annotation property in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createAnnotationPropertyin interfaceOntModel- Parameters:
uri- The uri for the annotation property.- Returns:
- An AnnotationProperty resource.
-
createClass
Answer a resource that represents an anonymous class description in this model. A new anonymous resource of
rdf:type C, where C is the class type from the language profile.- Specified by:
createClassin interfaceOntModel- Returns:
- An anonymous Class resource.
-
createClass
Answer a resource that represents a class description node in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createClassin interfaceOntModel- Parameters:
uri- The uri for the class node, or null for an anonymous class.- Returns:
- A Class resource.
-
createComplementClass
Answer a resource representing the class that is the complement of the given argument class
- Specified by:
createComplementClassin interfaceOntModel- Parameters:
uri- The URI of the new complement class, or null for an anonymous class description.cls- Resource denoting the class that the new class is a complement of- Returns:
- A complement class
-
createEnumeratedClass
Answer a resource representing the class that is the enumeration of the given list of individuals
- Specified by:
createEnumeratedClassin interfaceOntModel- Parameters:
uri- The URI of the new enumeration class, or null for an anonymous class description.members- An optional list of resources denoting the individuals in the enumeration- Returns:
- An enumeration class
-
createUnionClass
Answer a resource representing the class that is the union of the given list of class desctiptions
- Specified by:
createUnionClassin interfaceOntModel- Parameters:
uri- The URI of the new union class, or null for an anonymous class description.members- A list of resources denoting the classes that comprise the union- Returns:
- A union class description
-
createIntersectionClass
Answer a resource representing the class that is the intersection of the given list of class descriptions.
- Specified by:
createIntersectionClassin interfaceOntModel- Parameters:
uri- The URI of the new intersection class, or null for an anonymous class description.members- A list of resources denoting the classes that comprise the intersection- Returns:
- An intersection class description
-
createRestriction
Answer a resource that represents an anonymous property restriction in this model. A new anonymous resource of
rdf:type R, where R is the restriction type from the language profile.- Specified by:
createRestrictionin interfaceOntModel- Parameters:
p- The property that is restricted by this restriction- Returns:
- An anonymous Restriction resource.
-
createRestriction
Answer a resource that represents a property restriction in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
- Specified by:
createRestrictionin interfaceOntModel- Parameters:
uri- The uri for the restriction node, or null for an anonymous restriction.p- The property that is restricted by this restriction- Returns:
- A Restriction resource.
-
createHasValueRestriction
Answer a class description defined as the class of those individuals that have the given resource as the value of the given property
- Specified by:
createHasValueRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tovalue- The value of the property, as a resource or RDF literal- Returns:
- A new resource representing a has-value restriction
-
createSomeValuesFromRestriction
public SomeValuesFromRestriction createSomeValuesFromRestriction(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
- Specified by:
createSomeValuesFromRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocls- The class to which at least one value of the property belongs- Returns:
- A new resource representing a some-values-from restriction
-
createAllValuesFromRestriction
public AllValuesFromRestriction createAllValuesFromRestriction(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
- Specified by:
createAllValuesFromRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocls- The class to which any value of the property belongs- Returns:
- A new resource representing an all-values-from restriction
-
createCardinalityRestriction
public CardinalityRestriction createCardinalityRestriction(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.
- Specified by:
createCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The exact cardinality of the property- Returns:
- A new resource representing a has-value restriction
-
createMinCardinalityRestriction
public MinCardinalityRestriction createMinCardinalityRestriction(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.
- Specified by:
createMinCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The minimum cardinality of the property- Returns:
- A new resource representing a min-cardinality restriction
-
createMaxCardinalityRestriction
public MaxCardinalityRestriction createMaxCardinalityRestriction(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.
- Specified by:
createMaxCardinalityRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The maximum cardinality of the property- Returns:
- A new resource representing a mas-cardinality restriction
-
createMaxCardinalityQRestriction
public MaxCardinalityQRestriction createMaxCardinalityQRestriction(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.
- Specified by:
createMaxCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The maximum cardinality of the propertycls- The class to which all values of the restricted property should belong- Returns:
- A new resource representing a mas-cardinality restriction
-
createMinCardinalityQRestriction
public MinCardinalityQRestriction createMinCardinalityQRestriction(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.
- Specified by:
createMinCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The minimun cardinality of the propertycls- The class to which all values of the restricted property should belong- Returns:
- A new resource representing a mas-cardinality restriction
-
createCardinalityQRestriction
public CardinalityQRestriction createCardinalityQRestriction(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.
- Specified by:
createCardinalityQRestrictionin interfaceOntModel- Parameters:
uri- The optional URI for the restriction, or null for an anonymous restriction (which should be the normal case)prop- The property the restriction applies tocardinality- The cardinality of the propertycls- The class to which all values of the restricted property should belong- Returns:
- A new resource representing a mas-cardinality restriction
-
createDataRange
Answer a data range defined as the given set of concrete data values. DataRange resources are necessarily bNodes.
- Specified by:
createDataRangein interfaceOntModel- Parameters:
literals- An iterator over a set of literals that will be the members of the data range, or null to define an empty data range- Returns:
- A new data range containing the given literals as permissible values
-
createAllDifferent
Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct.
AllDifferentis a feature of OWL only, and is something of an anomaly in that it exists only to give a place to anchor thedistinctMembersproperty, which is the actual expression of the fact.- Specified by:
createAllDifferentin interfaceOntModel- Returns:
- A new AllDifferent resource
-
createAllDifferent
Answer a new, anonymous node representing the fact that a given set of classes are all pair-wise distinct.
AllDifferentis a feature of OWL only, and is something of an anomaly in that it exists only to give a place to anchor thedistinctMembersproperty, which is the actual expression of the fact.- Specified by:
createAllDifferentin interfaceOntModel- Parameters:
differentMembers- A list of the class expressions that denote a set of mutually disjoint classes- Returns:
- A new AllDifferent resource
-
createOntResource
public <T extends OntResource> T createOntResource(Class<T> javaClass, Resource rdfType, String uri) Answer a resource that represents a generic ontology node in this model. If a resource with the given uri exists in the model, it will be re-used. If not, a new one is created in the updateable sub-graph of the ontology model.
This is a generic method for creating any known ontology value. The selector that determines which resource to create is the same as as the argument to the
as()method: the Java class object of the desired abstraction. For example, to create an ontology class via this mechanism, use:OntClass c = (OntClass) myModel.createOntResource( OntClass.class, null, "http://example.org/ex#Parrot" );- Specified by:
createOntResourcein interfaceOntModel- Parameters:
javaClass- The Java class object that represents the ontology abstraction to createrdfType- Optional resource denoting the ontology class to which an individual or axiom belongs, if that is the type of resource being created.uri- The uri for the ontology resource, or null for an anonymous resource.- Returns:
- An ontology resource, of the type specified by the
javaClass
-
createOntResource
Answer a resource presenting the
OntResourcefacet, which has the given URI.- Specified by:
createOntResourcein interfaceOntModel- Parameters:
uri- The URI of the resource, or null for an anonymous resource (aka bNode)- Returns:
- An OntResource with the given URI
-
createList
Answer a new empty list. This method overrides the list create method in ModelCom, to allow both DAML and RDFS lists to be created.
- Specified by:
createListin interfaceModel- Overrides:
createListin classModelCom- Returns:
- An RDF-encoded list of no elements, using the current language profile
-
getProfile
Answer the language profile (for example, OWL or DAML+OIL) that this model is working to.
- Specified by:
getProfilein interfaceOntModel- Returns:
- A language profile
-
loadImports
public void loadImports()Determine which models this model imports (by looking for, for example,
owl:importsstatements, and load each of those models as an import. A check is made to determine if a model has already been imported, if so, the import is ignored. Thus this method is safe against circular sets of import statements. Note that actual implementation is delegated to the associatedOntDocumentManager.- Specified by:
loadImportsin interfaceOntModel
-
hasLoadedImport
Answer true if this model has had the given URI document imported into it. This is important to know since an import only occurs once, and we also want to be able to detect cycles of imports.
- Specified by:
hasLoadedImportin interfaceOntModel- Parameters:
uri- An ontology URI- Returns:
- True if the document corresponding to the URI has been successfully loaded into this model
-
addLoadedImport
Record that this model has now imported the document with the given URI, so that it will not be re-imported in the future.
- Specified by:
addLoadedImportin interfaceOntModel- Parameters:
uri- A document URI that has now been imported into the model.
-
removeLoadedImport
Record that this model no longer imports the document with the given URI.
- Specified by:
removeLoadedImportin interfaceOntModel- Parameters:
uri- A document URI that is no longer imported into the model.
-
listImportedOntologyURIs
Answer a list of the imported URI's in this ontology model. Detection of
importsstatments will be according to the local language profile- Specified by:
listImportedOntologyURIsin interfaceOntModel- Returns:
- The imported ontology URI's as a set. Note that since the underlying graph is not ordered, the order of values in the list in successive calls to this method is not guaranteed to be preserved.
-
listImportedOntologyURIs
Answer a list of the imported URI's in this ontology model, and optionally in the closure of this model's imports. Detection of
importsstatments will be according to the local language profile. Note that, in order to allow this method to be called during the imports closure process, we only query the base model, thus side-stepping the any attached reasoner.- Specified by:
listImportedOntologyURIsin interfaceOntModel- Parameters:
closure- If true, the set of uri's returned will include not only those directly imported by this model, but those imported by the model's imports transitively.- Returns:
- The imported ontology URI's as a list. Note that since the underlying graph is not ordered, the order of values in the list in successive calls to this method is not guaranteed to be preserved.
-
getImportModelMaker
Answer the model maker associated with this model (used for constructing the constituent models of the imports closure).
- Specified by:
getImportModelMakerin interfaceOntModel- Returns:
- The local graph factory
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
read
Read statements into the model from the given source, and then load imported ontologies (according to the document manager policy).
-
getSubGraphs
Answer the sub-graphs of this model. A sub-graph is defined as a graph that is used to contain the triples from an imported document.
- Specified by:
getSubGraphsin interfaceOntModel- Returns:
- A list of sub graphs for this ontology model
-
listSubModels
Answer an iterator over the ontology models that are sub-models of this model. Sub-models are used, for example, to represent composite documents such as the imports of a model. So if ontology A imports ontologies B and C, each of B and C will be available as one of the sub-models of the model containing A. Note that to fully replicate the behaviour of
listImportedModels, thewithImportsflag must be set to true. Each model returned by this method will have been wrapped as an ontology model using the sameOntModelSpecas this model. If this model has no sub-models, the returned iterator will be non-null but will not have any values.- Specified by:
listSubModelsin interfaceOntModel- Parameters:
withImports- If true, each sub-model returned by this method will also include its import models. So if model A imports D, and D imports D, when called withwithImportsset to true, the return value formodelA.listSubModels(true)will be an iterator, whose only value is a model for D, and that model will contain a sub-model representing the import of E. IfwithImportsis false, E will not be included as a sub-model of D.- Returns:
- An iterator, each value of which will be an
OntModelrepresenting a sub-model of this ontology.
-
listSubModels
Answer an iterator over the ontology models that are sub-models of this model. Sub-models are used, for example, to represent composite documents such as the imports of a model. So if ontology A imports ontologies B and C, each of B and C will be available as one of the sub-models of the model containing A. Important note on behaviour change: please see the comment on
listSubModels(boolean)for explanation of thewithImportsflag. This zero-argument form oflistSubModelssetswithImportsto false, so the returned models will not themselves contain imports.- Specified by:
listSubModelsin interfaceOntModel- Returns:
- An iterator, each value of which will be an
OntModelrepresenting a sub-model of this ontology. - See Also:
-
countSubModels
public int countSubModels()Answer the number of sub-models of this model, not including the base model.
- Specified by:
countSubModelsin interfaceOntModel- Returns:
- The number of sub-models, ≥ zero.
-
getImportedModel
Answer an
OntModelrepresenting the imported ontology with the given URI. If an ontology with that URI has not been imported, answer null.- Specified by:
getImportedModelin interfaceOntModel- Parameters:
uri- The URI of an ontology that may have been imported into the ontology represented by this model- Returns:
- A model representing the imported ontology with the given URI, or null.
-
getBaseGraph
Answer the base-graph of this model. The base-graph is the graph that contains the triples read from the source document for this ontology.
- Returns:
- The base-graph for this ontology model
-
getBaseModel
Answer the base model of this model. The base model is the model wrapping the graph that contains the triples read from the source document for this ontology. It is therefore the model that will be updated if statements are added to a model that is built from a union of documents (via the
importsstatements in the source document).- Specified by:
getBaseModelin interfaceOntModel- Returns:
- The base model for this ontology model
-
addSubModel
Add the given model as one of the sub-models of the enclosed ontology union model. Note that if
modelis a composite model (i.e. anOntModelorInfModel), the model and all of its submodels will be added to the union of sub-models of this model. If this is not required, callers should explicitly add only the base model:parent.addSubModel( child.getBaseModel() );
- Specified by:
addSubModelin interfaceOntModel- Parameters:
model- A sub-model to add- See Also:
-
addSubModel
Add the given model as one of the sub-models of the enclosed ontology union model. Note that if
modelis a composite model (i.e. anOntModelorInfModel), the model and all of its submodels will be added to the union of sub-models of this model. If this is not required, callers should explicitly add only the base model:parent.addSubModel( child.getBaseModel(), true );
- Specified by:
addSubModelin interfaceOntModel- Parameters:
model- A sub-model to addrebind- If true, rebind any associated inferencing engine to the new data (which may be an expensive operation)
-
removeSubModel
Remove the given model as one of the sub-models of the enclosed ontology union model. Will cause the associated infererence engine (if any) to update, so this may be an expensive operation in some cases.
- Specified by:
removeSubModelin interfaceOntModel- Parameters:
model- A sub-model to remove- See Also:
-
removeSubModel
Remove the given model as one of the sub-models of the enclosed ontology union model.
- Specified by:
removeSubModelin interfaceOntModel- Parameters:
model- A sub-model to removerebind- If true, rebind any associated inferencing engine to the new data (which may be an expensive operation)
-
isInBaseModel
Answer true if the given node is a member of the base model of this ontology model. This is an important distiction, because only the base model receives updates when the ontology model is updated. Thus, removing properties of a resource that is not in the base model will not actually side-effect the overall model.
- Specified by:
isInBaseModelin interfaceOntModel- Parameters:
node- An RDF node (Resource, Property or Literal) to test- Returns:
- True if the given node is from the base model
-
isInBaseModel
Answer true if the given statement is defined in the base model of this ontology model. This is an important distiction, because only the base model receives updates when the ontology model is updated. Thus, removing a statement that is not in the base model will not actually side-effect the overall model.
- Specified by:
isInBaseModelin interfaceOntModel- Parameters:
stmt- A statement to test- Returns:
- True if the given statement is from the base model
-
strictMode
public boolean strictMode()Answer true if this model is currently in strict checking mode. Strict mode means that converting a common resource to a particular language element, such as an ontology class, will be subject to some simple syntactic-level checks for appropriateness.
- Specified by:
strictModein interfaceOntModel- Returns:
- True if in strict checking mode
-
setStrictMode
public void setStrictMode(boolean strict) Set the checking mode to strict or non-strict.
- Specified by:
setStrictModein interfaceOntModel- Parameters:
strict-- See Also:
-
setDynamicImports
public 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.
- Specified by:
setDynamicImportsin interfaceOntModel- Parameters:
dynamic- If true, adding or removing an imports statement to the model will result in a change in the imports closure. If false, changes to the imports are not monitored dynamically. Default false.
-
getDynamicImports
public boolean getDynamicImports()Answer true if the imports closure of the model will be dynamically updated as imports statements are added and removed.
- Specified by:
getDynamicImportsin interfaceOntModel- Returns:
- True if the imports closure is updated dynamically.
-
getSpecification
Answer the ontology model specification that was used to construct this model
- Specified by:
getSpecificationin interfaceOntModel- Returns:
- An ont model spec instance.
-
write
Description copied from interface:ModelWrite the model as an XML document. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
-
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynullis "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML".- Specified by:
writein interfaceModel- Specified by:
writein interfaceOntModel- Overrides:
writein classModelCom- Parameters:
writer- The output writerlang- The language in which the RDF should be writtenbase- The base uri for relative URI calculations.nullmeans use only absolute URI's.- Returns:
- this model
-
write
Description copied from interface:ModelWrite a serialization of this model as an XML document.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "N3". The default value is represented bynullis "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of this model in a specified language.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML". -
write
Description copied from interface:ModelWrite a serialized representation of a model in a specified language.
The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE", "TURTLE", (and "TTL") and "N3". The default value, represented bynull, is "RDF/XML".- Specified by:
writein interfaceModel- Specified by:
writein interfaceOntModel- Overrides:
writein classModelCom- Parameters:
out- The output stream to which the RDF is writtenlang- The language in which the RDF should be writtenbase- The base uri to use when writing relative URI's.nullmeans use only absolute URI's. This is used for relative URIs that would be resolved against the document retrieval URL. For some values oflang, this value may be included in the output.- Returns:
- This model
-
writeAll
Description copied from interface:OntModelWrite a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. To write only the data asserted in the base model, use
write. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "TURTLE". The default value, represented bynull, is "RDF/XML". -
writeAll
Description copied from interface:OntModelWrite a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. To write only the data asserted in the base model, use
write.The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "TURTLE". The default value, represented bynull, is "RDF/XML". -
writeAll
Description copied from interface:OntModelWrite a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. To write only the data asserted in the base model, use
write. It is often better to use an OutputStream rather than a Writer, since this will avoid character encoding errors.The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "TURTLE". The default value, represented bynull, is "RDF/XML". -
writeAll
Description copied from interface:OntModelWrite a serialized representation of all of the contents of the model, including inferred statements and statements imported from other documents. To write only the data asserted in the base model, use
write.The language in which to write the model is specified by the
langargument. Predefined values are "RDF/XML", "RDF/XML-ABBREV", "N-TRIPLE" and "TURTLE". The default value, represented bynull, is "RDF/XML". -
getRawModel
Return the raw RDF model being processed (i.e. the argument to the Reasonder.bind call that created this InfModel).- Specified by:
getRawModelin interfaceInfModel
-
getReasoner
Return the Reasoner which is being used to answer queries to this graph.- Specified by:
getReasonerin interfaceInfModel
-
rebind
public void rebind()Cause the inference model to reconsult the underlying data to take into account changes. Normally changes are made through the InfModel's add and remove calls are will be handled appropriately. However, in some cases changes are made "behind the InfModels's back" and this forces a full reconsult of the changed data. -
prepare
public void prepare()Perform any initial processing and caching. This call is optional. Most engines either have negligable set up work or will perform an implicit "prepare" if necessary. The call is provided for those occasions where substantial preparation work is possible (e.g. running a forward chaining rule system) and where an application might wish greater control over when this prepration is done rather than just leaving to be done at first query time. -
reset
public void reset()Reset any internal caches. Some systems, such as the tabled backchainer, retain information after each query. A reset will wipe this information preventing unbounded memory use at the expense of more expensive future queries. A reset does not cause the raw data to be reconsulted and so is less expensive than a rebind. -
getDeductionsModel
Returns a derivations model. The rule reasoners typically create a graph containing those triples added to the base graph due to rule firings. In some applications it can useful to be able to access those deductions directly, without seeing the raw data which triggered them. In particular, this allows the forward rules to be used as if they were rewrite transformation rules.
- Specified by:
getDeductionsModelin interfaceInfModel- Returns:
- The derivations model, if one is defined, or else null
-
validate
Test the consistency of the underlying data. This normally tests the validity of the bound instance data against the bound schema data. -
listStatements
public StmtIterator listStatements(Resource subject, Property predicate, RDFNode object, Model posit) Find all the statements matching a pattern.Return an iterator over all the statements in a model that match a pattern. The statements selected are those whose subject matches the
subjectargument, whose predicate matches thepredicateargument and whose object matches theobjectargument. If an argument isnullit matches anything.The s/p/o terms may refer to resources which are temporarily defined in the "posit" model. This allows one, for example, to query what resources are of type CE where CE is a class expression rather than a named class - put CE in the posit arg.
- Specified by:
listStatementsin interfaceInfModel- Parameters:
subject- The subject soughtpredicate- The predicate soughtobject- The value soughtposit- Model containing additional assertions to be considered when matching statements- Returns:
- an iterator over the subjects
-
setDerivationLogging
public void setDerivationLogging(boolean logOn) Switch on/off drivation logging. If this is switched on then every time an inference is a made that fact is recorded and the resulting record can be access through a later getDerivation call. This may consume a lot of space!- Specified by:
setDerivationLoggingin interfaceInfModel
-
getDerivation
Return the derivation of the given statement (which should be the result of some previous list operation). Not all reasoneers will support derivations.- Specified by:
getDerivationin interfaceInfModel- Returns:
- an iterator over Derivation records or null if there is no derivation information available for this triple.
- See Also:
-
getOntResource
Answer a resource presenting the
OntResourcefacet, which has the given URI. If no such resource is currently present in the model, return null.- Specified by:
getOntResourcein interfaceOntModel- Parameters:
uri- The URI of a resource- Returns:
- An OntResource with the given URI, or null
-
getOntResource
Answer a resource presenting the
OntResourcefacet, which corresponds to the given resource but attached to this model.- Specified by:
getOntResourcein interfaceOntModel- Parameters:
res- An existing resource- Returns:
- An
OntResourceattached to this model that has the same URI or anonID as the given resource
-