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, right, alignment, **kwargs)[source]
Combine two graphs using the alignment information.
- Parameters:
left (
TriplesFactory
) – the triples of the left graphright (
TriplesFactory
) – the triples of the right graphalignment (
DataFrame
) – columns: LEFT | RIGHT the alignment, i.e., pairs of matching entitieskwargs – additional keyword-based parameters passed to
TriplesFactory.__init__()
- Return type:
Tuple
[TriplesFactory
,LongTensor
]- 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.
- abstract process(mapped_triples, alignment, offsets)[source]
Process the combined mapped triples.
- Parameters:
mapped_triples (
LongTensor
) – shape: (n, 3) the id-based merged triplesalignment (
LongTensor
) – shape: (2, m) the id-based entity alignmentoffsets (
LongTensor
) – shape: (2, 2) the entity and relation offsets from merging
- Return type:
- Returns:
updated triples and alignment tensor, as well as parameters for updating label-to-id mappings