diff --git a/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py b/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py index 32c7adbf9875d5695f3f74b6f56810bc63cd6120..c39e8b9e53c330016996ed621e80df1d4b4f6b82 100644 --- a/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py +++ b/tenet/scheme/amr_master_rule/transduction/heuristic_deducer/refine_mother_relation_1.py @@ -30,7 +30,7 @@ def __search_pattern(graph): clause_list = ['?target_class_net a [rdfs:subClassOf* net:Class_Net].', '?mother_class_net a [rdfs:subClassOf* net:Class_Net].', 'FILTER ( ?target_class_net != ?mother_class_net ).', - '?target_class_net net:hasMotherClassNet ?mother_class_net.' + '?target_class_net net:hasMotherClassNetToRefine ?mother_class_net.' ] query_code = generate_select_query(graph, select_data_list, clause_list) result_set += graph.query(query_code) diff --git a/tenet/scheme/amr_master_rule/transduction/phenomena_analyzer/degree_analyzer_1.py b/tenet/scheme/amr_master_rule/transduction/phenomena_analyzer/degree_analyzer_1.py index af20c14a0c2f172e6be1d5e1fdc453645d0f4b5c..83fc9979979f2cbd3b438e0ffef1abedc75b82ef 100644 --- a/tenet/scheme/amr_master_rule/transduction/phenomena_analyzer/degree_analyzer_1.py +++ b/tenet/scheme/amr_master_rule/transduction/phenomena_analyzer/degree_analyzer_1.py @@ -227,8 +227,8 @@ def __construct_feature_individual_net(graph, feature_class_net, degree_individu -def __associate_mother_relation(graph, left_class_net, right_class_net): - left_class_net.mother_class_net = right_class_net.uri +def __associate_mother_relation_to_refine(graph, left_class_net, right_class_net): + left_class_net.mother_class_net_to_refine = right_class_net.uri result_triple_list = left_class_net.generate_triple_definition() return left_class_net, result_triple_list @@ -275,7 +275,7 @@ def analyze_phenomena_degree91_1(graph): _, superlative_set = __search_degree_arg5(graph, phenomena_net.uri) for row in superlative_set: superlative_class_net = net.ClassNet(graph, uri=row.superlative_class_net) - _, triple_list_5 = __associate_mother_relation( + _, triple_list_5 = __associate_mother_relation_to_refine( graph, new_entity_class_net, superlative_class_net) rule_triple_list += triple_list_5 diff --git a/tenet/transduction/net/composite_class_net.py b/tenet/transduction/net/composite_class_net.py index b8bea7ab15bb13fbc403be591534f510db688de8..313a347a1325cb22e8539cc299da42e5cf5e3447 100644 --- a/tenet/transduction/net/composite_class_net.py +++ b/tenet/transduction/net/composite_class_net.py @@ -34,8 +34,9 @@ class CompositeClassNet(ClassNet): self.type_uri = produce_uriref(self.support_graph, f'net:{self.type_id}') # -- Net Attributes - self.attr_list += ['mother_class_net', 'restriction', 'restriction01'] + self.attr_list += ['mother_class_net', 'mother_class_net_to_refine', 'restriction', 'restriction01'] self._mother_class_net = None + self._mother_class_net_to_refine = None self._restriction = [] self._restriction01 = [] @@ -53,6 +54,16 @@ class CompositeClassNet(ClassNet): @mother_class_net.setter def mother_class_net(self, new_value): self._mother_class_net = self.set_attribute_value_list(new_value, produce_uriref) + + @property + def mother_class_net_to_refine(self): + if self._mother_class_net_to_refine is None: + self._mother_class_net_to_refine = self.get_value_list_from_graph('mother_class_net_to_refine') + return self._mother_class_net_to_refine + + @mother_class_net_to_refine.setter + def mother_class_net_to_refine(self, new_value): + self._mother_class_net_to_refine = self.set_attribute_value_list(new_value, produce_uriref) @property diff --git a/tenet/transduction/semantic_net_rdf_reference.py b/tenet/transduction/semantic_net_rdf_reference.py index c603ee52455429c8a4b571a4a71053ce769e66e8..8cdc447f9bf39e7f26b0ba5c0fcf459aa5dcb388 100644 --- a/tenet/transduction/semantic_net_rdf_reference.py +++ b/tenet/transduction/semantic_net_rdf_reference.py @@ -30,79 +30,80 @@ class SemanticNetReferenceHandle: # *** [attribute_name: (predicate_ref, variable_ref)] *** # Net - 'node': 'coverNode', - 'base_node': 'coverBaseNode', - 'net_composition': 'composeFrom', - 'structure': 'hasStructure', - 'naming': 'hasNaming', + 'node': 'coverNode', + 'base_node': 'coverBaseNode', + 'net_composition': 'composeFrom', + 'structure': 'hasStructure', + 'naming': 'hasNaming', # Class Net - 'class_name': 'hasClassName', - 'mother_class_net': 'hasMotherClassNet', - 'root_class_net': 'hasRootClassNet', - 'class_type': 'hasClassType', + 'class_name': 'hasClassName', + 'mother_class_net': 'hasMotherClassNet', + 'mother_class_net_to_refine': 'hasMotherClassNetToRefine', + 'root_class_net': 'hasRootClassNet', + 'class_type': 'hasClassType', # Property Net - 'property_name': 'hasPropertyName', - 'mother_property_net': 'hasMotherPropertyNet', - 'core_role': 'isCoreRoleLinked', - 'target_argument_node': 'targetArgumentNode', - 'property_type': 'hasPropertyType', - 'property_name01': 'hasPropertyName01', - 'property_name10': 'hasPropertyName10', - 'property_name12': 'hasPropertyName12', + 'property_name': 'hasPropertyName', + 'mother_property_net': 'hasMotherPropertyNet', + 'core_role': 'isCoreRoleLinked', + 'target_argument_node': 'targetArgumentNode', + 'property_type': 'hasPropertyType', + 'property_name01': 'hasPropertyName01', + 'property_name10': 'hasPropertyName10', + 'property_name12': 'hasPropertyName12', # Individual Net - 'base_class_name': 'hasBaseClassName', - 'individual_label': 'hasIndividualLabel', + 'base_class_name': 'hasBaseClassName', + 'individual_label': 'hasIndividualLabel', # Value Net - 'amr_value': 'coverAmrValue', - 'value_label': 'hasValueLabel', + 'amr_value': 'coverAmrValue', + 'value_label': 'hasValueLabel', # Phenomena Net - 'phenomena_type': 'hasPhenomenaType', - 'phenomena_ref': 'hasPhenomenaRef', + 'phenomena_type': 'hasPhenomenaType', + 'phenomena_ref': 'hasPhenomenaRef', # Composite Net Restriction - 'restriction': 'hasRestriction', - 'restriction01': 'hasRestriction01', + 'restriction': 'hasRestriction', + 'restriction01': 'hasRestriction01', # Restriction Net - 'target_node': 'coverTargetNode', - 'restriction_property': 'hasRestrictionOnProperty', - 'restriction_net_value': 'hasRestrictionNetValue', + 'target_node': 'coverTargetNode', + 'restriction_property': 'hasRestrictionOnProperty', + 'restriction_net_value': 'hasRestrictionNetValue', # Axiom Net - 'axiom_name': 'hasAxiomName', - 'axiom_uri': 'hasAxiomURI', - 'axiom_net_argument': 'hasNetArgument', + 'axiom_name': 'hasAxiomName', + 'axiom_uri': 'hasAxiomURI', + 'axiom_net_argument': 'hasNetArgument', # Relation Net - 'subject_net': 'hasSubjectNet', - 'predicate_net': 'hasPredicateNet', - 'object_net': 'hasObjectNet', + 'subject_net': 'hasSubjectNet', + 'predicate_net': 'hasPredicateNet', + 'object_net': 'hasObjectNet', # Action Net - 'action_name': 'hasActionName', - 'target_class_net': 'hasTargetClassNet', - 'target_individual_net': 'hasTargetIndividualNet', - 'assignee_class_net': 'hasAssigneeClassNet', - 'assignee_individual_net': 'hasAssigneeIndividualNet', + 'action_name': 'hasActionName', + 'target_class_net': 'hasTargetClassNet', + 'target_individual_net': 'hasTargetIndividualNet', + 'assignee_class_net': 'hasAssigneeClassNet', + 'assignee_individual_net': 'hasAssigneeIndividualNet', # Rule Net - 'rule_relation_name': 'hasRuleRelationName', - 'rule_action_net': 'hasRuleActionURI', + 'rule_relation_name': 'hasRuleRelationName', + 'rule_action_net': 'hasRuleActionURI', # Action Net - 'axiom_name': 'hasAxiomName', - 'axiom_uri': 'hasAxiomURI', - 'axiom_net_argument': 'hasNetArgument', + 'axiom_name': 'hasAxiomName', + 'axiom_uri': 'hasAxiomURI', + 'axiom_net_argument': 'hasNetArgument', # URI for OWL declaration - 'class_uri': 'hasClassURI', - 'property_uri': 'hasPropertyURI', - 'individual_uri': 'hasIndividualURI' + 'class_uri': 'hasClassURI', + 'property_uri': 'hasPropertyURI', + 'individual_uri': 'hasIndividualURI' } @@ -110,9 +111,9 @@ class SemanticNetReferenceHandle: self._track_predicate_table = { # *** [attribute_name: predicate_ref] *** - 'progress_step': 'trackProgress', - 'main_net_composante': 'trackMainNetComposante', - 'net_composante': 'trackNetComposante' + 'progress_step': 'trackProgress', + 'main_net_composante': 'trackMainNetComposante', + 'net_composante': 'trackNetComposante' } diff --git a/tests/main_tests/test_main_owl_extraction.py b/tests/main_tests/test_main_owl_extraction.py index a89785c4312a0625fb6f3ad8634bc37a66562a5b..7ee428d0bf8dd44763aaeda6e0830d959f639988 100644 --- a/tests/main_tests/test_main_owl_extraction.py +++ b/tests/main_tests/test_main_owl_extraction.py @@ -56,7 +56,7 @@ test_data_dir = f'{INPUT_DIR_PATH}amrDocuments/' # onto_prefix = f'SimpleTest' # base_output_name = f'SimpleTest' -uuid_num = '02' +uuid_num = '01' amrld_dir_path = f'{test_data_dir}dev/solar-system-{uuid_num}/' amrld_file_path = f'{amrld_dir_path}SSC-{uuid_num}-01.stog.amr.ttl' base_output_name = f'SolarSystemDev{uuid_num}'