src/pybel/manager/cache_manager.py
def drop_network(self, network: Network) -> None:
        """Drop a network, while also cleaning up any edges that are no longer part of any network."""
        # get the IDs of the edges that will be orphaned by deleting this network
        # FIXME: this list could be a problem if it becomes very large; possible optimization is a temporary table in DB
        edge_ids = [result.edge_id for result in self.query_singleton_edges_from_network(network)]

        # delete the network-to-node mappings for this network
        self.session.query(network_node).filter(network_node.c.network_id == network.id).delete(
            synchronize_session=False,
        )

        # delete the edge-to-annotation mappings for the to-be-orphaned edges
        self.session.query(edge_annotation).filter(edge_annotation.c.edge_id.in_(edge_ids)).delete(
            synchronize_session=False,
        )

        # delete the edge-to-network mappings for this network
        self.session.query(network_edge).filter(network_edge.c.network_id == network.id).delete(
            synchronize_session=False,
        )

        # delete the now-orphaned edges
        self.session.query(Edge).filter(Edge.id.in_(edge_ids)).delete(synchronize_session=False)

        # delete the network
        self.session.query(Network).filter(Network.id == network.id).delete(synchronize_session=False)

        # commit it!
        self.session.commit()
Drop a network, while also cleaning up any edges that are no longer part of any network.
Drop a network, while also cleaning up any edges that are no longer part of any network.
Drop a network while also cleaning up any edges that are no longer part of any network .
def drop_network(self, network: Network) -> None:
        edge_ids = [result.edge_id for result in self.query_singleton_edges_from_network(network)]
        self.session.query(network_node).filter(network_node.c.network_id == network.id).delete(
            synchronize_session=False,
        )
        self.session.query(edge_annotation).filter(edge_annotation.c.edge_id.in_(edge_ids)).delete(
            synchronize_session=False,
        )
        self.session.query(network_edge).filter(network_edge.c.network_id == network.id).delete(
            synchronize_session=False,
        )
        self.session.query(Edge).filter(Edge.id.in_(edge_ids)).delete(synchronize_session=False)
        self.session.query(Network).filter(Network.id == network.id).delete(synchronize_session=False)
        self.session.commit()
def drop_network ( self , network : Network ) -> None : edge_ids = [ result . edge_id for result in self . query_singleton_edges_from_network ( network ) ] self . session . query ( network_node ) . filter ( network_node . c . network_id == network . id ) . delete ( synchronize_session = False , ) self . session . query ( edge_annotation ) . filter ( edge_annotation . c . edge_id . in_ ( edge_ids ) ) . delete ( synchronize_session = False , ) self . session . query ( network_edge ) . filter ( network_edge . c . network_id == network . id ) . delete ( synchronize_session = False , ) self . session . query ( Edge ) . filter ( Edge . id . in_ ( edge_ids ) ) . delete ( synchronize_session = False ) self . session . query ( Network ) . filter ( Network . id == network . id ) . delete ( synchronize_session = False ) self . session . commit ( )
Drop a network, while also cleaning up any edges that are no longer part of any network.
Drop a network while also cleaning up any edges that are no longer part of any network .
"""Drop a network, while also cleaning up any edges that are no longer part of any network.""" # get the IDs of the edges that will be orphaned by deleting this network # FIXME: this list could be a problem if it becomes very large; possible optimization is a temporary table in DB # delete the network-to-node mappings for this network # delete the edge-to-annotation mappings for the to-be-orphaned edges # delete the edge-to-network mappings for this network # delete the now-orphaned edges # delete the network # commit it!
self
network
Network