Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing NodeDeletion which was earlier a comment. #791

Merged
merged 4 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,8 @@ def _tv_dict(stanza: Stanza) -> Dict[str, List[str]]:
id=_id(), about_node=t1id, new_value=vals2list[0], old_value=None
)
else:
#! KGCL may have NameDeletion in the future.
yield kgcl.NodeRename(
id=_id(), about_node=t2id, old_value=vals2list[0], new_value=None
yield kgcl.NodeDeletion(
id=_id(), about_node=t1id, old_value=vals1list[0], new_value=None
Copy link
Collaborator Author

@hrshdhgd hrshdhgd Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmungall : This is the only real change in the PR. I ran tox -e format that changed all other files.

Reason: GH Actions were failing and complaining about imports not being sorted.

)
elif tag == TAG_DEFINITION:
if node_is_deleted:
Expand Down
8 changes: 4 additions & 4 deletions src/oaklib/implementations/sqldb/sql_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@ def __post_init__(self):
logging.info(f"Locator, post-processed: {locator}")
self.engine = create_engine(locator)

if(logging.root.level <= logging.DEBUG):
#If oaklib is running at DEBUG level logging; record all queries from sqlachemy on execution.
#This line is equivalent to create_engine(locator,echo=True)
logging.getLogger('sqlalchemy.engine.Engine').setLevel(logging.INFO)
if logging.root.level <= logging.DEBUG:
# If oaklib is running at DEBUG level logging; record all queries from sqlachemy on execution.
# This line is equivalent to create_engine(locator,echo=True)
logging.getLogger("sqlalchemy.engine.Engine").setLevel(logging.INFO)

@property
def session(self):
Expand Down
1 change: 0 additions & 1 deletion src/oaklib/utilities/lexical/lexical_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def add_labels_from_uris(oi: BasicOntologyInterface):
oi.set_label(curie, label)



def create_lexical_index(
oi: BasicOntologyInterface,
pipelines: Optional[List[LexicalTransformationPipeline]] = None,
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/test_sqlite_full.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from oaklib.utilities.mapping.cross_ontology_diffs import (
calculate_pairwise_relational_diff,
)

from tests import EXTERNAL_DB_DIR

DB_FOLDER = EXTERNAL_DB_DIR / "unreciprocated-mapping-test.obo"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from click.testing import CliRunner
from kgcl_schema.datamodel.kgcl import MappingCreation, NodeChange, RemoveMapping
from linkml_runtime.loaders import json_loader, yaml_loader
from sssom.parsers import parse_sssom_table, to_mapping_set_document

from oaklib import get_adapter
from oaklib.cli import clear_cli_settings, main
from oaklib.datamodels import fhir, obograph, taxon_constraints
Expand All @@ -22,8 +24,6 @@
SKOS_EXACT_MATCH,
)
from oaklib.utilities.kgcl_utilities import parse_kgcl_files
from sssom.parsers import parse_sssom_table, to_mapping_set_document

from tests import (
ATOM,
CATALYTIC_ACTIVITY,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import unittest

from linkml_runtime.loaders import json_loader

from oaklib import get_adapter
from oaklib.converters.logical_definition_flattener import LogicalDefinitionFlattener
from oaklib.datamodels import obograph
from oaklib.datamodels.obograph import GraphDocument
from oaklib.datamodels.vocabulary import HAS_PART, PART_OF

from tests import INPUT_DIR, OUTPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
2 changes: 1 addition & 1 deletion tests/test_converters/test_obo_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@

import pytest
import rdflib
from oaklib import get_adapter
from rdflib.compare import isomorphic

from oaklib import get_adapter
from tests import INPUT_DIR, OUTPUT_DIR

logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_converters/test_obo_graph_to_cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import curies
from linkml_runtime.loaders import json_loader
from ndex2 import create_nice_cx_from_file

from oaklib.converters.obo_graph_to_cx_converter import OboGraphToCXConverter
from oaklib.datamodels.obograph import GraphDocument
from oaklib.interfaces.basic_ontology_interface import get_default_prefix_map

from tests import INPUT_DIR, OUTPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
2 changes: 1 addition & 1 deletion tests/test_converters/test_obo_graph_to_fhir.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import curies
import requests
from linkml_runtime.loaders import json_loader

from oaklib.constants import TIMEOUT_SECONDS
from oaklib.converters.obo_graph_to_fhir_converter import OboGraphToFHIRConverter
from oaklib.datamodels.fhir import CodeSystem
from oaklib.datamodels.obograph import GraphDocument
from oaklib.interfaces.basic_ontology_interface import get_default_prefix_map

from tests import IMBO, INPUT_DIR, NUCLEUS, OUTPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
2 changes: 1 addition & 1 deletion tests/test_converters/test_obo_graph_to_obo_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import curies
from linkml_runtime.loaders import json_loader

from oaklib import OntologyResource
from oaklib.converters.obo_graph_to_obo_format_converter import (
OboGraphToOboFormatConverter,
)
from oaklib.datamodels.obograph import GraphDocument
from oaklib.implementations import SimpleOboImplementation
from oaklib.interfaces.basic_ontology_interface import get_default_prefix_map

from tests import INPUT_DIR, OUTPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import curies
from linkml_runtime.loaders import json_loader

from oaklib import OntologyResource
from oaklib.converters.obo_graph_to_rdf_owl_converter import OboGraphToRdfOwlConverter
from oaklib.datamodels.obograph import GraphDocument
from oaklib.implementations import SparqlImplementation
from oaklib.interfaces.basic_ontology_interface import get_default_prefix_map

from tests import INPUT_DIR, OUTPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
2 changes: 1 addition & 1 deletion tests/test_datamodels/test_obograph_datamodel.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.utils.introspection import package_schemaview

from oaklib.datamodels import obograph
from oaklib.datamodels.vocabulary import IS_A

from tests import output_path
from tests.test_datamodels import AbstractDatamodelTestCase

Expand Down
2 changes: 1 addition & 1 deletion tests/test_datamodels/test_ontology_metadata_datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.loaders import yaml_loader
from linkml_runtime.utils.introspection import package_schemaview
from oaklib.datamodels import ontology_metadata

from oaklib.datamodels import ontology_metadata
from tests import output_path


Expand Down
1 change: 1 addition & 0 deletions tests/test_datamodels/test_search_datamodel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest

from linkml_runtime.utils.introspection import package_schemaview

from oaklib.datamodels import search_datamodel
from oaklib.datamodels.search import create_search_configuration
from oaklib.datamodels.search_datamodel import SearchProperty, SearchTermSyntax
Expand Down
2 changes: 1 addition & 1 deletion tests/test_datamodels/test_text_annotator_datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.utils.introspection import package_schemaview
from oaklib.datamodels import text_annotator

from oaklib.datamodels import text_annotator
from tests import NUCLEUS, output_path


Expand Down
2 changes: 1 addition & 1 deletion tests/test_datamodels/test_validation_datamodel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging
import unittest

import oaklib.datamodels.validation_datamodel as vdm
from linkml_runtime.dumpers import yaml_dumper
from linkml_runtime.utils.introspection import package_schemaview

import oaklib.datamodels.validation_datamodel as vdm
from tests import output_path


Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from kgcl_schema.datamodel.kgcl import Change, NodeObsoletion
from kgcl_schema.grammar.render_operations import render
from linkml_runtime.dumpers import json_dumper, yaml_dumper

from oaklib import BasicOntologyInterface, get_adapter
from oaklib.datamodels import obograph
from oaklib.datamodels.association import Association
Expand Down Expand Up @@ -78,7 +79,6 @@
from oaklib.interfaces.semsim_interface import SemanticSimilarityInterface
from oaklib.interfaces.summary_statistics_interface import SummaryStatisticsInterface
from oaklib.utilities.kgcl_utilities import generate_change_id

from tests import (
ARCHAEA,
BACTERIA,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import unittest

from linkml_runtime.dumpers import yaml_dumper

from oaklib.datamodels.vocabulary import IS_A, PART_OF
from oaklib.implementations.aggregator.aggregator_implementation import (
AggregatorImplementation,
)
from oaklib.implementations.pronto.pronto_implementation import ProntoImplementation
from oaklib.resource import OntologyResource
from oaklib.utilities.obograph_utils import graph_as_dict

from tests import (
CELLULAR_COMPONENT,
CYTOPLASM,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_bioportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from unittest import mock

from linkml_runtime.dumpers import yaml_dumper

from oaklib.implementations.ontoportal.bioportal_implementation import (
BioPortalImplementation,
)
from oaklib.utilities.apikey_manager import get_apikey_value

from tests import CELLULAR_COMPONENT, CYTOPLASM, DIGIT, HUMAN, NEURON, VACUOLE


Expand Down
1 change: 0 additions & 1 deletion tests/test_implementations/test_cx.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from oaklib.implementations.cx.cx_implementation import CXImplementation
from oaklib.resource import OntologyResource

from tests import INPUT_DIR
from tests.test_implementations import ComplianceTester

Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_funowl.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
from funowl import EquivalentClasses, SubClassOf
from funowl.writers.FunctionalWriter import FunctionalWriter
from kgcl_schema.datamodel import kgcl

from oaklib.implementations.funowl.funowl_implementation import FunOwlImplementation
from oaklib.interfaces.obograph_interface import OboGraphInterface
from oaklib.interfaces.owl_interface import AxiomFilter
from oaklib.resource import OntologyResource
from oaklib.utilities.kgcl_utilities import generate_change_id

from tests import CHEBI_NUCLEUS, HUMAN, INPUT_DIR, NUCLEUS, VACUOLE

TEST_ONT = INPUT_DIR / "go-nucleus.ofn"
Expand Down
1 change: 0 additions & 1 deletion tests/test_implementations/test_gilda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from oaklib.datamodels.text_annotator import TextAnnotationConfiguration
from oaklib.implementations import GildaImplementation

from tests import CELL_CORTEX

try:
Expand Down
1 change: 0 additions & 1 deletion tests/test_implementations/test_ncbigene.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from oaklib.interfaces.association_provider_interface import (
AssociationProviderInterface,
)

from tests import CYTOPLASM, INPUT_DIR
from tests.input.mock_ncbi_objects import NCBI_ASSOCIATIONS

Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_obograph.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from copy import deepcopy

from kgcl_schema.datamodel import kgcl

from oaklib.datamodels import obograph
from oaklib.datamodels.search import SearchConfiguration
from oaklib.datamodels.search_datamodel import SearchProperty, SearchTermSyntax
Expand All @@ -22,7 +23,6 @@
index_graph_edges_by_subject,
index_graph_nodes,
)

from tests import (
CELL,
CELLULAR_COMPONENT,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_ols.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import unittest

from linkml_runtime.dumpers import yaml_dumper

from oaklib.datamodels.search import SearchConfiguration, SearchProperty
from oaklib.datamodels.vocabulary import IS_A
from oaklib.implementations.ols.ols_implementation import OlsImplementation
from oaklib.resource import OntologyResource

from tests import CELLULAR_COMPONENT, CYTOPLASM, DIGIT, VACUOLE


Expand Down
1 change: 0 additions & 1 deletion tests/test_implementations/test_ontobee.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from oaklib.datamodels.vocabulary import IS_A, PART_OF
from oaklib.implementations.ontobee.ontobee_implementation import OntobeeImplementation
from oaklib.resource import OntologyResource

from tests import CELLULAR_COMPONENT, DIGIT, INPUT_DIR, OUTPUT_DIR, SHAPE, VACUOLE

TEST_ONT = INPUT_DIR / "go-nucleus.obo"
Expand Down
1 change: 1 addition & 0 deletions tests/test_implementations/test_pantherdb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest

import pytest

from oaklib import get_adapter
from oaklib.interfaces.association_provider_interface import (
AssociationProviderInterface,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_pronto.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pronto
from kgcl_schema.datamodel import kgcl

from oaklib import get_adapter
from oaklib.datamodels import obograph
from oaklib.datamodels.search import SearchConfiguration
Expand All @@ -22,7 +23,6 @@
from oaklib.utilities.validation.definition_ontology_rule import (
DefinitionOntologyRule,
)

from tests import (
CELL,
CELLULAR_COMPONENT,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_robot_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
from kgcl_schema.datamodel import kgcl
from linkml_runtime.dumpers import yaml_dumper

from oaklib import BasicOntologyInterface, get_adapter
from oaklib.implementations.tabular.robot_template_implementation import (
template_modify,
Expand All @@ -10,7 +11,6 @@
from oaklib.interfaces.dumper_interface import DumperInterface
from oaklib.interfaces.patcher_interface import PatcherInterface
from oaklib.utilities.kgcl_utilities import tidy_change_object

from tests import INPUT_DIR, OUTPUT_DIR

TEMPLATES = INPUT_DIR / "obi-templates"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import unittest

from linkml_runtime.dumpers import yaml_dumper

from oaklib.datamodels.similarity import TermPairwiseSimilarity
from oaklib.datamodels.vocabulary import IS_A, PART_OF
from oaklib.interfaces.semsim_interface import SemanticSimilarityInterface
from oaklib.selector import get_adapter

from tests import (
ENDOMEMBRANE_SYSTEM,
FUNGI,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_implementations/test_simple_obo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from copy import deepcopy

from kgcl_schema.datamodel import kgcl

from oaklib import get_adapter
from oaklib.datamodels import obograph
from oaklib.datamodels.search import SearchConfiguration
Expand Down Expand Up @@ -34,7 +35,6 @@
index_graph_edges_by_subject,
index_graph_nodes,
)

from tests import (
BIOLOGICAL_ENTITY,
CELL,
Expand Down
1 change: 0 additions & 1 deletion tests/test_implementations/test_sparql.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
index_graph_edges_by_subject,
index_graph_nodes,
)

from tests import (
CATALYTIC_ACTIVITY,
CELL_CORTEX,
Expand Down
Loading
Loading