📄 ontmodel.java
字号:
/*****************************************************************************
* Source code information
* -----------------------
* Original author Ian Dickinson, HP Labs Bristol
* Author email Ian.Dickinson@hp.com
* Package Jena 2
* Web http://sourceforge.net/projects/jena/
* Created 10 Feb 2003
* Filename $RCSfile: OntModel.java,v $
* Revision $Revision: 1.52 $
* Release status $State: Exp $
*
* Last modified on $Date: 2007/01/09 17:06:14 $
* by $Author: ian_dickinson $
*
* (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
* (see footer for full conditions)
* ****************************************************************************/
// Package
///////////////
package com.hp.hpl.jena.ontology;
// Imports
///////////////
import com.hp.hpl.jena.graph.query.BindingQueryPlan;
import com.hp.hpl.jena.ontology.event.OntEventManager;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
import java.io.*;
import java.util.*;
/**
* <p>
* An enhanced view of a Jena model that is known to contain ontology
* data, under a given ontology {@link Profile 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:
* <code><pre>
* :A rdf:type owl:Class .
* :B rdf:type owl:Class ; rdfs:subClassOf :A .
* :widget rdf:type :B .
* </pre></code>
* In a non-inferencing model, the <code>rdf:type</code> of the widget will be
* reported as class <code>:B</code> only. In a model that can process the OWL
* semantics, the widget's types will include <code>:B</code>, <code>:A</code>,
* and <code>owl:Thing</code>.
* </p>
* <p>
* <strong>Note:</strong> that <code>OntModel</code> is an extension to the
* {@link 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
* <code>InfModel</code>, 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.
* </p>
*
* @author Ian Dickinson, HP Labs
* (<a href="mailto:Ian.Dickinson@hp.com" >email</a>)
* @version CVS $Id: OntModel.java,v 1.52 2007/01/09 17:06:14 ian_dickinson Exp $
*/
public interface OntModel
extends InfModel
{
// Constants
//////////////////////////////////
// External signature methods
//////////////////////////////////
/**
* <p>
* Answer an iterator that ranges over the ontology resources in this model, i.e.
* the resources with <code>rdf:type Ontology</code> or equivalent. These resources
* typically contain metadata about the ontology document that contains them.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model, see
* {@link Profile#ONTOLOGY}.
* </p>
*
* @return An iterator over ontology resources.
*/
public ExtendedIterator listOntologies();
/**
* <p>
* Answer an iterator that ranges over the property resources in this model, i.e.
* the resources with <code>rdf:type Property</code> or equivalent. An <code>OntProperty</code>
* is equivalent to an <code>rdfs:Property</code> in a normal RDF graph; this type is
* provided as a common super-type for the more specific {@link ObjectProperty} and
* {@link DatatypeProperty} property types.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model.
* </p>
*
* @return An iterator over property resources.
*/
public ExtendedIterator listOntProperties();
/**
* <p>
* Answer an iterator that ranges over the object property resources in this model, i.e.
* the resources with <code>rdf:type ObjectProperty</code> or 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).
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#OBJECT_PROPERTY}.
* </p>
*
* @return An iterator over object property resources.
*/
public ExtendedIterator listObjectProperties();
/**
* <p>
* Answer an iterator that ranges over the datatype property resources in this model, i.e.
* the resources with <code>rdf:type DatatypeProperty</code> or 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).
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#DATATYPE_PROPERTY}.
* </p>
*
* @return An iterator over datatype property resources.
*/
public ExtendedIterator listDatatypeProperties();
/**
* <p>
* Answer an iterator that ranges over the functional property resources in this model, i.e.
* the resources with <code>rdf:type FunctionalProperty</code> or 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.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#FUNCTIONAL_PROPERTY}.
* </p>
*
* @return An iterator over functional property resources.
*/
public ExtendedIterator listFunctionalProperties();
/**
* <p>
* Answer an iterator that ranges over the transitive property resources in this model, i.e.
* the resources with <code>rdf:type TransitiveProperty</code> or equivalent.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#TRANSITIVE_PROPERTY}.
* </p>
*
* @return An iterator over transitive property resources.
*/
public ExtendedIterator listTransitiveProperties();
/**
* <p>
* Answer an iterator that ranges over the symmetric property resources in this model, i.e.
* the resources with <code>rdf:type SymmetricProperty</code> or equivalent.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#SYMMETRIC_PROPERTY}.
* </p>
*
* @return An iterator over symmetric property resources.
*/
public ExtendedIterator listSymmetricProperties();
/**
* <p>
* Answer an iterator that ranges over the inverse functional property resources in this model, i.e.
* the resources with <code>rdf:type InverseFunctionalProperty</code> or equivalent.
* </p>
* <p>
* Specifically, the resources in this iterator will those whose type corresponds
* to the value given in the ontology vocabulary associated with this model: see
* {@link Profile#INVERSE_FUNCTIONAL_PROPERTY}.
* </p>
*
* @return An iterator over inverse functional property resources.
*/
public ExtendedIterator listInverseFunctionalProperties();
/**
* <p>
* Answer an iterator that ranges over the individual resources in this model, i.e.
* the resources with <code>rdf:type</code> corresponding to a class defined
* in the ontology.
* </p>
*
* @return An iterator over individual resources.
*/
public ExtendedIterator listIndividuals();
/**
* <p>
* Answer an iterator that ranges over the resources in this model that are
* instances of the given class.
* </p>
*
* @return An iterator over individual resources whose <code>rdf:type</code>
* is <code>cls</code>.
*/
public ExtendedIterator listIndividuals( Resource cls );
/**
* <p>
* Answer an iterator that ranges over all of the various forms of class description resource
* in this model. Class descriptions include {@linkplain #listEnumeratedClasses enumerated}
* classes, {@linkplain #listUnionClasses union} classes, {@linkplain #listComplementClasses complement}
* classes, {@linkplain #listIntersectionClasses intersection} classes, {@linkplain #listClasses named}
* classes and {@linkplain #listRestrictions property restrictions}.
* </p>
* @return An iterator over class description resources.
*/
public ExtendedIterator listClasses();
/**
* <p>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. <code>owl:Thing</code> or <code>daml:Thing</code>)
* as a direct super-class, or the classes which have no declared super-class.</p>
* @return An iterator of the root classes in the local class hierarchy
*/
public ExtendedIterator listHierarchyRootClasses();
/**
* <p>
* Answer an iterator that ranges over the enumerated class class-descriptions
* in this model, i.e. the class resources specified to have a property
* <code>oneOf</code> (or equivalent) and a list of values.
* </p>
*
* @return An iterator over enumerated class resources.
* @see Profile#ONE_OF
*/
public ExtendedIterator listEnumeratedClasses();
/**
* <p>
* Answer an iterator that ranges over the union class-descriptions
* in this model, i.e. the class resources specified to have a property
* <code>unionOf</code> (or equivalent) and a list of values.
* </p>
*
* @return An iterator over union class resources.
* @see Profile#UNION_OF
*/
public ExtendedIterator listUnionClasses();
/**
* <p>
* Answer an iterator that ranges over the complement class-descriptions
* in this model, i.e. the class resources specified to have a property
* <code>complementOf</code> (or equivalent) and a list of values.
* </p>
*
* @return An iterator over complement class resources.
* @see Profile#COMPLEMENT_OF
*/
public ExtendedIterator listComplementClasses();
/**
* <p>
* Answer an iterator that ranges over the intersection class-descriptions
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -