jInfer

cz.cuni.mff.ksi.jinfer.iss.utils
Class MappingUtils

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.iss.utils.MappingUtils

public final class MappingUtils
extends Object

Library class containing utility functions for attribute mapping. Please see the article "Finding ID Attributes in XML Documents" for reference.


Method Summary
static List<AttributeMappingId> getCandidates(AMModel model)
          Returns the list of candidate attribute mappings from the specified model.
static boolean imagesIntersect(AttributeMappingId am1, AttributeMappingId am2, AMModel model)
          Checks whether the images of the two specified attribute mappings in the specified model intersect.
static boolean isCandidateMapping(AttributeMappingId targetMapping, AMModel model)
          Verifies whether the specified attribute mapping is a candidate mapping.
static boolean isIDset(List<AttributeMappingId> mappings, AMModel model)
          Determines whether a list of attribute mappings constitutes an ID set.
static boolean mappingsCollide(AttributeMappingId mapping1, AttributeMappingId mapping2, AMModel model)
          Checks whether two mappings collide, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isCandidateMapping

public static boolean isCandidateMapping(AttributeMappingId targetMapping,
                                         AMModel model)
Verifies whether the specified attribute mapping is a candidate mapping.

An attribute mapping is a candidate mapping, iff it is an injective function: if its every value is unique.

Parameters:
targetMapping - Mapping to be verified.
allMappings - All the attribute mappings of the grammar.
Returns:
True if the specified mapping is a candidate, false otherwise.

isIDset

public static boolean isIDset(List<AttributeMappingId> mappings,
                              AMModel model)
Determines whether a list of attribute mappings constitutes an ID set. Three conditions must hold for a set of mappings to be an ID set:
  1. All the attribute mappings must be candidate mappings (see isCandidateMapping(cz.cuni.mff.ksi.jinfer.iss.objects.AttributeMappingId, cz.cuni.mff.ksi.jinfer.iss.objects.AMModel)).
  2. The types of all the mappings (= their respective element names) must be distinct.
  3. The domains of all the mappings (= sets of their values) must be distincs (no overlaps).

Parameters:
mappings - List of the attribute mappings to verify.
allMappings - All the attribute mappings of the grammar.
Returns:
True if the specified list consitutes an ID set (an empty set is ID set too), false otherwise.

imagesIntersect

public static boolean imagesIntersect(AttributeMappingId am1,
                                      AttributeMappingId am2,
                                      AMModel model)
Checks whether the images of the two specified attribute mappings in the specified model intersect.

Parameters:
am1 - ID of the first mapping to check.
am2 - ID of the second mapping to check.
model - Attribute mapping model to check intersection in.
Returns:
true if the two attribute mapping images intersect (have at least one common value), false otherwise.

mappingsCollide

public static boolean mappingsCollide(AttributeMappingId mapping1,
                                      AttributeMappingId mapping2,
                                      AMModel model)
Checks whether two mappings collide, i.e. cannot be in the same ID set together. This can happen either if they share the type (that is the element name), or their images intersect (see imagesIntersect(AttributeMappingId, AttributeMappingId, AMModel)).

Parameters:
mapping1 - ID of the first mapping to check.
mapping2 - ID of the second mapping to check.
model - Attribute mapping model to check the collision in.
Returns:
true if the two attribute mapping collide (have the same type or their images collide), false otherwise.

getCandidates

public static List<AttributeMappingId> getCandidates(AMModel model)
Returns the list of candidate attribute mappings from the specified model. To understand what a candidate mapping is, see isCandidateMapping(AttributeMappingId, AMModel).

Parameters:
Model - to find the list of candidate AMs in.
Returns:
List of candidate mappings in the specified model.

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011