com.ontotext.gate.ontology
Class OntologyImpl
java.lang.Object
gate.util.AbstractFeatureBearer
gate.creole.AbstractResource
gate.creole.AbstractLanguageResource
com.ontotext.gate.ontology.TaxonomyImpl
com.ontotext.gate.ontology.OntologyImpl
- All Implemented Interfaces:
- FeatureBearer, LanguageResource, NameBearer, Ontology, Resource, Serializable, Taxonomy
- Direct Known Subclasses:
- DAMLKnowledgeBaseImpl
- public class OntologyImpl
- extends TaxonomyImpl
- implements Ontology
- See Also:
- Serialized Form
Method Summary |
DatatypeProperty |
addDatatypeProperty(String name,
OClass domain,
Number value)
Create a DatatypeProperty with the given domain and range |
DatatypeProperty |
addDatatypeProperty(String name,
OClass domain,
String value)
Create a DatatypeProperty with the given domain and range |
FunctionalProperty |
addFunctionalProperty(String name,
OClass domain,
Object range)
Create a FunctionalProperty with the given domain and range |
void |
addInstance(OInstance theInstance)
Adds an instance to the ontology. |
OInstance |
addInstance(String name,
OClass theClass)
Adds an instance to the ontology. |
ObjectProperty |
addObjectProperty(String name,
OClass domain,
OClass range)
|
void |
addPropertyDefinition(Property theProperty)
|
SymmetricProperty |
addSymmetricProperty(String name,
OClass domain,
OClass range)
|
TransitiveProperty |
addTransitiveProperty(OClass domain,
OClass range)
|
TClass |
createClass(String aName,
String aComment)
Creates a new OClass and returns it. |
List |
getDirectInstances(OClass aClass)
Gets all instances in the ontology, which belong to the
given class only. |
OInstance |
getInstanceByName(String aName)
Gets the instance with the given name. |
List |
getInstances()
Gets all instances in the ontology. |
List |
getInstances(OClass aClass)
Gets all instances in the ontology, which belong to this class,
including instances of sub-classes. |
Property |
getPropertyDefinitionByName(String name)
|
Set |
getPropertyDefinitions()
|
void |
removeInstance(OInstance theInstance)
Removes the instance from the ontology. |
Methods inherited from class com.ontotext.gate.ontology.TaxonomyImpl |
addClass, addObjectModificationListener, containsClassByName, equals, fireObjectModificationEvent, getClassByName, getClasses, getClasses, getComment, getId, getLabel, getOntology, getSourceURI, getTaxonomicDistance, getTopClasses, getURL, getVersion, init, isDirectSubClassOf, isModified, isSubClassOf, load, reinfer, removeClass, setComment, setId, setLabel, setModified, setSourceURI, setURL, setVersion, store, toString |
Methods inherited from class gate.creole.AbstractResource |
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners |
Methods inherited from interface gate.creole.ontology.Taxonomy |
addClass, containsClassByName, equals, getClassByName, getClasses, getClasses, getComment, getId, getLabel, getOntology, getSourceURI, getTaxonomicDistance, getTopClasses, getURL, getVersion, isDirectSubClassOf, isModified, isSubClassOf, load, removeClass, setComment, setId, setLabel, setModified, setSourceURI, setURL, setVersion, store |
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
instancesByName
private Map instancesByName
instances
private List instances
propertyDefinitionSet
private Set propertyDefinitionSet
OntologyImpl
public OntologyImpl()
addInstance
public OInstance addInstance(String name,
OClass theClass)
- Description copied from interface:
Ontology
- Adds an instance to the ontology.
- Specified by:
addInstance
in interface Ontology
- Parameters:
name
- the instance name to be addedtheClass
- the class to be added
- Returns:
- the OInstance that has been added to the ontology
addInstance
public void addInstance(OInstance theInstance)
- Description copied from interface:
Ontology
- Adds an instance to the ontology.
- Specified by:
addInstance
in interface Ontology
removeInstance
public void removeInstance(OInstance theInstance)
- Description copied from interface:
Ontology
- Removes the instance from the ontology.
- Specified by:
removeInstance
in interface Ontology
- Parameters:
theInstance
- to be removed
getInstances
public List getInstances()
- Description copied from interface:
Ontology
- Gets all instances in the ontology.
- Specified by:
getInstances
in interface Ontology
- Returns:
- List of OInstance objects
getInstances
public List getInstances(OClass aClass)
- Description copied from interface:
Ontology
- Gets all instances in the ontology, which belong to this class,
including instances of sub-classes. If only the instances
of the given class are needed, then use getDirectInstances.
- Specified by:
getInstances
in interface Ontology
- Parameters:
aClass
- the class of the instances
- Returns:
- List of OInstance objects
getDirectInstances
public List getDirectInstances(OClass aClass)
- Description copied from interface:
Ontology
- Gets all instances in the ontology, which belong to the
given class only.
- Specified by:
getDirectInstances
in interface Ontology
- Parameters:
aClass
- the class of the instances
- Returns:
- List of OInstance objects
getInstanceByName
public OInstance getInstanceByName(String aName)
- Description copied from interface:
Ontology
- Gets the instance with the given name.
- Specified by:
getInstanceByName
in interface Ontology
- Parameters:
aName
- the instance name
- Returns:
- the OInstance object with this name
createClass
public TClass createClass(String aName,
String aComment)
- Description copied from interface:
Taxonomy
- Creates a new OClass and returns it.
- Specified by:
createClass
in interface Taxonomy
- Overrides:
createClass
in class TaxonomyImpl
addDatatypeProperty
public DatatypeProperty addDatatypeProperty(String name,
OClass domain,
String value)
- Description copied from interface:
Ontology
- Create a DatatypeProperty with the given domain and range
- Specified by:
addDatatypeProperty
in interface Ontology
- Parameters:
domain
- value
-
addDatatypeProperty
public DatatypeProperty addDatatypeProperty(String name,
OClass domain,
Number value)
- Description copied from interface:
Ontology
- Create a DatatypeProperty with the given domain and range
- Specified by:
addDatatypeProperty
in interface Ontology
- Parameters:
domain
- value
-
addFunctionalProperty
public FunctionalProperty addFunctionalProperty(String name,
OClass domain,
Object range)
- Description copied from interface:
Ontology
- Create a FunctionalProperty with the given domain and range
- Specified by:
addFunctionalProperty
in interface Ontology
- Parameters:
domain
- range
-
- Returns:
- a
KBFunctionalProperty
value.
addObjectProperty
public ObjectProperty addObjectProperty(String name,
OClass domain,
OClass range)
- Specified by:
addObjectProperty
in interface Ontology
addSymmetricProperty
public SymmetricProperty addSymmetricProperty(String name,
OClass domain,
OClass range)
- Specified by:
addSymmetricProperty
in interface Ontology
addTransitiveProperty
public TransitiveProperty addTransitiveProperty(OClass domain,
OClass range)
- Specified by:
addTransitiveProperty
in interface Ontology
addPropertyDefinition
public void addPropertyDefinition(Property theProperty)
- Specified by:
addPropertyDefinition
in interface Ontology
getPropertyDefinitions
public Set getPropertyDefinitions()
- Specified by:
getPropertyDefinitions
in interface Ontology
getPropertyDefinitionByName
public Property getPropertyDefinitionByName(String name)
- Specified by:
getPropertyDefinitionByName
in interface Ontology