Skip to content
Snippets Groups Projects
Commit 3cf22088 authored by Aurélien Lamercerie's avatar Aurélien Lamercerie
Browse files

Update Rule using mother relation to refine

parent 00a53237
Branches
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ def __search_pattern(graph): ...@@ -30,7 +30,7 @@ def __search_pattern(graph):
clause_list = ['?target_class_net a [rdfs:subClassOf* net:Class_Net].', clause_list = ['?target_class_net a [rdfs:subClassOf* net:Class_Net].',
'?mother_class_net a [rdfs:subClassOf* net:Class_Net].', '?mother_class_net a [rdfs:subClassOf* net:Class_Net].',
'FILTER ( ?target_class_net != ?mother_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) query_code = generate_select_query(graph, select_data_list, clause_list)
result_set += graph.query(query_code) result_set += graph.query(query_code)
......
...@@ -227,8 +227,8 @@ def __construct_feature_individual_net(graph, feature_class_net, degree_individu ...@@ -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): def __associate_mother_relation_to_refine(graph, left_class_net, right_class_net):
left_class_net.mother_class_net = right_class_net.uri left_class_net.mother_class_net_to_refine = right_class_net.uri
result_triple_list = left_class_net.generate_triple_definition() result_triple_list = left_class_net.generate_triple_definition()
return left_class_net, result_triple_list return left_class_net, result_triple_list
...@@ -275,7 +275,7 @@ def analyze_phenomena_degree91_1(graph): ...@@ -275,7 +275,7 @@ def analyze_phenomena_degree91_1(graph):
_, superlative_set = __search_degree_arg5(graph, phenomena_net.uri) _, superlative_set = __search_degree_arg5(graph, phenomena_net.uri)
for row in superlative_set: for row in superlative_set:
superlative_class_net = net.ClassNet(graph, uri=row.superlative_class_net) 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) graph, new_entity_class_net, superlative_class_net)
rule_triple_list += triple_list_5 rule_triple_list += triple_list_5
......
...@@ -34,8 +34,9 @@ class CompositeClassNet(ClassNet): ...@@ -34,8 +34,9 @@ class CompositeClassNet(ClassNet):
self.type_uri = produce_uriref(self.support_graph, f'net:{self.type_id}') self.type_uri = produce_uriref(self.support_graph, f'net:{self.type_id}')
# -- Net Attributes # -- 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 = None
self._mother_class_net_to_refine = None
self._restriction = [] self._restriction = []
self._restriction01 = [] self._restriction01 = []
...@@ -54,6 +55,16 @@ class CompositeClassNet(ClassNet): ...@@ -54,6 +55,16 @@ class CompositeClassNet(ClassNet):
def mother_class_net(self, new_value): def mother_class_net(self, new_value):
self._mother_class_net = self.set_attribute_value_list(new_value, produce_uriref) 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 @property
def restriction(self): def restriction(self):
......
...@@ -39,6 +39,7 @@ class SemanticNetReferenceHandle: ...@@ -39,6 +39,7 @@ class SemanticNetReferenceHandle:
# Class Net # Class Net
'class_name': 'hasClassName', 'class_name': 'hasClassName',
'mother_class_net': 'hasMotherClassNet', 'mother_class_net': 'hasMotherClassNet',
'mother_class_net_to_refine': 'hasMotherClassNetToRefine',
'root_class_net': 'hasRootClassNet', 'root_class_net': 'hasRootClassNet',
'class_type': 'hasClassType', 'class_type': 'hasClassType',
......
...@@ -56,7 +56,7 @@ test_data_dir = f'{INPUT_DIR_PATH}amrDocuments/' ...@@ -56,7 +56,7 @@ test_data_dir = f'{INPUT_DIR_PATH}amrDocuments/'
# onto_prefix = f'SimpleTest' # onto_prefix = f'SimpleTest'
# base_output_name = 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_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' amrld_file_path = f'{amrld_dir_path}SSC-{uuid_num}-01.stog.amr.ttl'
base_output_name = f'SolarSystemDev{uuid_num}' base_output_name = f'SolarSystemDev{uuid_num}'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment