📄 damlclassimpl.java
字号:
/*****************************************************************************
* Source code information
* -----------------------
* Original author Ian Dickinson, HP Labs Bristol
* Author email Ian.Dickinson@hp.com
* Package Jena
* Created 4 Jan 2001
* Filename $RCSfile: DAMLClassImpl.java,v $
* Revision $Revision: 1.18 $
* Release status Preview-release $State: Exp $
*
* Last modified on $Date: 2007/01/08 14:40:30 $
* by $Author: ian_dickinson $
*
* (c) Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
* (see footer for full conditions)
*****************************************************************************/
// Package
///////////////
package com.hp.hpl.jena.ontology.daml.impl;
// Imports
///////////////
import java.util.*;
import com.hp.hpl.jena.enhanced.*;
import com.hp.hpl.jena.graph.*;
import com.hp.hpl.jena.ontology.*;
import com.hp.hpl.jena.ontology.daml.*;
import com.hp.hpl.jena.ontology.impl.*;
import com.hp.hpl.jena.rdf.model.*;
import com.hp.hpl.jena.vocabulary.*;
import com.hp.hpl.jena.util.iterator.*;
/**
* <p>Java representation of a DAML ontology Class. Note that the ontology classes are
* not the same as Java classes: think of classifications rather than active data structures.</p>
*
* @author Ian Dickinson, HP Labs (<a href="mailto:Ian.Dickinson@hp.com">email</a>)
* @version CVS info: $Id: DAMLClassImpl.java,v 1.18 2007/01/08 14:40:30 ian_dickinson Exp $
* @deprecated The DAML API is scheduled to be removed from Jena 2.6 onwards. Please use the DAML profile in the main ontology API
*/
public class DAMLClassImpl
extends OntClassImpl
implements DAMLClass
{
// Constants
//////////////////////////////////
// Static variables
//////////////////////////////////
/**
* A factory for generating DAMLClass facets from nodes in enhanced graphs.
* Note: should not be invoked directly by user code: use
* {@link com.hp.hpl.jena.rdf.model.RDFNode#as as()} instead.
*/
public static Implementation factory = new Implementation() {
public EnhNode wrap( Node n, EnhGraph eg ) {
if (canWrap( n, eg )) {
return new DAMLClassImpl( n, eg );
}
else {
throw new ConversionException( "Cannot convert node " + n.toString() + " to DAMLClass" );
}
}
public boolean canWrap( Node node, EnhGraph eg ) {
// node will support being an DAMLClass facet if it has rdf:type owl:Class or equivalent
Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null;
return (profile != null) && profile.isSupported( node, eg, DAMLClass.class );
}
};
// Instance variables
//////////////////////////////////
/** Property accessor for onProperty */
private PropertyAccessor m_propSubClassOf = new PropertyAccessorImpl( getProfile().SUB_CLASS_OF(), this );
/** Property accessor for disjointWith */
private PropertyAccessor m_propDisjointWith = new PropertyAccessorImpl( getProfile().DISJOINT_WITH(), this );
/** Property accessor for disjointUnionOf */
private PropertyAccessor m_propDisjointUnionOf = new PropertyAccessorImpl( DAML_OIL.disjointUnionOf, this );
/** Property accessor for sameClassAs */
private PropertyAccessor m_propSameClassAs = new PropertyAccessorImpl( getProfile().EQUIVALENT_CLASS(), this );
/** Property accessor for oneOf */
private PropertyAccessor m_propOneOf = new PropertyAccessorImpl( getProfile().ONE_OF(), this );
/** Property accessor for unionOf */
private PropertyAccessor m_propUnionOf = new PropertyAccessorImpl( getProfile().UNION_OF(), this );
/** Property accessor for intersectionOf */
private PropertyAccessor m_propIntersectionOf = new PropertyAccessorImpl( getProfile().INTERSECTION_OF(), this );
/** Property accessor for complementOf */
private PropertyAccessor m_propComplementOf = new PropertyAccessorImpl( getProfile().COMPLEMENT_OF(), this );
/** DAML common delegate */
protected DAMLCommon m_common = null;
/** Vocabulary - this is really obsoleted by the profile mechanism */
protected DAMLVocabulary m_vocabulary = VocabularyManager.getDefaultVocabulary();
// Constructors
//////////////////////////////////
/**
* <p>
* Construct a DAML class represented by the given node in the given graph.
* </p>
*
* @param n The node that represents the resource
* @param g The enh graph that contains n
*/
public DAMLClassImpl( Node n, EnhGraph g ) {
super( n, g );
m_common = new DAMLCommonImpl( n, g );
}
// External signature methods
//////////////////////////////////
// delegate to DAMLCommon what we can
/** @deprecated */
public void setRDFType( Resource rdfClass, boolean replace ) { m_common.setRDFType( rdfClass, replace ); }
public DAMLModel getDAMLModel() { return m_common.getDAMLModel(); }
public ExtendedIterator getRDFTypes( boolean complete ) { return m_common.getRDFTypes( complete ); }
public DAMLVocabulary getVocabulary() { return m_vocabulary; }
public LiteralAccessor prop_label() { return m_common.prop_label(); }
public LiteralAccessor prop_comment() { return m_common.prop_comment(); }
public PropertyAccessor prop_equivalentTo() { return m_common.prop_equivalentTo(); }
public PropertyAccessor prop_type() { return m_common.prop_type(); }
/**
* <p>Answer an iterator over all of the DAML objects that are equivalent to this
* class, which will be the union of <code>daml:equivalentTo</code> and
* <code>daml:sameClassAs</code>.</p>
*
* @return an iterator ranging over every equivalent DAML class
*/
public ExtendedIterator getEquivalentValues() {
ConcatenatedIterator i = new ConcatenatedIterator(
// first the iterator over the equivalentTo values
m_common.getEquivalentValues(),
// followed by the sameClassAs values
getSameClasses() );
return UniqueExtendedIterator.create( i ).mapWith( new AsMapper( DAMLClass.class ) );
}
/**
* Answer the set of equivalent values to this value, but not including the
* value itself. The iterator will range over a set: each element occurs only
* once.
*
* @return An iteration ranging over the set of values that are equivalent to this
* value, but not itself.
*/
public ExtendedIterator getEquivalenceSet() {
Set s = new HashSet();
s.add( this );
for (Iterator i = getEquivalentValues(); i.hasNext(); s.add( i.next() ) );
s.remove( this );
return WrappedIterator.create( s.iterator() );
}
/**
* <p>Property accessor for the <code>daml:subClassOf</code> property of a class. This
* denotes a class that is a super-class of this class.
*
* @return Property accessor for <code>daml:subClassOf</code>.
*/
public PropertyAccessor prop_subClassOf() {
return m_propSubClassOf;
}
/**
* <p>Property accessor for the <code>daml:disjointWith</code> property of a class. This
* denotes a class with which this class has no instances in common.</p>
*
* @return Property accessor for <code>daml:disjointWith</code>.
*/
public PropertyAccessor prop_disjointWith() {
return m_propDisjointWith;
}
/**
* <p>Property accessor for the <code>daml:disjointUnionOf</code> property of a class. This
* denotes a list of classes that are each pair-wise disjoint, and whose
* union describes this class.</p>
*
* @return Property accessor for <code>daml:disjointUnionOf</code>.
*/
public PropertyAccessor prop_disjointUnionOf() {
return m_propDisjointUnionOf;
}
/**
* <p>Property accessor for the <code>daml:sameClassAs</code> property of a DAML class. This
* denotes a class whose instances are the same those of this class.</p>
*
* @return Property accessor for <code>daml:sameClassAs</code>.
*/
public PropertyAccessor prop_sameClassAs() {
return m_propSameClassAs;
}
/**
* <p>Property accessor for the property <code>daml:unionOf</code>, which denotes a class
* expression consisting of the union (disjunction) of a list of classes.</p>
*
* @return Property accessor for <code>daml:unionOf</code>.
*/
public PropertyAccessor prop_unionOf() {
return m_propUnionOf;
}
/**
* <p>Property accessor for the property <code>daml:intersectionOf</code>, which denotes an
* intersection (conjunction) of a list of classes.</p>
*
* @return Property accessor for <code>daml:intersectionOf</code>.
*/
public PropertyAccessor prop_intersectionOf() {
return m_propIntersectionOf;
}
/**
* <p>Property accessor for the property <code>daml:compelementOf</code>, which denotes the
* class whose members are the individuals not in the given class.</p>
*
* @return Property accessor for <code>daml:compelementOf</code>.
*/
public PropertyAccessor prop_complementOf() {
return m_propComplementOf;
}
/**
* <p>Property accessor for the <code>daml:oneOf</code> property, which defines a class expression
* denoting that the class is exactly one of the given list of classes.</p>
*
* @return Property accessor for <code>daml:oneOf</code>.
*/
public PropertyAccessor prop_oneOf() {
return m_propOneOf;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -