|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--notio.Node | +--notio.Relation
The conceptual relation node class. This class encapsulates all available information about a conceptual relation within a graph. It consists of a type and/or arguments (concepts connected to the arcs of the relation). The arguments can be divided into input and output arguments as desired, though the default is that the last (and possibly only) argument is the sole output arc. Relations with no arguments (zero valence) are allowed. Note that the terms 'arc' and 'argument' are used interchangably throughout the documentation.
Conceptually, the N arguments of a relation are all stored in one array, with zero being the index of the first argument. The first k elements of this array are considered to be inputs and the remaining N - k are outputs. This allows them to be both ordered and directed at the same time. The boundary between inputs and outputs is defined using the "output start index". This is the index into the array of arguments at which the first output argument occurs. If there are no outputs, the output start index is 1 greater than the number of inputs. Using setArguments() sets the entire array. Using setInputArguments() and setOutputArguments() sets the same array plus the index that defines where the outputs begin. That index can be set and found explicitly by calling setOutputStartIndex() and getOutputStartIndex(). In the end, it's all just one array and an index that shows where the outputs start. The default output start index for relations is N - 1, as specified by the standard.
Constructor Summary | |
Relation()
Constructs a new relation that has no type and no arguments. |
|
Relation(Concept[] newArguments)
Constructs a relation with no type and the specified arguments. |
|
Relation(Concept[] newArguments,
int newOutputStartIndex)
Constructs a relation with no type and the specified arguments with output arguments starting at the specified index. |
|
Relation(RelationType newType)
Constructs a relation with the given type. |
|
Relation(RelationType newType,
Concept[] newArguments)
Constructs a relation with the given type and arguments. |
|
Relation(RelationType newType,
Concept[] newInputArguments,
Concept[] newOutputArguments)
Constructs a relation with the given type and the specified input and output arguments. |
|
Relation(RelationType newType,
Concept[] newArguments,
int newOutputStartIndex)
Constructs a relation with the given type and arguments and output argument start index. |
Method Summary | |
Relation |
copy(CopyingScheme copyScheme)
Performs a copy operation on this relation according to the the specified CopyingScheme. |
Relation |
copy(CopyingScheme copyScheme,
java.util.Hashtable substitutionTable)
Performs a copy operation on this relation according to the the specified CopyingScheme. |
Concept[] |
getArguments()
Returns all of the concepts related by this relation. |
Concept[] |
getInputArguments()
Returns the input arguments for this relation. |
Concept[] |
getOutputArguments()
Returns the output arguments for this relation. |
int |
getOutputStartIndex()
Returns the index of the first output argument within the array returned by getArguments(). |
RelationType |
getType()
Returns this relation's type. |
int |
getValence()
This method returns the valence (number of arguments) that this relation has defined. |
boolean |
isComplete()
Returns true if this relation's arguments are completely specified (are all non-null). |
static boolean |
matchRelations(Relation first,
Relation second,
MatchingScheme matchingScheme)
Compares two relations to decide if they match. |
boolean |
relatesConcept(Concept concept)
Returns true if the specified concept is an argument of this relation. |
void |
replaceArgument(Concept oldConcept,
Concept newConcept)
Replaces all occurrences of the specified argument with a new one regardless of whether it is an input or output argument. |
void |
replaceInputArgument(Concept oldConcept,
Concept newConcept)
Replaces all occurrences of the specified input argument with a new one. |
void |
replaceOutputArgument(Concept oldConcept,
Concept newConcept)
Replaces all occurrences of the specified output argument with a new one. |
Relation |
restrictTo(RelationType subType)
Returns a new node identical to this but restricted to the new type. |
void |
setArgument(int index,
Concept newConcept)
Sets the specified argument to the specified concept. |
void |
setArguments(Concept[] newConcepts)
Sets the arguments according to the specified array of concepts. |
void |
setInputArgument(int index,
Concept newConcept)
Sets the specified argument to the specified concept. |
void |
setOutputArgument(int index,
Concept newConcept)
Sets the specified argument to the specified concept. |
void |
setOutputStartIndex(int newOutputStartIndex)
Sets the index of the first output argument within the array returned by getArguments(). |
void |
setType(RelationType newType)
Sets the type for this relation. |
Methods inherited from class notio.Node |
getComment,
getEnclosingGraph,
setComment |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Relation(RelationType newType, Concept[] newArguments)
newType
- the type for this relation.newArguments
- the concepts related by this relation.public Relation(RelationType newType, Concept[] newArguments, int newOutputStartIndex)
newType
- the type for this relation.newArguments
- the concepts related by this relation.newOutputStartIndex
- the index into the newArguments array at which the
output arcs start.public Relation(RelationType newType, Concept[] newInputArguments, Concept[] newOutputArguments)
newType
- the type for this relation.newInputArguments
- the input concepts related by this relation.newOutputArguments
- the output concepts related by this relation.public Relation(RelationType newType)
newType
- the type for this relation.public Relation(Concept[] newArguments, int newOutputStartIndex)
newArguments
- the concepts related by this relation.newOutputStartIndex
- the index into the newArguments array at which the
output arcs start.public Relation(Concept[] newArguments)
newArguments
- the concepts related by this relation.public Relation()
Method Detail |
public RelationType getType()
public Concept[] getArguments()
public Concept[] getInputArguments()
public Concept[] getOutputArguments()
public boolean relatesConcept(Concept concept)
concept
- the concept being checked for.public void setType(RelationType newType)
newType
- the new type for this relation.isComplete()
public void replaceArgument(Concept oldConcept, Concept newConcept)
oldConcept
- the concept being replaced.newConcept
- the replacement concept.public void replaceInputArgument(Concept oldConcept, Concept newConcept)
oldConcept
- the input argument being replaced.newConcept
- the replacement argument.public void replaceOutputArgument(Concept oldConcept, Concept newConcept)
oldConcept
- the output argument being replaced.newConcept
- the replacement argument.public void setArgument(int index, Concept newConcept)
index
- the index of the argument being set.newConcept
- the concept to be used as an argument.public void setArguments(Concept[] newConcepts)
newConcepts
- the array of concepts to be used as arguments.setArgument(int, notio.Concept)
public void setInputArgument(int index, Concept newConcept)
index
- the index of the input argument being set (the nth input argument).newConcept
- the concept to be used as an argument.public void setOutputArgument(int index, Concept newConcept)
index
- the index of the output argument being set (the nth output argument).newConcept
- the concept to be used as an argument.public int getOutputStartIndex()
getArguments()
public void setOutputStartIndex(int newOutputStartIndex)
newOutputStartIndex
- the index of the first output argument within the array
returned by getArguments().getArguments()
public int getValence()
public boolean isComplete()
public Relation copy(CopyingScheme copyScheme)
copyScheme
- the copying scheme used to control the copy operation.public Relation copy(CopyingScheme copyScheme, java.util.Hashtable substitutionTable)
copyScheme
- the copying scheme used to control the copy operation.substitutionTable
- a hashtable containing copied objects available due to
earlier copy operations.public Relation restrictTo(RelationType subType) throws RestrictionException
subType
- the type to be restricted to.public static boolean matchRelations(Relation first, Relation second, MatchingScheme matchingScheme)
first
- the first relation being matched.second
- the second relation being matched.matchingScheme
- the matching scheme that determines how the match is performed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |