abstract class BaseType extends Object implements Type
BaseType.Role
,
which is the
Copyright: Copyright 2003-2014, Knowledge Science Group, University of Calgary. Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. The Knowledge Science Group makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Company: Knowledge Science Group
Modifier and Type | Class and Description |
---|---|
protected class |
BaseType.Role
Responsible to store a
Relation (BaseType.Role.rel ) together with:
BaseType.Role.inDomain : a list of other types in which this type is in relation in the domain position
BaseType.Role.inRange : a list of other types in which this type is in relation in the range position
|
Modifier and Type | Field and Description |
---|---|
protected int |
mark
Used by TypeHierarchy to help in visiting the nodes
|
private Name |
name
Name of the type.
|
(package private) TreeMap<String,BaseType.Role> |
roles |
Constructor and Description |
---|
BaseType() |
BaseType(String name,
Ontology ont) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(OntologyEntity x)
Used by TreeMap as a sorting comparitor.
|
int |
compareTo(String x)
Used by TreeMap as a sorting comparitor.
|
boolean |
equals(Type x)
Determines if this Node is equal to x, where "equal" means that
the names are the same, and the name of each of the parents is
the same.
|
String |
getName() |
Ontology |
getOntology() |
String |
getRelativeName(Ontology ont) |
protected Set<String> |
getRoles()
Returns the set of roles (relation names) that this Type is in the domain for.
|
String |
getUnqualifiedName() |
private void |
insertRelationFrom(Relation relation,
BaseType x)
Primitive method to add a link to the Type oo the range end of relation.
|
protected boolean |
insertRelationTo(Relation relation,
BaseType roleFiller)
Primitive method to add a relation to link this Type through relation to another
Type.
|
protected void |
insertRelationTo(Relation relation,
Vector<BaseType> roleFiller) |
protected Set<Type> |
relatedFrom(Relation relation) |
protected boolean |
relatedFrom(Relation relation,
BaseType domain) |
protected Set<Type> |
relatedFrom(String relation) |
protected Set<Type> |
relatedTo(Relation relation) |
protected boolean |
relatedTo(Relation relation,
BaseType range) |
protected Set<Type> |
relatedTo(String relation) |
protected boolean |
removeRelationTo(Relation relation,
BaseType roleFiller)
Primitive method to remove a relation link from this Type through relation to
rolefiller.
|
void |
resetMark()
Traverses the hierarchy setting each node's mark element to the
number of parents of the node.
|
String |
toString() |
protected String |
toStringNonIsa() |
protected String |
toStringParent() |
protected String |
toStringWithIsaChildren()
Recursive method to print to a String a node and all it's children in the persistent
format in the an order such that no node definition comes before the
definition of all it's ancestors.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isIndividual
TreeMap<String,BaseType.Role> roles
protected int mark
private Name name
BaseType(String name, Ontology ont) throws IllegalOperationException
IllegalOperationException
BaseType()
protected boolean insertRelationTo(Relation relation, BaseType roleFiller)
insertRelationFrom(Relation, BaseType)
.relation
- the relation to add or extend (depending if it exists or not)x
- the child to addpublic String getName()
getName
in interface OntologyEntity
public Ontology getOntology()
getOntology
in interface OntologyEntity
public String getUnqualifiedName()
protected void insertRelationTo(Relation relation, Vector<BaseType> roleFiller)
relation
- roleFiller
- IllegalOperationException
private void insertRelationFrom(Relation relation, BaseType x)
insertRelationFrom(Relation, BaseType)
or
insertRelationTo(Relation, Vector)
relation
- the relation to add or extend (dependint if it exists or not)x
- the child to addprotected boolean removeRelationTo(Relation relation, BaseType roleFiller)
insertRelationFrom(Relation, BaseType)
.
The the role (relation) is now empty, delete it to clean up.relation
- the relation to add or extend (depending if it exists or not)x
- the child to addpublic void resetMark()
protected Set<Type> relatedTo(String relation)
protected Set<Type> relatedFrom(String relation)
protected Set<Type> relatedTo(Relation relation)
protected boolean relatedTo(Relation relation, BaseType range)
protected Set<Type> relatedFrom(Relation relation)
protected boolean relatedFrom(Relation relation, BaseType domain)
protected Set<String> getRoles()
public String toString()
toString
in interface OntologyEntity
toString
in class Object
protected String toStringParent()
protected String toStringNonIsa()
protected String toStringWithIsaChildren()
resetMark()
must precede the call to this method in order for it to function correctly.x
- the node to print to the Stringpublic int compareTo(String x)
x
- A String to be compared to name.public int compareTo(OntologyEntity x)
compareTo
in interface Comparable<OntologyEntity>
x
- Another Node object to be compared withpublic boolean equals(Type x)
x
- A Node to be compared with