GraphPairCombinator

class GraphPairCombinator[source]

Bases: ABC

A base class for combination of a graph pair into a single graph.

Methods Summary

__call__(left, right, alignment, **kwargs)

Combine two graphs using the alignment information.

process(mapped_triples, alignment, offsets)

Process the combined mapped triples.

Methods Documentation

__call__(left: TriplesFactory, right: TriplesFactory, alignment: DataFrame, **kwargs) tuple[TriplesFactory, Tensor][source]

Combine two graphs using the alignment information.

Parameters:
  • left (TriplesFactory) – the triples of the left graph

  • right (TriplesFactory) – the triples of the right graph

  • alignment (DataFrame) – columns: LEFT | RIGHT the alignment, i.e., pairs of matching entities

  • kwargs – additional keyword-based parameters passed to TriplesFactory.__init__()

Returns:

a single triples factory comprising the joint graph, as well as a tensor of pairs of matching IDs. The tensor of matching pairs has shape (2, num_alignments), where num_alignments can also be 0.

Return type:

tuple[TriplesFactory, Tensor]

abstract process(mapped_triples: Tensor, alignment: Tensor, offsets: Tensor) ProcessedTuple[source]

Process the combined mapped triples.

Parameters:
  • mapped_triples (Tensor) – shape: (n, 3) the id-based merged triples

  • alignment (Tensor) – shape: (2, m) the id-based entity alignment

  • offsets (Tensor) – shape: (2, 2) the entity and relation offsets from merging

Returns:

updated triples and alignment tensor, as well as parameters for updating label-to-id mappings

Return type:

ProcessedTuple