Skip to content

Commit

Permalink
🐛 Issue #37
Browse files Browse the repository at this point in the history
  • Loading branch information
ferzcam committed Nov 19, 2024
1 parent 873df34 commit dcfb64c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
copyright = '2023, Bio-Ontology Research Group'
author = 'BORG'

release = '1.0.1'
version = '1.0.1'
release = '1.0.2-dev'
version = '1.0.2-dev'
# -- General configuration

extensions = [
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Getting started
**mOWL** can be installed from `source code <https://github.com/bio-ontology-research-group/mowl>`_ or from `PyPi <https://pypi.org/project/mowl-borg/>`_. For more details on installation check out the how to :doc:`install/index` section of the project.

.. note::
This version of documentation corresponds to mOWL-1.0.1.
This version of documentation corresponds to mOWL-1.0.2-dev.


mOWL, JPype and the JVM
Expand Down
11 changes: 7 additions & 4 deletions mowl/projection/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ def getEntitiesAndRelations(edges):
return Edge.get_entities_and_relations(edges)

@staticmethod
@versionchanged(version="1.0.2", reason="Method return type changed to tuple of lists")
def get_entities_and_relations(edges):
'''
:param edges: list of edges
:type edges: :class:`Edge`
:returns: Returns a 2-tuple containing the list of entities (heads and tails) and the \
list of relations
:rtype: (Set of str, Set of str)
:rtype: (list of str, list of str)
'''

entities = set()
Expand All @@ -86,6 +87,9 @@ def get_entities_and_relations(edges):
entities |= {edge.src, edge.dst}
relations |= {edge.rel}

entities = sorted(list(entities))
relations = sorted(list(relations))

return (entities, relations)

@staticmethod
Expand All @@ -109,12 +113,11 @@ def as_pykeen(edges, create_inverse_triples=True, entity_to_id=None, relation_to
"""
if entity_to_id is None or relation_to_id is None:
classes, relations = Edge.getEntitiesAndRelations(edges)
classes, relations = set(classes), set(relations)

if entity_to_id is None:
entity_to_id = {v: k for k, v in enumerate(list(classes))}
entity_to_id = {v: k for k, v in enumerate(classes)}
if relation_to_id is None:
relation_to_id = {v: k for k, v in enumerate(list(relations))}
relation_to_id = {v: k for k, v in enumerate(relations)}

def map_edge(edge):
return [entity_to_id[edge.src], relation_to_id[edge.rel], entity_to_id[edge.dst]]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setuptools.setup(
name="mowl-borg",
version="1.0.2-dev.1",
version="1.0.2-dev.2",
author="Bio-Ontology Research Group",
author_email="[email protected]",
description="mOWL: A machine learning library with ontologies",
Expand Down

0 comments on commit dcfb64c

Please sign in to comment.