diff --git a/lib/transduction/query_builder.py b/lib/transduction/query_builder.py deleted file mode 100644 index 4fe3d2f02560697f9344f1ae53046d7920a46908..0000000000000000000000000000000000000000 --- a/lib/transduction/query_builder.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python3.10 -# -*-coding:Utf-8 -* - -#============================================================================== -# TENET: Query Builder -#------------------------------------------------------------------------------ -# Module to build SPARQL queries of transduction rules, using some specific -# builder for different query parts. -#============================================================================== - -#============================================================================== -# Importing required modules -#============================================================================== - -import construct_query_builder as construct -import clause_query_builder as clause -import binding_query_builder as binding - - - -#============================================================================== -# Data Repository -#============================================================================== - -# -- - - -#============================================================================== -# Useful Functions -#============================================================================== - -# -- - - -#============================================================================== -# Main Functions -#============================================================================== - -# -- - - -#============================================================================== -# Development Test -#============================================================================== - -if __name__ == '__main__': - - print('\n' + ' *** Development Test ***') - - print('\n' + ' -- test: new_net') - test_str = construct.new_net(class_name='?conceptName') - print(test_str) - - print('\n' + ' -- test: update a test query') - test_query= f"""[...] - CONSTRUCT {{ - {construct.new_net(net_id='?newNet1', - net_type='Atom_Class_Net', - sentence_ref='?sentenceRef', - class_name='?conceptName')} - - {construct.relation_propagation(net_id='?newNet1')} - - - }} - WHERE {{ - {clause.identify_node('?concept', '?variable')} - ?concept rdfs:subClassOf amr:AMR_Term_Concept. - ?concept amr:label ?conceptName. - ?variable amr:label ?varLabel. - - {clause.identify_structure()} - - {clause.identify_relations_for_propagation(net_id='?newNet1')} - - {binding.new_variable('?newNet1')} - - }} - """ - print(test_query) - - print('\n' + ' *** - ***') \ No newline at end of file diff --git a/structure/cts/amr_ctr/transduction/atomic_extraction.py b/structure/cts/amr_ctr/transduction/atomic_extraction.py index 68b3e8d9b0615881dbde5d96f4abb5647f576d67..e143aadff2c9fbd31220ebb5d639dcc275723790 100644 --- a/structure/cts/amr_ctr/transduction/atomic_extraction.py +++ b/structure/cts/amr_ctr/transduction/atomic_extraction.py @@ -8,6 +8,13 @@ # AMR structures, at 'Net Expansion' level #============================================================================== +#============================================================================== +# Query Builder Imports +#============================================================================== + +import query_builder.construct as construct + + #============================================================================== # CTR Set (CTR as Sparql querries) #============================================================================== @@ -465,4 +472,47 @@ rule_set['create-phenomena-net-1'] = { BIND (CONCAT(?n2, '_', ?varLabel) AS ?n3). BIND (uri(?n3) AS ?newNet). """ -} \ No newline at end of file +} + + +#============================================================================== +# Development Test +#============================================================================== + +if __name__ == '__main__': + + print('\n' + ' *** Development Test ***') + + print('\n' + ' -- test: new_net') + test_str = construct.new_net(class_name='?conceptName') + print(test_str) + + print('\n' + ' -- test: update a test query') + test_query= f"""[...] + CONSTRUCT {{ + {construct.new_net(net_id='?newNet1', + net_type='Atom_Class_Net', + sentence_ref='?sentenceRef', + class_name='?conceptName')} + + {construct.relation_propagation(net_id='?newNet1')} + + + }} + WHERE {{ + {clause.identify_node('?concept', '?variable')} + ?concept rdfs:subClassOf amr:AMR_Term_Concept. + ?concept amr:label ?conceptName. + ?variable amr:label ?varLabel. + + {clause.identify_structure()} + + {clause.identify_relations_for_propagation(net_id='?newNet1')} + + {binding.new_variable('?newNet1')} + + }} + """ + print(test_query) + + print('\n' + ' *** - ***') diff --git a/lib/transduction/binding_query_builder.py b/structure/cts/amr_ctr/transduction/query_builder/binding.py similarity index 100% rename from lib/transduction/binding_query_builder.py rename to structure/cts/amr_ctr/transduction/query_builder/binding.py diff --git a/lib/transduction/clause_query_builder.py b/structure/cts/amr_ctr/transduction/query_builder/clause.py similarity index 100% rename from lib/transduction/clause_query_builder.py rename to structure/cts/amr_ctr/transduction/query_builder/clause.py diff --git a/lib/transduction/construct_query_builder.py b/structure/cts/amr_ctr/transduction/query_builder/construct.py similarity index 100% rename from lib/transduction/construct_query_builder.py rename to structure/cts/amr_ctr/transduction/query_builder/construct.py