Edge

class mowl.projection.Edge(src, rel, dst, weight=1.0)[source]

Bases: object

Class representing a graph edge.

Attributes Summary

dst

Getter method for _dst attribute

rel

Getter method for _rel attribute

src

Getter method for _src attribute

weight

Getter method for _weight attribute

Methods Summary

as_pykeen(edges[, create_inverse_triples, ...])

This method transform a set of edges into an object of the type pykeen.triples.triples_factory.TriplesFactory.

astuple()

getEntitiesAndRelations(edges)

Deprecated since version 0.1.0.

get_entities_and_relations(edges)

param edges:

list of edges

zip(edges)

Attributes Documentation

dst

Getter method for _dst attribute

Return type:

str

rel

Getter method for _rel attribute

Return type:

str

src

Getter method for _src attribute

Return type:

str

weight

Getter method for _weight attribute

Return type:

str

Methods Documentation

static as_pykeen(edges, create_inverse_triples=True, entity_to_id=None, relation_to_id=None)[source]

This method transform a set of edges into an object of the type pykeen.triples.triples_factory.TriplesFactory. This method is intended to be used for PyKEEN methods.

Parameters:
  • edges (list of Edge) – List of edges.

  • create_inverse_triple (bool, optional) – Whether to create inverse triples. Defaults to True

Return type:

pykeen.triples.triples_factory.TriplesFactory

New in version 0.1.0: This method is available to transform graph edges obtained from ontologies into PyKEEN triples.

astuple()[source]
static getEntitiesAndRelations(edges)[source]

Deprecated since version 0.1.0: Use get_entities_and_relations instead

static get_entities_and_relations(edges)[source]
Parameters:

edges (Edge) – list of edges

Returns:

Returns a 2-tuple containing the list of entities (heads and tails) and the list of relations

Return type:

(Set of str, Set of str)

static zip(edges)[source]