From db8bc74932e0bc4cadaab1da826a72f90895322c Mon Sep 17 00:00:00 2001 From: arcangelo7 Date: Sun, 20 Oct 2024 17:00:05 +0200 Subject: [PATCH] print(a.res, b.res, URIRef(a.res + '/prov/se/1'), self.prov_set.get_entity(URIRef(a.res + '/prov/se/1'))) --- oc_ocdm/prov/prov_set.py | 18 +----------------- oc_ocdm/test/prov/test_prov_set.py | 2 +- virtuoso-opensource/database/virtuoso.trx | Bin 2323 -> 4461 bytes 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/oc_ocdm/prov/prov_set.py b/oc_ocdm/prov/prov_set.py index 507d334..5331913 100755 --- a/oc_ocdm/prov/prov_set.py +++ b/oc_ocdm/prov/prov_set.py @@ -39,10 +39,6 @@ from oc_ocdm.prov.prov_entity import ProvEntity from oc_ocdm.support.support import (get_count, get_prefix, get_short_name) -import logging - -logging.basicConfig(level=logging.DEBUG) -logger = logging.getLogger(__name__) class ProvSet(AbstractSet): # Labels @@ -122,35 +118,25 @@ def generate_provenance(self, c_time: float = None) -> set: else: cur_time: str = datetime.fromtimestamp(c_time, tz=timezone.utc).replace(microsecond=0).isoformat(sep="T") - logger.debug(f"Starting generate_provenance with cur_time: {cur_time}") - # MERGED ENTITIES for cur_subj in self.prov_g.res_to_entity.values(): - logger.debug(f"Processing entity: {cur_subj}") if cur_subj is None or (not cur_subj.was_merged or cur_subj.to_be_deleted): - logger.debug(f"Skipping entity: {cur_subj}") + # Here we must skip every entity that was not merged or that must be deleted. continue # Previous snapshot last_snapshot_res: Optional[URIRef] = self._retrieve_last_snapshot(cur_subj.res) - logger.debug(f"Last snapshot for {cur_subj.res}: {last_snapshot_res}") - if last_snapshot_res is None: # CREATION SNAPSHOT - logger.debug(f"Creating new snapshot for {cur_subj.res}") cur_snapshot: SnapshotEntity = self._create_snapshot(cur_subj, cur_time) cur_snapshot.has_description(f"The entity '{cur_subj.res}' has been created.") modified_entities.add(cur_subj.res) else: update_query: str = get_update_query(cur_subj, entity_type="graph")[0] was_modified: bool = (update_query != "") - logger.debug(f"Entity {cur_subj.res} was_modified: {was_modified}") snapshots_list: List[SnapshotEntity] = self._get_snapshots_from_merge_list(cur_subj) - logger.debug(f"Snapshots from merge list: {snapshots_list}") - if was_modified and len(snapshots_list) <= 0: # MODIFICATION SNAPSHOT - logger.debug(f"Creating modification snapshot for {cur_subj.res}") last_snapshot: SnapshotEntity = self.add_se(prov_subject=cur_subj, res=last_snapshot_res) last_snapshot.has_invalidation_time(cur_time) @@ -161,7 +147,6 @@ def generate_provenance(self, c_time: float = None) -> set: modified_entities.add(cur_subj.res) elif len(snapshots_list) > 0: # MERGE SNAPSHOT - logger.debug(f"Creating merge snapshot for {cur_subj.res}") last_snapshot: SnapshotEntity = self.add_se(prov_subject=cur_subj, res=last_snapshot_res) last_snapshot.has_invalidation_time(cur_time) cur_snapshot: SnapshotEntity = self._create_snapshot(cur_subj, cur_time) @@ -214,7 +199,6 @@ def generate_provenance(self, c_time: float = None) -> set: cur_snapshot.has_description(f"The entity '{cur_subj.res}' has been modified.") cur_snapshot.has_update_action(update_query) modified_entities.add(cur_subj.res) - logger.debug(f"Finished generate_provenance. Modified entities: {modified_entities}") return modified_entities def _add_prov(self, graph_url: str, short_name: str, prov_subject: GraphEntity, diff --git a/oc_ocdm/test/prov/test_prov_set.py b/oc_ocdm/test/prov/test_prov_set.py index b10ea83..9e064bc 100644 --- a/oc_ocdm/test/prov/test_prov_set.py +++ b/oc_ocdm/test/prov/test_prov_set.py @@ -49,7 +49,7 @@ def test_creation_merged_entity(self): a.merge(b, prefer_self=True) result = self.prov_set.generate_provenance(self.cur_time) - + print(a.res, b.res, URIRef(a.res + '/prov/se/1'), self.prov_set.get_entity(URIRef(a.res + '/prov/se/1'))) se_a = self.prov_set.get_entity(URIRef(a.res + '/prov/se/1')) self.assertIsNotNone(se_a) self.assertIsInstance(se_a, SnapshotEntity) diff --git a/virtuoso-opensource/database/virtuoso.trx b/virtuoso-opensource/database/virtuoso.trx index c602260827ab47ee20e26365d8418d0dd1480f0c..9b6a0e6f37bbc3ca2a86f810af3053a0e7dc6955 100644 GIT binary patch delta 301 zcmbO%^j2wuFz4iFEFs)`m9FnmVA#vR9w{_gf-#!~$Uil?9n84lJNX-922kY2(#id7 zAwb4W)5*J-VnB@E$x_VGAjXZ!mCV)>?-&p6;oQr>z_G+AhaFed;Ev;u(u