Problemcore
Schema matching
Also called schema alignment, attribute correspondence discovery.
Find the correspondences between the elements of two schemas that denote the same thing, as the first step of a mapping.
Schema matching is the problem of finding which elements of two schemas mean the same thing, for example that the column Name of one table holds the same data as the column FullName of another. The output is a set of correspondences, often with a confidence score. It has no exact formal goal: the right answer is the one a domain expert would accept, so all general methods are heuristics, judged by measurement. The correspondences are the input to the next step, where a person or a tool turns them into a schema mapping with joins and new values.
In plain words
Two companies merge, and each has a customer table. One calls a column "FullName", the other calls it "Name". One stores the date of birth as text, the other as a date. Before the data can be combined, someone must say which column of the first table goes with which column of the second.
A program can help by looking for clues. Similar names are one clue. Similar data types are another. Similar values in the columns, such as both holding mostly email addresses, are a strong clue. Tables that sit in the same place in both designs are a clue too. Each clue alone is often wrong, so good tools combine many of them and show the best guesses to a person, who makes the final choice.
Definition
Input. Two schemas and with sets of elements and : relations, attributes, and for nested schemas, the inner elements. Each element has a name and a type, and it sits in a structure, such as an attribute in a relation or a key in a foreign key. Optional inputs are instances of the schemas, dictionaries of synonyms and earlier matches.
Output. A match: a set of correspondences with , and a confidence . In the more general form a correspondence relates a set of elements to a set, as in "Name corresponds to First together with Last".
Goal. The correspondences that are semantically right, that is, that a domain expert would accept. This goal is not a function of the input, so the problem has no exact algorithm. A method is judged by measurement: its output is compared with a match made by hand, by precision (the share of the found correspondences that are right) and recall (the share of the right ones that are found).
Inside a method, the usual pipeline is formal. Each matcher computes a similarity matrix . A combination step merges the matrices, and a selection step picks the correspondences from the merged matrix. The selection step alone is often an exact optimization problem; see Reductions.
Variants
Rahm and Bernstein classify matchers along these lines.
- Schema level or instance level. A schema-level matcher uses only names, types, constraints and structure. An instance-level matcher uses the data, for example the overlap of the value sets.
- Element or structure. An element matcher compares two elements alone. A structure matcher compares the neighborhoods, as similarity flooding does.
- Linguistic or constraint based. A linguistic matcher compares names and text, with string similarity and dictionaries. A constraint matcher compares types, keys and value ranges.
- Cardinality. 1:1 correspondences, or 1:n and n:m, where one element matches a combination of several.
- Single or combined. A hybrid matcher uses several clues inside one algorithm. A composite matcher runs separate matchers and combines their results.
Other variants are matching many schemas at once, matching ontologies instead of database schemas, and the reuse of earlier matches.
Examples
Schema 1 has Emp(Name: string, Dept: int), and schema 2 has Staff(FullName: varchar, Unit: integer). Take two matchers on the attributes.
- Name matcher. The similarity is , where is the edit distance of the lower-case names and is the length of the longer name.
- Type matcher. 1 if the two types are compatible (string with varchar, int with integer), else 0.
| pair | edit distance | name | type | average |
|---|---|---|---|---|
| Name, FullName | 4 | 0.5 | 1 | 0.75 |
| Name, Unit | 4 | 0 | 0 | 0 |
| Dept, FullName | 8 | 0 | 0 | 0 |
| Dept, Unit | 3 | 0.25 | 1 | 0.625 |
The name matcher alone gives Dept and Unit only 0.25, which a threshold of 0.5 would drop. The average of the two matchers keeps both right pairs. A 1:1 selection with the largest total similarity picks (Name, FullName) and (Dept, Unit), with total 1.375, against 0 for the other assignment. On the same schemas as graphs, similarity flooding finds the same pairs from seeds on the types and from the table structure, with no help from the names.
A harder case shows why matching is heuristic. If schema 2 also had a column ManagerName: varchar, the name and type matchers would rate (Name, ManagerName) almost as high as (Name, FullName). Only instance data or a person can tell them apart.
Known algorithms
All of these are heuristics.
- Name and text matchers. Edit distance, Jaro-Winkler distance, q-grams, token sets with Jaccard similarity, tf-idf with cosine similarity, and synonym dictionaries.
- Instance matchers. The overlap of value sets, statistics of the values such as length and character classes, and classifiers trained on earlier matches.
- Structure matchers. Similarity flooding, and methods that raise the similarity of two elements when their parents or children are similar.
- Combination. The weighted average, the maximum or the minimum of the matcher scores, with weights set by hand or learned.
- Selection. A threshold, the top partners of each element, a stable matching, or a maximum-weight 1:1 match by the Hungarian algorithm.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Similarity flooding | O(s(v + e) + v log v) worst | O(v + e) extra | deterministicnot exactnot in placeofflineiterative | 1 language |
Bounds
The full problem has no complexity bound, because its goal is not formal. Bounds exist for the formal steps.
- Matchers. A matcher that compares all pairs makes comparisons. With edit distance on names of length at most , this is time.
- 1:1 selection. A maximum-weight 1:1 match on an matrix takes time with the Hungarian algorithm (theorem). A stable matching takes time with Gale-Shapley (theorem).
- Exact structure matching. If a match must keep the structure exactly, so that the graph of one schema maps edge for edge into the graph of the other, the problem contains subgraph isomorphism and is NP-complete. This is one reason why structure matchers use similarity scores instead of exact embeddings.
Reductions
- Selection to assignment. Choosing a 1:1 match with the largest total similarity is the assignment problem, a maximum-weight bipartite matching.
- From subgraph isomorphism. A graph is a subgraph of a graph if and only if the schema graph of matches into that of under the exact structure rule. So that version is NP-hard.
- Relation to entity resolution. Entity resolution matches records, schema matching matches the elements that describe them. Both use the same similarity functions and the same pipeline of comparison, combination and selection, and an instance matcher often runs entity resolution on samples of the data.
Applications
- Mapping design. Correspondences are the first step of a schema mapping, for data exchange or for GAV and LAV integration.
- Data warehouses. Loading data from many operational systems into one warehouse needs the correspondences of each source with the warehouse schema.
- Schema evolution and merging. Matching an old and a new version of a schema, or two schemas that must become one.
- Ontology alignment. Matching the concepts of two ontologies uses the same kinds of matchers.
References
- Erhard Rahm and Philip A. Bernstein, A survey of approaches to automatic schema matching, VLDB Journal 10(4), 2001, pages 334-350, the classification of matchers and their combination
- AnHai Doan, Alon Halevy and Zachary Ives, Principles of Data Integration, Morgan Kaufmann, 2012, Chapter 5, Schema Matching and Mapping
- Sergey Melnik, Hector Garcia-Molina and Erhard Rahm, Similarity flooding: a versatile graph matching algorithm and its application to schema matching, ICDE 2002, pages 117-128
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag V1W0JZ Edit this page History Report an error Markdown