/** * <p> * Answer an ontology class to which this individual belongs. If the resource * belongs to more than one class, which is common in ontology models using * a reasoner, then the return value will be one of * the possible values but <strong>it is not specified which one</strong>. * In the case of multiple classes, callers <strong>should not</strong> rely on * the return value being consistent, e.g. across runs, since it may * depend on the underlying hash indexes in the model. </p> * * @param direct If <code>true</code>, only <em>direct</em> classes are considered. * A class is a direct class of this <code>Individual</code> if and only if * there is no other resource is both an <code>rdf:type</code> of this * individual and a sub-class of the candidate class. * * @return A resource denoting the ontology class for this individual, or one of them if * more than one is defined. * @exception ConversionException if the return value is known to be an * ontology class, assuming strict type checking is turned on for the underlying * <code>OntModel</code>. See {@link OntModel#setStrictMode(boolean)} */ @Override public OntClass getOntClass( boolean direct ) { return (getRDFType( direct ).as( OntClass.class )); }
/** * <p> * Answer an ontology class to which this individual belongs. If the resource * belongs to more than one class, which is common in ontology models using * a reasoner, then the return value will be one of * the possible values but <strong>it is not specified which one</strong>. * In the case of multiple classes, callers <strong>should not</strong> rely on * the return value being consistent, e.g. across runs, since it may * depend on the underlying hash indexes in the model. </p> * * @param direct If <code>true</code>, only <em>direct</em> classes are considered. * A class is a direct class of this <code>Individual</code> if and only if * there is no other resource is both an <code>rdf:type</code> of this * individual and a sub-class of the candidate class. * * @return A resource denoting the ontology class for this individual, or one of them if * more than one is defined. * @exception ConversionException if the return value is known to be an * ontology class, assuming strict type checking is turned on for the underlying * <code>OntModel</code>. See {@link OntModel#setStrictMode(boolean)} */ @Override public OntClass getOntClass( boolean direct ) { return (getRDFType( direct ).as( OntClass.class )); }