|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.byu.deg.ontos.MappingHeuristic
edu.byu.deg.ontos.heuristic.NestedGroupHeuristic
A mapping heuristic that generates a relationship based on a relationship set connection that qualifies as a nested group in the traversal of the ontology structure.
Field Summary | |
protected ContextualHeuristic |
ch
|
Fields inherited from class edu.byu.deg.ontos.MappingHeuristic |
ACCEPTED_MATCH, connComparer, ontIndex, PROPOSED_MATCH, REJECTED_MATCH |
Constructor Summary | |
NestedGroupHeuristic()
Creates a new instance of NestedGroupHeuristic |
|
NestedGroupHeuristic(ExtractionOntologyIndex idx)
Creates a new instance of NestedGroupHeuristic and initializes it with an indexed ontology. |
Method Summary | |
protected int |
compareRelSets(edu.byu.deg.osmx.OSMXRelSetConnectionType r1,
edu.byu.deg.osmx.OSMXRelSetConnectionType r2,
MatchingContext ctxt)
Defines a total order on a set of relationship set connections by determining, for a pair of such connections, which should precede the other in a sorted list. |
protected MatchingContext |
findBestSubContext(edu.byu.deg.osmx.OSMXRelSetConnectionType conn,
MatchingContext ctxt)
Determines the likely outer boundaries of the nested group from the given context and returns the result as a matching context. |
protected edu.byu.deg.osmx.OSMXRelSetConnectionType |
findOuterMaxMany(List maxMany,
MatchingContext ctxt)
Determines which relationship set connection from a given list best corresponds to the outermost nesting level of the given matching context. |
protected Set |
inferManyMaxRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn,
MatchingContext ctxt,
Set visitedRelSets)
Generates a set of relationships for a nested group based on the assumption that the primary connection has a max-many participation constraint. |
protected Set |
inferNestedRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn,
List maxMany,
List maxOne,
MatchingContext ctxt,
Set visitedRelSets)
Generates a set of relationships for a nested group that contains multiple max-many relationship set connections (one being the primary connection). |
protected edu.byu.deg.osmx.OSMXRelationshipType |
inferOneMaxRelationship(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn,
MatchingContext ctxt,
Set visitedRelSets)
Generates a single relationship for a nested group based on the assumption that the primary connection has a max-one participation constraint. |
Set |
inferRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn,
MatchingContext ctxt,
Set visitedRelSets)
The main algorithm for this heuristic. |
void |
setOntologyIndex(ExtractionOntologyIndex idx)
Stores a reference to the indexed ontology. |
protected MatchingContext[] |
subdivideContext(MatchingContext ctxt)
Divides the given context into multiple matching contexts whose boundaries should approximate the contextual boundaries of the individual objects to be generated for the nested group. |
Methods inherited from class edu.byu.deg.ontos.MappingHeuristic |
addObject, addRelationship, bindObject, getOntologyIndex, getOntologyIndex |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected ContextualHeuristic ch
Constructor Detail |
public NestedGroupHeuristic()
public NestedGroupHeuristic(ExtractionOntologyIndex idx)
idx
- An index for the ontology used by the heuristic.Method Detail |
public Set inferRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn, MatchingContext ctxt, Set visitedRelSets)
ContextualHeuristic
recursively
until no more objects are produced. A relationship is created for each object
returned by ContextualHeuristic
, and the set of relationships is
returned.
primaryConn
- The relationship set connection from which the traversal is originating; in
other words, the "side" of the relationship set that the invoking code acted
upon to invoke this heuristic. This parameter identifies both the relationship
set for which the relationships should be generated, as well as in which
direction to continue the recursion.ctxt
- The matching context from which relationships should be generated.visitedRelSets
- A collection of relationship sets previously visited during the recursion;
allows us to avoid infinite recursion.
Set
of Relationship
elements.public void setOntologyIndex(ExtractionOntologyIndex idx)
setOntologyIndex
in class MappingHeuristic
idx
- The ontology index to use during the mapping process.protected edu.byu.deg.osmx.OSMXRelationshipType inferOneMaxRelationship(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn, MatchingContext ctxt, Set visitedRelSets)
primaryConn
- The connection that defines the relationship set as a max-one nested group.
Also indicates from which direction the ontology structure traversal is
proceeding.ctxt
- The matching context from which to generate the relationship.visitedRelSets
- Set of relationship sets that have previously been visited. Useful for avoiding
infinite recursion.
null
if a relationship could not be
generated because objects could not be generated for each of the relationship
set connections.protected Set inferManyMaxRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn, MatchingContext ctxt, Set visitedRelSets)
inferNestedRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType, java.util.List, java.util.List, edu.byu.deg.ontos.MatchingContext, java.util.Set)
method will be invoked, which is more complex in its
relationship generation rules.
primaryConn
- The relationship set connection that defines the relationship set as a max-many
nested group. It also indicates from which direction the traversal of the
ontology structure is proceeding.ctxt
- The matching context from which relationships are generated.visitedRelSets
- Set of relationship sets that have previously been visited. Useful for avoiding
infinite recursion.
Relationship
elements that were successfully generated
from the given context. The set will be non-null
but empty if no
relationships were generated.protected Set inferNestedRelationships(edu.byu.deg.osmx.OSMXRelSetConnectionType primaryConn, List maxMany, List maxOne, MatchingContext ctxt, Set visitedRelSets) throws javax.xml.bind.JAXBException
|--------------- A1 ---------------||--------------- A2 ------------------| |--- B1 ---||--- B2 ---||--- B3 ---||-------- B4 ------||------ B5 -------| |--- C1 ---|| C2 || C3 || C4 || C5 ||-- C6 --||-- C7 --||------ C8 -------|In this diagram, A is the primary object set, B is an object set at the end of a max-many connection in the nested group, and C is an object set for the remaining connection in the relationship set. Pipes (|) mark context boundaries within which objects (A1, C5, etc.) appear. The overall diagram represents a matching context, and this method's algorithm induces a nesting structure such as the one above upon the input context in order to determine which objects to generate and how to satisfy constraints. The following relationships are generated from the above example:
primaryConn
- The relationship set connection that defines the relationship set as a max-many
nested group. It also indicates from which direction the traversal of the
ontology structure is proceeding.maxMany
- A list of the RelSetConnection
elements for the nested group which
have max-many participation constraints.maxOne
- A list of the RelSetConnection
elements for the nested group which
have max-one participation constraints.ctxt
- The input context from which relationships are to be inferred.visitedRelSets
- Set of relationship sets that have previously been visited. Useful for avoiding
infinite recursion.
Relationship
elements generated by this method.
javax.xml.bind.JAXBException
- Thrown if a relationship cannot be generated for some reason.protected edu.byu.deg.osmx.OSMXRelSetConnectionType findOuterMaxMany(List maxMany, MatchingContext ctxt)
maxMany
- A list of max-many relationship set connections from which the connection for
the outermost nesting level should be selected. The list need not contain all
max-many connections for the nested group relationship set; rather, it should
only contain those max-many connections for which objects still need to be generated from
the input matching context.ctxt
- The context over which to induce the nesting structure in order to determine the
outermost nesting connection.
protected int compareRelSets(edu.byu.deg.osmx.OSMXRelSetConnectionType r1, edu.byu.deg.osmx.OSMXRelSetConnectionType r2, MatchingContext ctxt)
r1
- The first relationship set connection to compare.r2
- The second relationship set connection to compare.ctxt
- The current matching context, which provides information useful in assessing
which connection should precede the other.
r1 == r2
.
This method bases the order only on a dictionary ordering of the IDs of the
relationship sets being compared.protected MatchingContext[] subdivideContext(MatchingContext ctxt)
ctxt
- The context to subdivide.
ContextualHeuristic
.
Currently this method is not implemented and will throw
UnsupportedOperationException
if called.protected MatchingContext findBestSubContext(edu.byu.deg.osmx.OSMXRelSetConnectionType conn, MatchingContext ctxt)
conn
- The connection that identifies the nested group.ctxt
- The context from which to derive the nested group context.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |