notio
Class RelationType

java.lang.Object
  |
  +--notio.Type
        |
        +--notio.RelationType
All Implemented Interfaces:
java.io.Serializable

public class RelationType
extends notio.Type
implements java.io.Serializable

The relation type class. This class encapsulates all available information about a relation type. The type can be defined by a label and/or a type definition or valence. Relation types provide the type information for both the relations and actors.

See Also:
Serialized Form

Constructor Summary
RelationType()
          Constructs a RelationType with no label or type definition.
RelationType(RelationTypeDefinition newDefinition)
          Constructs an unlabelled RelationType with the specified type definition.
RelationType(java.lang.String newLabel)
          Constructs a labelled RelationType with the specified type label and no type definition.
RelationType(java.lang.String newLabel, int newValence)
          Constructs a labelled RelationType with the specified type label and valence.
RelationType(java.lang.String newLabel, RelationTypeDefinition newDefinition)
          Constructs a labelled RelationType with the specified type label and type definition.
 
Method Summary
 java.lang.String getComment()
          Returns the comment string for this type.
 RelationType[] getImmediateSubTypes()
          Returns the immediate subtypes of this type.
 RelationType[] getImmediateSuperTypes()
          Returns the immediate supertypes of this type.
 java.lang.String getLabel()
          Returns the type label for this type.
 RelationType[] getProperSubTypes()
          Returns all subtypes of this type.
 RelationType[] getSuperProperTypes()
          Returns all supertypes of this type.
 RelationTypeDefinition getTypeDefinition()
          Returns the relation type definition for this type (if any).
 int getValence()
          Returns the valence for this type, or -1 if the valence is undefined.
 boolean hasProperSubType(RelationType queryType)
          Tests whether the specified type is a proper subtype of this type.
 boolean hasProperSuperType(RelationType queryType)
          Tests whether the specified type is a proper supertype of this type.
 boolean hasSubType(RelationType queryType)
          Tests whether the specified type is a subtype of this type.
 boolean hasSuperType(RelationType queryType)
          Tests whether the specified type is a supertype of this type.
static boolean matchRelationTypes(RelationType first, RelationType second, MatchingScheme matchingScheme)
          Compares two relation types to decide if they match.
 void setComment(java.lang.String newComment)
          Sets the comment string for this type.
 void setLabel(java.lang.String newLabel)
          Sets the type label for this type.
 void setTypeDefinition(RelationTypeDefinition newDefinition)
          Sets the type definition for this type.
 void setValence(int newValence)
          Sets the valence for this type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RelationType

public RelationType(java.lang.String newLabel,
                    RelationTypeDefinition newDefinition)
Constructs a labelled RelationType with the specified type label and type definition. The valence of the type is automatically determined from the type definition. Note that this method does not add the type to any hierarchy.
Parameters:
newLabel - the type label for this type.
newDefinition - the type definition for this type.

RelationType

public RelationType(java.lang.String newLabel,
                    int newValence)
Constructs a labelled RelationType with the specified type label and valence. Note that this method does not add the type to any hierarchy.
Parameters:
newLabel - the type label for this type.
newValence - the valence for this type.

RelationType

public RelationType(java.lang.String newLabel)
Constructs a labelled RelationType with the specified type label and no type definition. The valence of the relation is automatically set to be unspecified. Note that this method does not add the type to any hierarchy.
Parameters:
newLabel - the type label for this type.

RelationType

public RelationType(RelationTypeDefinition newDefinition)
Constructs an unlabelled RelationType with the specified type definition. The valence of the type is automatically determined from the type definition. Note that this method does not add the type to any hierarchy.
Parameters:
newDefinition - the type definition for this type.

RelationType

public RelationType()
Constructs a RelationType with no label or type definition. The valence of the relation is automatically set to be unspecified. Note that this method does not add the type to any hierarchy.
Method Detail

setLabel

public void setLabel(java.lang.String newLabel)
              throws TypeChangeError
Sets the type label for this type. If the type already had a label, it is replaced. If a null is used, the label is removed from the type.
Parameters:
newLabel - the string that is the label for this type.
Throws:
TypeChangeError - if the type belongs to a hierarchy and the new label is already in use within it.

getLabel

public java.lang.String getLabel()
Returns the type label for this type.
Overrides:
getLabel in class notio.Type
Returns:
the string that is the label for this type.

setTypeDefinition

public void setTypeDefinition(RelationTypeDefinition newDefinition)
Sets the type definition for this type. If the type already has a definition, it is replaced. If null is used, the type definition will be removed. Specifying a type definition will override any existing valence information with the valence of the type definition.
Parameters:
newDefinition - the new type definition for this type.

getTypeDefinition

public RelationTypeDefinition getTypeDefinition()
Returns the relation type definition for this type (if any).
Returns:
the type definition for this type or null if there isn't one.

setValence

public void setValence(int newValence)
Sets the valence for this type. A value of -1 indicates that the valence is undefined. The valence is the number of arcs (or arguments) that this relation type possesses. Changing the valence has no effect on existing relations using this type except that they many return a different value when their isComplete() method is called. It is up to the application to ensure that all such relations are corrected by the additional or removal of arguments. In most cases, it is expected that this method will be used to change a valence from unspecified to a specific value, rather than from one specific value to another.
Parameters:
newValence - the new valence for this type.
Throws:
TypeChangeError - if a type definition has been specified for this type.
See Also:
Relation.isComplete()

getValence

public int getValence()
Returns the valence for this type, or -1 if the valence is undefined.
Returns:
the valence for this type, or -1 if the valence is undefined.

getProperSubTypes

public RelationType[] getProperSubTypes()
Returns all subtypes of this type.
Returns:
an array of subtypes of this type.

getSuperProperTypes

public RelationType[] getSuperProperTypes()
Returns all supertypes of this type.
Returns:
an array of supertypes of this type.

getImmediateSubTypes

public RelationType[] getImmediateSubTypes()
Returns the immediate subtypes of this type.
Returns:
an array of immediate subtypes of this type.

getImmediateSuperTypes

public RelationType[] getImmediateSuperTypes()
Returns the immediate supertypes of this type.
Returns:
an array of immediate supertypes of this type.

hasSubType

public boolean hasSubType(RelationType queryType)
Tests whether the specified type is a subtype of this type.
Parameters:
queryType - the type being tested.
Returns:
true if queryType is a subtype of this type, false otherwise.

hasSuperType

public boolean hasSuperType(RelationType queryType)
Tests whether the specified type is a supertype of this type.
Parameters:
queryType - the type being tested.
Returns:
true if queryType is a supertype of this type, false otherwise.

hasProperSubType

public boolean hasProperSubType(RelationType queryType)
Tests whether the specified type is a proper subtype of this type.
Parameters:
queryType - the type being tested.
Returns:
true if queryType is a proper subtype of this type, false otherwise.

hasProperSuperType

public boolean hasProperSuperType(RelationType queryType)
Tests whether the specified type is a proper supertype of this type.
Parameters:
queryType - the type being tested.
Returns:
true if queryType is a proper supertype of this type, false otherwise.

matchRelationTypes

public static boolean matchRelationTypes(RelationType first,
                                         RelationType second,
                                         MatchingScheme matchingScheme)
Compares two relation types to decide if they match. The exact semantics of matching are determined by the match control flag.
Parameters:
first - the first relation type being matched.
second - the second relation type being matched.
matchingScheme - the matching scheme that determines how the match is performed.
Returns:
true if the two relation types match according to the scheme's criteria.

setComment

public void setComment(java.lang.String newComment)
Sets the comment string for this type.
Parameters:
newComment - the new comment string for this type.

getComment

public java.lang.String getComment()
Returns the comment string for this type.
Returns:
the comment string associated with this type or null.


Copyright 1998-2001 Finnegan Southey