drepr.models.align#

Classes

AlignedStep(source_idx, target_idx)

AlignmentType(value[, names, module, ...])

AutoAlignment([attrs])

Cardinality(value[, names, module, ...])

IdenticalAlign(source, target)

RangeAlignment(source, target, aligned_steps)

ValueAlignment(source, target)

class AlignedStep(source_idx: 'int', target_idx: 'int')[source]#

Bases: object

Parameters:
  • source_idx (int) –

  • target_idx (int) –

source_idx: int#
target_idx: int#
class RangeAlignment(source: 'AttrId', target: 'AttrId', aligned_steps: 'list[AlignedStep]')[source]#

Bases: object

Parameters:
source: str#
target: str#
aligned_steps: list[drepr.models.align.AlignedStep]#
swap() RangeAlignment[source]#
Return type:

RangeAlignment

compute_cardinality(desc: DRepr) Cardinality[source]#

Compute the cardinality of an alignment

The cardinality between attribute x and attribute y are defined as follows:

  1. one-to-one: one item of x can only link to one item of y and vice versa.

  2. one-to-many: one item of x can link to multiple items of y, but one item of y can only link to one item of x.

  3. many-to-one: the reversed case of one-to-many

  4. many-to-many: multiple items of x can link to multiple items of y and vice versa.

The cardinality depends on the number of unfixed dimensions of each attribute, if an attribute has no unfixed steps, it will be one-to-, otherwise many-to-

Parameters:

desc (DRepr) –

Return type:

Cardinality

class ValueAlignment(source: 'AttrId', target: 'AttrId')[source]#

Bases: object

Parameters:
  • source (str) –

  • target (str) –

source: str#
target: str#
swap() ValueAlignment[source]#
Return type:

ValueAlignment

compute_cardinality(desc: DRepr) Cardinality[source]#

Compute the cardinality of an alignment

The cardinality between attribute x and attribute y are defined as follows:

  1. one-to-one: one item of x can only link to one item of y and vice versa.

  2. one-to-many: one item of x can link to multiple items of y, but one item of y can only link to one item of x.

  3. many-to-one: the reversed case of one-to-many

  4. many-to-many: multiple items of x can link to multiple items of y and vice versa.

The cardinality of the join will be one-to-* or *-to-one if values of source & target are unique.

Parameters:

desc (DRepr) –

Return type:

Cardinality

class IdenticalAlign(source: 'AttrId', target: 'AttrId')[source]#

Bases: object

Parameters:
  • source (str) –

  • target (str) –

source: str#
target: str#
compute_cardinality(desc: DRepr) Cardinality[source]#
Parameters:

desc (DRepr) –

Return type:

Cardinality

swap() IdenticalAlign[source]#
Return type:

IdenticalAlign

class AutoAlignment(attrs: 'Optional[list[str]]' = None)[source]#

Bases: object

Parameters:

attrs (Optional[list[str]]) –

attrs: Optional[list[str]] = None#
compute_cardinality(desc: DRepr) Cardinality[source]#
Parameters:

desc (DRepr) –

Return type:

Cardinality

class AlignmentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

Range = 'range'#
Value = 'value'#
Ident = 'identical'#
Auto = 'auto'#
class Cardinality(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: Enum

OneToOne = 'one-to-one'#
OneToMany = 'one-to-many'#
ManyToOne = 'many-to-one'#
ManyToMany = 'many-to-many'#
is_star_to_many() bool[source]#
Return type:

bool

is_one_to_star() bool[source]#
Return type:

bool

is_many_to_star() bool[source]#
Return type:

bool