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

Update Query Builder with new classes

parent 47fb5d8e
No related branches found
No related tags found
No related merge requests found
...@@ -32,10 +32,7 @@ rule_set['create-atom-class-net'] = { ...@@ -32,10 +32,7 @@ rule_set['create-atom-class-net'] = {
'comment': "Create Atom Class Net from AMR Term Concept", 'comment': "Create Atom Class Net from AMR Term Concept",
'construction': f""" 'construction': f"""
{atom_class_net.construct(base_node='?leaf1', {atom_class_net.construct(base_node='?leaf1',
structure=structure.sentence_ref,
class_name='?conceptName')} class_name='?conceptName')}
{atom_class_net.propagate_relations()}
""", """,
'clause': f""" 'clause': f"""
# -- Identify Class covering a single leaf # -- Identify Class covering a single leaf
...@@ -46,9 +43,7 @@ rule_set['create-atom-class-net'] = { ...@@ -46,9 +43,7 @@ rule_set['create-atom-class-net'] = {
?leaf1Concept rdfs:subClassOf amr:AMR_Term_Concept. ?leaf1Concept rdfs:subClassOf amr:AMR_Term_Concept.
?leaf1Concept amr:label ?conceptName. ?leaf1Concept amr:label ?conceptName.
{structure.identify()} {atom_class_net.complete_clauses_for_construction('?leaf1')}
{atom_class_net.identify_relations_for_propagation('?leaf1')}
""", """,
'binding': f""" 'binding': f"""
{atom_class_net.bind_uri('?conceptName', '?varLabel')} {atom_class_net.bind_uri('?conceptName', '?varLabel')}
......
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
# Importing required modules # Importing required modules
#============================================================================== #==============================================================================
from .element.net import * from .element.old_net import OldNet
from .element.structure import * from .element.net import Net
from .element.atom_class_net import AtomClassNet
from .element.structure import Structure
#============================================================================== #==============================================================================
...@@ -28,18 +30,18 @@ structure = Structure() ...@@ -28,18 +30,18 @@ structure = Structure()
#============================================================================== #==============================================================================
# -- Atom Class Net # -- Atom Class Net
atom_class_net = Net('atomClass') atom_class_net = AtomClassNet()
atom_class_net_1 = Net('atomClass', 1) atom_class_net_1 = AtomClassNet(1)
atom_class_net_2 = Net('atomClass', 2) atom_class_net_2 = AtomClassNet(2)
# -- Individual Net # -- Individual Net
individual_net = Net('individual') individual_net = OldNet('individual')
# -- Atom Property Net # -- Atom Property Net
atom_property_net = Net('atomProperty') atom_property_net = OldNet('atomProperty')
# -- Phenomena Net # -- Phenomena Net
phenomena_net = Net('phenomena') phenomena_net = OldNet('phenomena')
#============================================================================== #==============================================================================
......
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Net Query Builder
#------------------------------------------------------------------------------
# Class to generate SPARQL query parts related to semantic nets
#==============================================================================
#==============================================================================
# Importing required modules
#==============================================================================
from .net import Net
#==============================================================================
# Data Repository
#==============================================================================
# -- Reference Table
# NET_TYPE_TABLE = { # *** [type_name: type_id] ***
# 'default': 'Net',
# 'atomClass': 'Atom_Class_Net',
# 'individual': 'Individual_Net',
# 'atomProperty': 'Atom_Property_Net',
# 'phenomena': 'Phenomena_Net'
# }
# PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
# 'structure': 'hasStructure',
# 'class_name': 'hasClassName',
# 'mother_class_net': 'hasMotherClassNet',
# 'individual_label': 'hasIndividualLabel',
# 'core_role': 'isCoreRoleLinked',
# 'target_argument_node': 'targetArgumentNode',
# 'property_type': 'hasPropertyType',
# 'property_name': 'hasPropertyName',
# 'property_name01': 'hasPropertyName01',
# 'property_name10': 'hasPropertyName10',
# 'property_name12': 'hasPropertyName12',
# 'phenomena_type': 'hasPhenomenaType',
# 'phenomena_ref': 'hasPhenomenaRef'
# }
# -- Default Value(s)
DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n '
#==============================================================================
# Net Class
#==============================================================================
class AtomClassNet(Net):
""" Class to generate SPARQL query parts related to semantic nets.
"""
predicate_table = Net.predicate_table
predicate_table.update({
'class_name': 'hasClassName'
})
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, num=''):
super().__init__(num)
# -- Net Signature
self.type_name = 'atomClass'
self.type_id = 'Atom_Class_Net'
self.id = f'?{self.type_name}Net{num}'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.class_name = f'{self.id}ClassName'
#--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts
#--------------------------------------------------------------------------
def construct(self, **net_attribute):
query_code = super().construct(**net_attribute)
return query_code
#--------------------------------------------------------------------------
# Method(s) to build 'Binding' parts
#--------------------------------------------------------------------------
def bind_uri(self, net_name='nameless', node_reference='00'):
return super().bind_uri(net_name, node_reference)
#==============================================================================
# Development Test
#==============================================================================
if __name__ == '__main__':
print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net')
atom_class_net = AtomClassNet()
print(atom_class_net)
print('\n' + ' -- test: construct')
construct_ctr = atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query')
test_query= f"""[...]
CONSTRUCT {{
{atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{atom_class_net.propagate_relations()}
}}
WHERE {{
clause_1
clause_2
{atom_class_net.identify_relations_for_propagation('?node1')}
{atom_class_net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')}
}}
"""
print(test_query)
print('\n' + ' *** - ***')
\ No newline at end of file
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Net Query Builder
#------------------------------------------------------------------------------
# Class to generate SPARQL query parts related to semantic nets
#==============================================================================
#==============================================================================
# Importing required modules
#==============================================================================
from net import Net
#==============================================================================
# Data Repository
#==============================================================================
# -- Reference Table
# NET_TYPE_TABLE = { # *** [type_name: type_id] ***
# 'default': 'Net',
# 'atomClass': 'Atom_Class_Net',
# 'individual': 'Individual_Net',
# 'atomProperty': 'Atom_Property_Net',
# 'phenomena': 'Phenomena_Net'
# }
# PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
# 'structure': 'hasStructure',
# 'class_name': 'hasClassName',
# 'mother_class_net': 'hasMotherClassNet',
# 'individual_label': 'hasIndividualLabel',
# 'core_role': 'isCoreRoleLinked',
# 'target_argument_node': 'targetArgumentNode',
# 'property_type': 'hasPropertyType',
# 'property_name': 'hasPropertyName',
# 'property_name01': 'hasPropertyName01',
# 'property_name10': 'hasPropertyName10',
# 'property_name12': 'hasPropertyName12',
# 'phenomena_type': 'hasPhenomenaType',
# 'phenomena_ref': 'hasPhenomenaRef'
# }
# -- Default Value(s)
DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n '
#==============================================================================
# Net Class
#==============================================================================
class AtomClassNet(Net):
""" Class to generate SPARQL query parts related to semantic nets.
"""
predicate_table = Net.predicate_table
predicate_table.update({
'class_name': 'hasClassName'
})
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, num=''):
super().__init__(num)
# -- Net Signature
self.type_name = 'atomClass'
self.type_id = 'Atom_Class_Net'
self.id = f'?{self.type_name}Net{num}'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.class_name = f'{self.id}ClassName'
self.mother_class_net = f'{self.id}MotherClassNet'
self.individual_label = f'{self.id}IndividualLabel'
#--------------------------------------------------------------------------
# Private data accessor(s)
#--------------------------------------------------------------------------
# def __get_predicate(self, data_ref):
# property_name = PREDICATE_TABLE[f'{data_ref}']
# return f'net:{property_name}'
#--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts
#--------------------------------------------------------------------------
def construct(self, **net_attribute):
query_code = super().construct(**net_attribute)
return query_code
#--------------------------------------------------------------------------
# Method(s) to build 'Clause' parts
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Method(s) to build 'Binding' parts
#--------------------------------------------------------------------------
def bind_uri(self, net_name='nameless', node_reference='00'):
return super().bind_uri(net_name, node_reference)
#==============================================================================
# Development Test
#==============================================================================
if __name__ == '__main__':
print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net')
atom_class_net = AtomClassNet()
print(atom_class_net)
print('\n' + ' -- test: construct')
construct_ctr = atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query')
test_query= f"""[...]
CONSTRUCT {{
{atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{atom_class_net.propagate_relations()}
}}
WHERE {{
clause_1
clause_2
{atom_class_net.identify_relations_for_propagation('?node1')}
{atom_class_net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')}
}}
"""
print(test_query)
print('\n' + ' *** - ***')
\ No newline at end of file
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Net Query Builder
#------------------------------------------------------------------------------
# Class to generate SPARQL query parts related to semantic nets
#==============================================================================
#==============================================================================
# Importing required modules
#==============================================================================
from net import Net
#==============================================================================
# Data Repository
#==============================================================================
# -- Reference Table
# NET_TYPE_TABLE = { # *** [type_name: type_id] ***
# 'default': 'Net',
# 'atomClass': 'Atom_Class_Net',
# 'individual': 'Individual_Net',
# 'atomProperty': 'Atom_Property_Net',
# 'phenomena': 'Phenomena_Net'
# }
# PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
# 'structure': 'hasStructure',
# 'class_name': 'hasClassName',
# 'mother_class_net': 'hasMotherClassNet',
# 'individual_label': 'hasIndividualLabel',
# 'core_role': 'isCoreRoleLinked',
# 'target_argument_node': 'targetArgumentNode',
# 'property_type': 'hasPropertyType',
# 'property_name': 'hasPropertyName',
# 'property_name01': 'hasPropertyName01',
# 'property_name10': 'hasPropertyName10',
# 'property_name12': 'hasPropertyName12',
# 'phenomena_type': 'hasPhenomenaType',
# 'phenomena_ref': 'hasPhenomenaRef'
# }
# -- Default Value(s)
DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n '
#==============================================================================
# Net Class
#==============================================================================
class IndividualNet(Net):
""" Class to generate SPARQL query parts related to semantic nets.
"""
predicate_table = Net.predicate_table
predicate_table.update({
'class_name': 'hasClassName',
'mother_class_net': 'hasMotherClassNet',
'individual_label': 'hasIndividualLabel'
})
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, num=''):
super().__init__(num)
# -- Net Signature
self.type_name = 'atomClass'
self.type_id = 'Atom_Class_Net'
self.id = f'?{self.type_name}Net{num}'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.class_name = f'{self.id}ClassName'
self.mother_class_net = f'{self.id}MotherClassNet'
self.individual_label = f'{self.id}IndividualLabel'
#--------------------------------------------------------------------------
# Private data accessor(s)
#--------------------------------------------------------------------------
# def __get_predicate(self, data_ref):
# property_name = PREDICATE_TABLE[f'{data_ref}']
# return f'net:{property_name}'
#--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts
#--------------------------------------------------------------------------
def construct(self, **net_attribute):
query_code = super().construct(**net_attribute)
return query_code
#--------------------------------------------------------------------------
# Method(s) to build 'Clause' parts
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Method(s) to build 'Binding' parts
#--------------------------------------------------------------------------
def bind_uri(self, net_name='nameless', node_reference='00'):
return super().bind_uri(net_name, node_reference)
#==============================================================================
# Development Test
#==============================================================================
if __name__ == '__main__':
print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net')
net = IndividualNet()
print(net)
print('\n' + ' -- test: construct')
construct_ctr = net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query')
test_query= f"""[...]
CONSTRUCT {{
{net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{net.propagate_relations()}
}}
WHERE {{
clause_1
clause_2
{net.identify_relations_for_propagation('?node1')}
{net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')}
}}
"""
print(test_query)
print('\n' + ' *** - ***')
\ No newline at end of file
...@@ -20,33 +20,33 @@ ...@@ -20,33 +20,33 @@
# -- Reference Table # -- Reference Table
NET_TYPE_TABLE = { # *** [type_name: type_id] *** # NET_TYPE_TABLE = { # *** [type_name: type_id] ***
'default': 'Net', # 'default': 'Net',
'atomClass': 'Atom_Class_Net', # 'atomClass': 'Atom_Class_Net',
'individual': 'Individual_Net', # 'individual': 'Individual_Net',
'atomProperty': 'Atom_Property_Net', # 'atomProperty': 'Atom_Property_Net',
'phenomena': 'Phenomena_Net' # 'phenomena': 'Phenomena_Net'
} # }
PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] *** # PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
'structure': 'hasStructure', # 'structure': 'hasStructure',
'class_name': 'hasClassName', # 'class_name': 'hasClassName',
'mother_class_net': 'hasMotherClassNet', # 'mother_class_net': 'hasMotherClassNet',
'individual_label': 'hasIndividualLabel', # 'individual_label': 'hasIndividualLabel',
'core_role': 'isCoreRoleLinked', # 'core_role': 'isCoreRoleLinked',
'target_argument_node': 'targetArgumentNode', # 'target_argument_node': 'targetArgumentNode',
'property_type': 'hasPropertyType', # 'property_type': 'hasPropertyType',
'property_name': 'hasPropertyName', # 'property_name': 'hasPropertyName',
'property_name01': 'hasPropertyName01', # 'property_name01': 'hasPropertyName01',
'property_name10': 'hasPropertyName10', # 'property_name10': 'hasPropertyName10',
'property_name12': 'hasPropertyName12', # 'property_name12': 'hasPropertyName12',
'phenomena_type': 'hasPhenomenaType', # 'phenomena_type': 'hasPhenomenaType',
'phenomena_ref': 'hasPhenomenaRef' # 'phenomena_ref': 'hasPhenomenaRef'
} # }
# -- Default Value(s) # -- Default Value(s)
...@@ -55,7 +55,7 @@ DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"' ...@@ -55,7 +55,7 @@ DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s) # -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n ' INDENT_STR = ' '
...@@ -67,23 +67,26 @@ class Net: ...@@ -67,23 +67,26 @@ class Net:
""" Class to generate SPARQL query parts related to semantic nets. """ Class to generate SPARQL query parts related to semantic nets.
""" """
predicate_table = { # *** [attribute_reference: attribute_predicate] ***
'base_node': 'coverBaseNode',
'structure': 'hasStructure'
}
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Constructor(s) # Constructor(s)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def __init__(self, type_name='default', num=''): def __init__(self, num=''):
# -- Net Signature # -- Net Signature
self.id = f'?{type_name}Net{num}' self.type_name = 'default'
self.type_name = type_name self.type_id = 'Net'
self.type_uri = f'net:{NET_TYPE_TABLE[type_name]}' self.id = f'?{self.type_name}Net{num}'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes # -- Net Attributes
self.base_node = f'{self.id}BaseNode' self.base_node = f'{self.id}BaseNode'
self.structure = f'{self.id}Structure' self.structure = f'{self.id}Structure'
self.class_name = f'{self.id}ClassName'
self.mother_class_net = f'{self.id}MotherClassNet'
self.individual_label = f'{self.id}IndividualLabel'
# -- Private elements (for relation propagation) # -- Private elements (for relation propagation)
self._in_relation_role = f'{self.id}InRelationRole' self._in_relation_role = f'{self.id}InRelationRole'
...@@ -96,43 +99,43 @@ class Net: ...@@ -96,43 +99,43 @@ class Net:
# Private data accessor(s) # Private data accessor(s)
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def __get_predicate(self, data_ref): def __get_predicate(self, attribute_reference):
property_name = PREDICATE_TABLE[f'{data_ref}'] predicate_reference = self.predicate_table[f'{attribute_reference}']
return f'net:{property_name}' return f'net:{predicate_reference}'
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts # Method(s) to build 'Construct' parts
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def __construct_attribute_triples(self, **net_attribute): def __define_attribute_triples(self, **net_attribute):
result_triples = "" query_code = ""
# -- construct triples with declared attributes
for attr_ref, attr_value in net_attribute.items():
predicate = self.__get_predicate(attr_ref)
result_triples += f"{self.id} {predicate} {attr_value}."
result_triples += f"{TRIPLE_ENDING_STR}"
# -- construct triples with default object for non-declared attributes # -- construct triples with default object for non-declared attributes
result_triples += f"# *** default values for attribute useless *** " for attr_ref in self.predicate_table.keys():
result_triples += f"{TRIPLE_ENDING_STR}"
for attr_ref in PREDICATE_TABLE.keys():
if attr_ref not in net_attribute.keys():
predicate = self.__get_predicate(attr_ref) predicate = self.__get_predicate(attr_ref)
result_triples += f"{self.id} {predicate} {DEFAULT_ATTRIBUTE_VALUE}."
result_triples += f"{TRIPLE_ENDING_STR}"
return result_triples if attr_ref in net_attribute.keys():
attr_value = net_attribute.get(attr_ref)
comment = ''
else:
attr_value = DEFAULT_ATTRIBUTE_VALUE
comment = ' # *** attribute useless ***'
query_code += f"{self.id} {predicate} {attr_value}.{comment}"
query_code += f"\n{INDENT_STR}"
def construct(self, base_node, **net_attribute): return query_code
def define_new_net(self, **net_attribute):
net_attribute.update({'structure': '?sentenceRef'})
return f""" return f"""
# -- New Net # -- New Net
{self.id} a {self.type_uri}. {self.id} a {self.type_uri}.
{self.id} net:coverBaseNode {base_node}. {self.__define_attribute_triples(**net_attribute)}"""
{self.__construct_attribute_triples(**net_attribute)}"""
def propagate_relations(self): def propagate_relations(self):
...@@ -144,11 +147,24 @@ class Net: ...@@ -144,11 +147,24 @@ class Net:
{self.id} {self._out_relation_role} {self._out_net}.""" {self.id} {self._out_relation_role} {self._out_net}."""
def construct(self, **net_attribute):
query_code = self.define_new_net(**net_attribute)
query_code += self.propagate_relations()
return query_code
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Method(s) to build 'Clause' parts # Method(s) to build 'Complement Clause' parts
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
def identify_structure(self):
return f"""
# -- Identify structure
?root a amr:AMR_Root.
?root amr:hasSentenceID ?sentenceRef.
"""
def identify_relations_for_propagation(self, base_node): def identify_relations_for_propagation(self, base_node):
return f""" return f"""
# -- Identify inbound relations linked to the base leaf (for propagation) # -- Identify inbound relations linked to the base leaf (for propagation)
...@@ -168,6 +184,11 @@ class Net: ...@@ -168,6 +184,11 @@ class Net:
}} }}
""" """
def complete_clauses_for_construction(self, base_node):
query_code = self.identify_structure()
query_code += self.identify_relations_for_propagation(base_node)
return query_code
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
...@@ -200,33 +221,22 @@ if __name__ == '__main__': ...@@ -200,33 +221,22 @@ if __name__ == '__main__':
print('\n' + ' *** Development Test ***') print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net') print('\n' + ' -- test: Atom Class Net')
atom_class_net = Net('atomClass') net = Net()
print(atom_class_net) print(net)
print('\n' + ' -- test: construct')
construct_ctr = atom_class_net.construct('?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query') print('\n' + ' -- test: update a test query')
test_query= f"""[...] test_query= f"""[...]
CONSTRUCT {{ CONSTRUCT {{
{atom_class_net.construct('?node1', {net.construct(base_node='?node1')}
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{atom_class_net.propagate_relations()}
}} }}
WHERE {{ WHERE {{
clause_1 clause_1
clause_2 clause_2
{atom_class_net.identify_relations_for_propagation('?node1')} {net.complete_clauses_for_construction('?node1')}
{atom_class_net.bind_uri('{{node1.concept_label}}', {net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')} '{{node1.variable_label}}')}
}} }}
""" """
......
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Net Query Builder
#------------------------------------------------------------------------------
# Class to generate SPARQL query parts related to semantic nets
#==============================================================================
#==============================================================================
# Importing required modules
#==============================================================================
# --
#==============================================================================
# Data Repository
#==============================================================================
# -- Reference Table
NET_TYPE_TABLE = { # *** [type_name: type_id] ***
'default': 'Net',
'atomClass': 'Atom_Class_Net',
'individual': 'Individual_Net',
'atomProperty': 'Atom_Property_Net',
'phenomena': 'Phenomena_Net'
}
PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
'structure': 'hasStructure',
'class_name': 'hasClassName',
'mother_class_net': 'hasMotherClassNet',
'individual_label': 'hasIndividualLabel',
'core_role': 'isCoreRoleLinked',
'target_argument_node': 'targetArgumentNode',
'property_type': 'hasPropertyType',
'property_name': 'hasPropertyName',
'property_name01': 'hasPropertyName01',
'property_name10': 'hasPropertyName10',
'property_name12': 'hasPropertyName12',
'phenomena_type': 'hasPhenomenaType',
'phenomena_ref': 'hasPhenomenaRef'
}
# -- Default Value(s)
DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n '
#==============================================================================
# Net Class
#==============================================================================
class OldNet:
""" Class to generate SPARQL query parts related to semantic nets.
"""
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, type_name='default', num=''):
# -- Net Signature
self.id = f'?{type_name}Net{num}'
self.type_name = type_name
self.type_uri = f'net:{NET_TYPE_TABLE[type_name]}'
# -- Net Attributes
self.base_node = f'{self.id}BaseNode'
self.structure = f'{self.id}Structure'
self.class_name = f'{self.id}ClassName'
self.mother_class_net = f'{self.id}MotherClassNet'
self.individual_label = f'{self.id}IndividualLabel'
# -- Private elements (for relation propagation)
self._in_relation_role = f'{self.id}InRelationRole'
self._in_net = f'{self.id}InNet'
self._out_relation_role = f'{self.id}OutRelationRole'
self._out_net = f'{self.id}OutNet'
#--------------------------------------------------------------------------
# Private data accessor(s)
#--------------------------------------------------------------------------
def __get_predicate(self, data_ref):
property_name = PREDICATE_TABLE[f'{data_ref}']
return f'net:{property_name}'
#--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts
#--------------------------------------------------------------------------
def __construct_attribute_triples(self, **net_attribute):
result_triples = ""
# -- construct triples with declared attributes
for attr_ref, attr_value in net_attribute.items():
predicate = self.__get_predicate(attr_ref)
result_triples += f"{self.id} {predicate} {attr_value}."
result_triples += f"{TRIPLE_ENDING_STR}"
# -- construct triples with default object for non-declared attributes
result_triples += f"# *** default values for attribute useless *** "
result_triples += f"{TRIPLE_ENDING_STR}"
for attr_ref in PREDICATE_TABLE.keys():
if attr_ref not in net_attribute.keys():
predicate = self.__get_predicate(attr_ref)
result_triples += f"{self.id} {predicate} {DEFAULT_ATTRIBUTE_VALUE}."
result_triples += f"{TRIPLE_ENDING_STR}"
return result_triples
def construct(self, base_node, **net_attribute):
return f"""
# -- New Net
{self.id} a {self.type_uri}.
{self.id} net:coverBaseNode {base_node}.
{self.__construct_attribute_triples(**net_attribute)}"""
def propagate_relations(self):
return f"""
# -- Propagation of relations (from nodes to nets)
{self._in_relation_role} a net:Relation.
{self._in_net} {self._in_relation_role} {self.id}.
{self._out_relation_role} a net:Relation.
{self.id} {self._out_relation_role} {self._out_net}."""
#--------------------------------------------------------------------------
# Method(s) to build 'Clause' parts
#--------------------------------------------------------------------------
def identify_relations_for_propagation(self, base_node):
return f"""
# -- Identify inbound relations linked to the base leaf (for propagation)
OPTIONAL {{
{self._in_net} a [rdfs:subClassOf* net:Net] ;
net:coverBaseNode ?inLeaf.
?inLeaf ?inRelationEdge {base_node}.
?inRelationEdge amr:hasAmrRole {self._in_relation_role}.
}}
# -- Identify outgoing relations linked to the base leaf (for propagation)
OPTIONAL {{
{self._out_net} a [rdfs:subClassOf* net:Net] ;
net:coverBaseNode ?outLeaf.
{base_node} ?outRelationEdge ?outLeaf.
?outRelationEdge amr:hasAmrRole {self._out_relation_role}.
}}
"""
#--------------------------------------------------------------------------
# Method(s) to build 'Binding' parts
#--------------------------------------------------------------------------
def bind_uri(self, net_name='nameless', node_reference='00'):
ref1 = f"{self.id}Ref1"
ref2 = f"{self.id}Ref2"
ref3 = f"{self.id}Ref3"
refNet = f"{net_name}RefNet"
refNode = f"{node_reference}RefNode"
return f"""
# -- New Net
BIND (REPLACE({net_name}, ' ', "") AS {refNet}).
BIND (REPLACE({node_reference}, ' ', "") AS {refNode}).
BIND (CONCAT(str(net:), '{self.type_name}') AS {ref1}).
BIND (CONCAT({ref1}, '_', {refNet}) AS {ref2}).
BIND (CONCAT({ref2}, '_', {refNode}) AS {ref3}).
BIND (uri({ref3}) AS {self.id})."""
#==============================================================================
# Development Test
#==============================================================================
if __name__ == '__main__':
print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net')
atom_class_net = Net('atomClass')
print(atom_class_net)
print('\n' + ' -- test: construct')
construct_ctr = atom_class_net.construct('?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query')
test_query= f"""[...]
CONSTRUCT {{
{atom_class_net.construct('?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{atom_class_net.propagate_relations()}
}}
WHERE {{
clause_1
clause_2
{atom_class_net.identify_relations_for_propagation('?node1')}
{atom_class_net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')}
}}
"""
print(test_query)
print('\n' + ' *** - ***')
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Net Query Builder
#------------------------------------------------------------------------------
# Class to generate SPARQL query parts related to semantic nets
#==============================================================================
#==============================================================================
# Importing required modules
#==============================================================================
from net import Net
#==============================================================================
# Data Repository
#==============================================================================
# -- Reference Table
# NET_TYPE_TABLE = { # *** [type_name: type_id] ***
# 'default': 'Net',
# 'atomClass': 'Atom_Class_Net',
# 'individual': 'Individual_Net',
# 'atomProperty': 'Atom_Property_Net',
# 'phenomena': 'Phenomena_Net'
# }
# PREDICATE_TABLE = { # *** [attribute_reference: attribute_predicate] ***
# 'structure': 'hasStructure',
# 'class_name': 'hasClassName',
# 'mother_class_net': 'hasMotherClassNet',
# 'individual_label': 'hasIndividualLabel',
# 'core_role': 'isCoreRoleLinked',
# 'target_argument_node': 'targetArgumentNode',
# 'property_type': 'hasPropertyType',
# 'property_name': 'hasPropertyName',
# 'property_name01': 'hasPropertyName01',
# 'property_name10': 'hasPropertyName10',
# 'property_name12': 'hasPropertyName12',
# 'phenomena_type': 'hasPhenomenaType',
# 'phenomena_ref': 'hasPhenomenaRef'
# }
# -- Default Value(s)
DEFAULT_ATTRIBUTE_VALUE = f'\"NA\"'
# -- Useful Constant(s)
TRIPLE_ENDING_STR = '\n '
#==============================================================================
# Net Class
#==============================================================================
class AtomClassNet(Net):
""" Class to generate SPARQL query parts related to semantic nets.
"""
predicate_table = Net.predicate_table
predicate_table.update({
'class_name': 'hasClassName'
})
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, num=''):
super().__init__(num)
# -- Net Signature
self.type_name = 'atomClass'
self.type_id = 'Atom_Class_Net'
self.id = f'?{self.type_name}Net{num}'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.class_name = f'{self.id}ClassName'
self.mother_class_net = f'{self.id}MotherClassNet'
self.individual_label = f'{self.id}IndividualLabel'
#--------------------------------------------------------------------------
# Private data accessor(s)
#--------------------------------------------------------------------------
# def __get_predicate(self, data_ref):
# property_name = PREDICATE_TABLE[f'{data_ref}']
# return f'net:{property_name}'
#--------------------------------------------------------------------------
# Method(s) to build 'Construct' parts
#--------------------------------------------------------------------------
def construct(self, **net_attribute):
query_code = super().construct(**net_attribute)
return query_code
#--------------------------------------------------------------------------
# Method(s) to build 'Clause' parts
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# Method(s) to build 'Binding' parts
#--------------------------------------------------------------------------
def bind_uri(self, net_name='nameless', node_reference='00'):
return super().bind_uri(net_name, node_reference)
#==============================================================================
# Development Test
#==============================================================================
if __name__ == '__main__':
print('\n' + ' *** Development Test ***')
print('\n' + ' -- test: Atom Class Net')
atom_class_net = AtomClassNet()
print(atom_class_net)
print('\n' + ' -- test: construct')
construct_ctr = atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')
print(construct_ctr)
print('\n' + ' -- test: update a test query')
test_query= f"""[...]
CONSTRUCT {{
{atom_class_net.construct(base_node='?node1',
structure='?structureRef',
class_name='?leaf1ConceptLabel')}
{atom_class_net.propagate_relations()}
}}
WHERE {{
clause_1
clause_2
{atom_class_net.identify_relations_for_propagation('?node1')}
{atom_class_net.bind_uri('{{node1.concept_label}}',
'{{node1.variable_label}}')}
}}
"""
print(test_query)
print('\n' + ' *** - ***')
\ No newline at end of file
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
----- CTS directory: ./structure/cts/ ----- CTS directory: ./structure/cts/
----- target frame directory: ./input/targetFrameStructure/ ----- target frame directory: ./input/targetFrameStructure/
----- input document directory: ./input/amrDocuments/ ----- input document directory: ./input/amrDocuments/
----- output directory: ./output/SolarSystemDev1-20221215/ ----- output directory: ./output/SolarSystemDev1-20221216/
----- sentence output directory: ./output/SolarSystemDev1-20221215/ ----- sentence output directory: ./output/SolarSystemDev1-20221216/
----- SHACL binary directory: ./lib/shacl-1.3.2/bin ----- SHACL binary directory: ./lib/shacl-1.3.2/bin
-- Config File Definition -- Config File Definition
----- schema file: ./structure/amr-rdf-schema.ttl ----- schema file: ./structure/amr-rdf-schema.ttl
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
----- frame ontology seed file: ./input/targetFrameStructure/base-ontology-seed.ttl ----- frame ontology seed file: ./input/targetFrameStructure/base-ontology-seed.ttl
-- Output -- Output
----- ontology namespace: https://tenet.tetras-libre.fr/base-ontology/ ----- ontology namespace: https://tenet.tetras-libre.fr/base-ontology/
----- output file: ./output/SolarSystemDev1-20221215/SolarSystemDev1.ttl ----- output file: ./output/SolarSystemDev1-20221216/SolarSystemDev1.ttl
*** - *** *** - ***
- INFO - -- Creating output target directory: ./output/SolarSystemDev1-20221215/ - INFO - -- Creating output target directory: ./output/SolarSystemDev1-20221216/
- DEBUG - -- Counting number of graph files (sentences) - DEBUG - -- Counting number of graph files (sentences)
- DEBUG - ----- Graph count: 1 - DEBUG - ----- Graph count: 1
- INFO - === Extraction Processing using New TENET Engine === - INFO - === Extraction Processing using New TENET Engine ===
...@@ -64,9 +64,9 @@ ...@@ -64,9 +64,9 @@
- DEBUG - ----- Sentence Loading - DEBUG - ----- Sentence Loading
- DEBUG - -------- ./input/amrDocuments/dev/solar-system-1/SSC-01-01.stog.amr.ttl (614) - DEBUG - -------- ./input/amrDocuments/dev/solar-system-1/SSC-01-01.stog.amr.ttl (614)
- DEBUG - --- Export work graph as turtle - DEBUG - --- Export work graph as turtle
- DEBUG - ----- Work graph file: ./output/SolarSystemDev1-20221215/SolarSystemDev1-1/SolarSystemDev1.ttl - DEBUG - ----- Work graph file: ./output/SolarSystemDev1-20221216/SolarSystemDev1-1/SolarSystemDev1.ttl
- DEBUG - --- Ending Structure Preparation - DEBUG - --- Ending Structure Preparation
- DEBUG - ----- Total Execution Time = 0:00:00.127085 - DEBUG - ----- Total Execution Time = 0:00:00.101997
- INFO - -- Loading Extraction Scheme (amr_scheme_1) - INFO - -- Loading Extraction Scheme (amr_scheme_1)
- DEBUG - ----- Step number: 3 - DEBUG - ----- Step number: 3
- INFO - -- Loading Extraction Rules (amr_ctr/*) - INFO - -- Loading Extraction Rules (amr_ctr/*)
...@@ -95,133 +95,133 @@ ...@@ -95,133 +95,133 @@
- DEBUG - --- Serializing graph to SolarSystemDev1_preprocessing - DEBUG - --- Serializing graph to SolarSystemDev1_preprocessing
- DEBUG - ----- step: preprocessing - DEBUG - ----- step: preprocessing
- DEBUG - ----- id: SolarSystemDev1 - DEBUG - ----- id: SolarSystemDev1
- DEBUG - ----- work_file: ./output/SolarSystemDev1-20221215/SolarSystemDev1-1/SolarSystemDev1_preprocessing.ttl - DEBUG - ----- work_file: ./output/SolarSystemDev1-20221216/SolarSystemDev1-1/SolarSystemDev1_preprocessing.ttl
- DEBUG - ----- base: http://SolarSystemDev1/preprocessing - DEBUG - ----- base: http://SolarSystemDev1/preprocessing
- INFO - ----- 212 triples extracted during preprocessing step - INFO - ----- 212 triples extracted during preprocessing step
- INFO - -- Applying extraction step: transduction - INFO - -- Applying extraction step: transduction
- INFO - --- Sequence: atomic-extraction-sequence - INFO - --- Sequence: atomic-extraction-sequence
- INFO - ----- create-atom-class-net: 75/75 new triples (901) - INFO - ----- create-atom-class-net: 20/20 new triples (846)
- DEBUG - ----- (refinement) refine-cover-node-1: 5 new triples (906) - DEBUG - ----- (refinement) refine-cover-node-1: 5 new triples (851)
- DEBUG - ----- (refinement) refine-cover-node-2: 5 new triples (911) - DEBUG - ----- (refinement) refine-cover-node-2: 5 new triples (856)
- INFO - ----- create-individual-net-1: 17/17 new triples (928) - INFO - ----- create-individual-net-1: 17/17 new triples (873)
- DEBUG - ----- (refinement) refine-cover-node-1: 1 new triples (929) - DEBUG - ----- (refinement) refine-cover-node-1: 1 new triples (874)
- INFO - ----- create-atom-property-net-1: 99/99 new triples (1028) - INFO - ----- create-atom-property-net-1: 99/99 new triples (973)
- DEBUG - ----- (refinement) refine-cover-node-1: 6 new triples (1034) - DEBUG - ----- (refinement) refine-cover-node-1: 6 new triples (979)
- INFO - ----- create-phenomena-net-1: 40/41 new triples (1074) - INFO - ----- create-phenomena-net-1: 40/41 new triples (1019)
- DEBUG - ----- (refinement) refine-cover-node-1: 2 new triples (1076) - DEBUG - ----- (refinement) refine-cover-node-1: 2 new triples (1021)
- INFO - --- Sequence: atomic-extraction-sequence - INFO - --- Sequence: atomic-extraction-sequence
- INFO - ----- create-atom-class-net: 1/89 new triples (1077) - INFO - ----- create-atom-class-net: 1/34 new triples (1022)
- DEBUG - ----- create-individual-net-1: 0/17 new triples (1077) - DEBUG - ----- create-individual-net-1: 0/17 new triples (1022)
- INFO - ----- create-atom-property-net-1: 1/106 new triples (1078) - INFO - ----- create-atom-property-net-1: 1/106 new triples (1023)
- DEBUG - ----- create-phenomena-net-1: 0/41 new triples (1078) - DEBUG - ----- create-phenomena-net-1: 0/41 new triples (1023)
- INFO - --- Sequence: phenomena-checking-sequence - INFO - --- Sequence: phenomena-checking-sequence
- INFO - ----- expand-and-conjunction-phenomena-net: 4/4 new triples (1082) - INFO - ----- expand-and-conjunction-phenomena-net: 4/4 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-1: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-1: 0/0 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-2: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-2: 0/0 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-3: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-3: 0/0 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-4: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-4: 0/0 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-5: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-5: 0/0 new triples (1027)
- DEBUG - ----- expand-degree-phenomena-net-6: 0/0 new triples (1082) - DEBUG - ----- expand-degree-phenomena-net-6: 0/0 new triples (1027)
- INFO - --- Sequence: composite-property-extraction-sequence - INFO - --- Sequence: composite-property-extraction-sequence
- DEBUG - ----- create-composite-class-net-from-property-1: 0/0 new triples (1082) - DEBUG - ----- create-composite-class-net-from-property-1: 0/0 new triples (1027)
- DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1082) - DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1027)
- INFO - --- Sequence: composite-class-extraction-sequence-1 - INFO - --- Sequence: composite-class-extraction-sequence-1
- INFO - ----- create-composite-class-net-from-property-1: 75/79 new triples (1157) - INFO - ----- create-composite-class-net-from-property-1: 75/79 new triples (1102)
- DEBUG - ----- (refinement) refine-cover-node-1: 12 new triples (1169) - DEBUG - ----- (refinement) refine-cover-node-1: 12 new triples (1114)
- DEBUG - ----- (refinement) refine-cover-node-2: 4 new triples (1173) - DEBUG - ----- (refinement) refine-cover-node-2: 4 new triples (1118)
- DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1118)
- DEBUG - ----- create-composite-class-net-from-property-3: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-property-3: 0/0 new triples (1118)
- INFO - --- Sequence: composite-class-extraction-sequence-2 - INFO - --- Sequence: composite-class-extraction-sequence-2
- DEBUG - ----- create-composite-class-net-from-phenomena-1: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-phenomena-1: 0/0 new triples (1118)
- DEBUG - ----- create-composite-class-net-from-phenomena-2: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-phenomena-2: 0/0 new triples (1118)
- DEBUG - ----- create-composite-class-net-from-phenomena-3: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-phenomena-3: 0/0 new triples (1118)
- DEBUG - ----- create-composite-class-net-from-phenomena-4: 0/0 new triples (1173) - DEBUG - ----- create-composite-class-net-from-phenomena-4: 0/0 new triples (1118)
- INFO - --- Sequence: phenomena-checking-sequence - INFO - --- Sequence: phenomena-checking-sequence
- INFO - ----- expand-and-conjunction-phenomena-net: 1/5 new triples (1174) - INFO - ----- expand-and-conjunction-phenomena-net: 1/5 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-1: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-1: 0/0 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-2: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-2: 0/0 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-3: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-3: 0/0 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-4: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-4: 0/0 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-5: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-5: 0/0 new triples (1119)
- DEBUG - ----- expand-degree-phenomena-net-6: 0/0 new triples (1174) - DEBUG - ----- expand-degree-phenomena-net-6: 0/0 new triples (1119)
- INFO - --- Sequence: composite-property-extraction-sequence - INFO - --- Sequence: composite-property-extraction-sequence
- DEBUG - ----- create-composite-class-net-from-property-1: 0/0 new triples (1174) - DEBUG - ----- create-composite-class-net-from-property-1: 0/0 new triples (1119)
- DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1174) - DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1119)
- INFO - --- Sequence: composite-class-extraction-sequence-1 - INFO - --- Sequence: composite-class-extraction-sequence-1
- INFO - ----- create-composite-class-net-from-property-1: 94/173 new triples (1268) - INFO - ----- create-composite-class-net-from-property-1: 94/173 new triples (1213)
- DEBUG - ----- (refinement) refine-cover-node-1: 15 new triples (1283) - DEBUG - ----- (refinement) refine-cover-node-1: 15 new triples (1228)
- DEBUG - ----- (refinement) refine-cover-node-2: 5 new triples (1288) - DEBUG - ----- (refinement) refine-cover-node-2: 5 new triples (1233)
- DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-property-2: 0/0 new triples (1233)
- DEBUG - ----- create-composite-class-net-from-property-3: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-property-3: 0/0 new triples (1233)
- INFO - --- Sequence: composite-class-extraction-sequence-2 - INFO - --- Sequence: composite-class-extraction-sequence-2
- DEBUG - ----- create-composite-class-net-from-phenomena-1: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-phenomena-1: 0/0 new triples (1233)
- DEBUG - ----- create-composite-class-net-from-phenomena-2: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-phenomena-2: 0/0 new triples (1233)
- DEBUG - ----- create-composite-class-net-from-phenomena-3: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-phenomena-3: 0/0 new triples (1233)
- DEBUG - ----- create-composite-class-net-from-phenomena-4: 0/0 new triples (1288) - DEBUG - ----- create-composite-class-net-from-phenomena-4: 0/0 new triples (1233)
- INFO - --- Sequence: restriction-adding-sequence - INFO - --- Sequence: restriction-adding-sequence
- DEBUG - ----- add-restriction-to-class-net-from-property-1: 0/0 new triples (1288) - DEBUG - ----- add-restriction-to-class-net-from-property-1: 0/0 new triples (1233)
- INFO - --- Sequence: classification-sequence - INFO - --- Sequence: classification-sequence
- INFO - ----- classify-net-from-core-1: 12/12 new triples (1300) - INFO - ----- classify-net-from-core-1: 12/12 new triples (1245)
- INFO - ----- classify-net-from-core-2: 1/9 new triples (1301) - INFO - ----- classify-net-from-core-2: 1/9 new triples (1246)
- DEBUG - ----- classify-net-from-core-3: 0/0 new triples (1301) - DEBUG - ----- classify-net-from-core-3: 0/0 new triples (1246)
- DEBUG - ----- classify-net-from-mod: 0/0 new triples (1301) - DEBUG - ----- classify-net-from-mod: 0/0 new triples (1246)
- DEBUG - ----- classify-net-from-part: 0/0 new triples (1301) - DEBUG - ----- classify-net-from-part: 0/0 new triples (1246)
- INFO - ----- classify-net-from-domain: 6/6 new triples (1307) - INFO - ----- classify-net-from-domain: 6/6 new triples (1252)
- DEBUG - ----- classify-net-from-degree-phenomena-1: 0/0 new triples (1307) - DEBUG - ----- classify-net-from-degree-phenomena-1: 0/0 new triples (1252)
- DEBUG - ----- classify-net-from-degree-phenomena-2: 0/0 new triples (1307) - DEBUG - ----- classify-net-from-degree-phenomena-2: 0/0 new triples (1252)
- DEBUG - ----- classify-net-from-degree-phenomena-3: 0/0 new triples (1307) - DEBUG - ----- classify-net-from-degree-phenomena-3: 0/0 new triples (1252)
- DEBUG - ----- propagate-individual-1: 0/1 new triples (1307) - DEBUG - ----- propagate-individual-1: 0/1 new triples (1252)
- INFO - ----- propagate-individual-2: 6/6 new triples (1313) - INFO - ----- propagate-individual-2: 6/6 new triples (1258)
- DEBUG - ----- reclassify-deprecated-net: 0/0 new triples (1313) - DEBUG - ----- reclassify-deprecated-net: 0/0 new triples (1258)
- DEBUG - --- Serializing graph to SolarSystemDev1_transduction - DEBUG - --- Serializing graph to SolarSystemDev1_transduction
- DEBUG - ----- step: transduction - DEBUG - ----- step: transduction
- DEBUG - ----- id: SolarSystemDev1 - DEBUG - ----- id: SolarSystemDev1
- DEBUG - ----- work_file: ./output/SolarSystemDev1-20221215/SolarSystemDev1-1/SolarSystemDev1_transduction.ttl - DEBUG - ----- work_file: ./output/SolarSystemDev1-20221216/SolarSystemDev1-1/SolarSystemDev1_transduction.ttl
- DEBUG - ----- base: http://SolarSystemDev1/transduction - DEBUG - ----- base: http://SolarSystemDev1/transduction
- INFO - ----- 487 triples extracted during transduction step - INFO - ----- 432 triples extracted during transduction step
- INFO - -- Applying extraction step: generation - INFO - -- Applying extraction step: generation
- INFO - --- Sequence: main-generation-sequence - INFO - --- Sequence: main-generation-sequence
- INFO - ----- compute-uri-for-owl-declaration-1: 14/14 new triples (1327) - INFO - ----- compute-uri-for-owl-declaration-1: 14/14 new triples (1272)
- INFO - ----- compute-uri-for-owl-declaration-2: 1/1 new triples (1328) - INFO - ----- compute-uri-for-owl-declaration-2: 1/1 new triples (1273)
- DEBUG - ----- compute-uri-for-owl-declaration-4: 0/0 new triples (1328) - DEBUG - ----- compute-uri-for-owl-declaration-4: 0/0 new triples (1273)
- INFO - ----- compute-uri-for-owl-declaration-5: 6/6 new triples (1334) - INFO - ----- compute-uri-for-owl-declaration-5: 6/6 new triples (1279)
- INFO - ----- compute-uri-for-owl-declaration-6: 6/6 new triples (1340) - INFO - ----- compute-uri-for-owl-declaration-6: 6/6 new triples (1285)
- INFO - ----- generate-atom-class: 12/12 new triples (1352) - INFO - ----- generate-atom-class: 12/12 new triples (1297)
- INFO - ----- classify-atom-class-1: 4/4 new triples (1356) - INFO - ----- classify-atom-class-1: 4/4 new triples (1301)
- INFO - ----- classify-atom-class-2: 1/1 new triples (1357) - INFO - ----- classify-atom-class-2: 1/1 new triples (1302)
- INFO - ----- generate-individual: 3/3 new triples (1360) - INFO - ----- generate-individual: 3/3 new triples (1305)
- INFO - ----- classify-individual: 6/6 new triples (1366) - INFO - ----- classify-individual: 6/6 new triples (1311)
- INFO - ----- generate-atom-property-1: 20/20 new triples (1386) - INFO - ----- generate-atom-property-1: 20/20 new triples (1331)
- INFO - ----- generate-atom-property-12: 12/20 new triples (1398) - INFO - ----- generate-atom-property-12: 12/20 new triples (1343)
- DEBUG - ----- generate-inverse-relation: 0/0 new triples (1398) - DEBUG - ----- generate-inverse-relation: 0/0 new triples (1343)
- INFO - ----- generate-composite-class: 38/38 new triples (1436) - INFO - ----- generate-composite-class: 38/38 new triples (1381)
- DEBUG - ----- add-restriction-to-class-1: 0/0 new triples (1436) - DEBUG - ----- add-restriction-to-class-1: 0/0 new triples (1381)
- DEBUG - ----- add-restriction-to-class-2: 0/0 new triples (1436) - DEBUG - ----- add-restriction-to-class-2: 0/0 new triples (1381)
- INFO - ----- add-restriction-to-class-3: 36/45 new triples (1472) - INFO - ----- add-restriction-to-class-3: 36/45 new triples (1417)
- DEBUG - ----- add-restriction-to-class-4: 0/0 new triples (1472) - DEBUG - ----- add-restriction-to-class-4: 0/0 new triples (1417)
- DEBUG - ----- add-restriction-to-class-5: 0/0 new triples (1472) - DEBUG - ----- add-restriction-to-class-5: 0/0 new triples (1417)
- DEBUG - ----- add-restriction-to-class-6: 0/0 new triples (1472) - DEBUG - ----- add-restriction-to-class-6: 0/0 new triples (1417)
- DEBUG - ----- generate-composite-property: 0/0 new triples (1472) - DEBUG - ----- generate-composite-property: 0/0 new triples (1417)
- DEBUG - --- Serializing graph to SolarSystemDev1_generation - DEBUG - --- Serializing graph to SolarSystemDev1_generation
- DEBUG - ----- step: generation - DEBUG - ----- step: generation
- DEBUG - ----- id: SolarSystemDev1 - DEBUG - ----- id: SolarSystemDev1
- DEBUG - ----- work_file: ./output/SolarSystemDev1-20221215/SolarSystemDev1-1/SolarSystemDev1_generation.ttl - DEBUG - ----- work_file: ./output/SolarSystemDev1-20221216/SolarSystemDev1-1/SolarSystemDev1_generation.ttl
- DEBUG - ----- base: http://SolarSystemDev1/generation - DEBUG - ----- base: http://SolarSystemDev1/generation
- INFO - ----- 159 triples extracted during generation step - INFO - ----- 159 triples extracted during generation step
- INFO - -- Result: file containing only the factoids - INFO - -- Result: file containing only the factoids
- DEBUG - --- Making factoid graph with the last step result - DEBUG - --- Making factoid graph with the last step result
- DEBUG - ----- Number of factoids: 176 - DEBUG - ----- Number of factoids: 176
- DEBUG - ----- Graph base: http://SolarSystemDev1/factoid - DEBUG - ----- Graph base: http://SolarSystemDev1/factoid
- DEBUG - --- Serializing graph to factoid file (./output/SolarSystemDev1-20221215/SolarSystemDev1-1/SolarSystemDev1_factoid.ttl) - DEBUG - --- Serializing graph to factoid file (./output/SolarSystemDev1-20221216/SolarSystemDev1-1/SolarSystemDev1_factoid.ttl)
- INFO - - INFO -
*** Execution Time *** *** Execution Time ***
----- Function: apply (lib.tenet_extraction) ----- Function: apply (lib.tenet_extraction)
----- Total Time: 0:00:07.567600 ----- Total Time: 0:00:06.370078
----- Process Time: 0:00:07.544648 ----- Process Time: 0:00:06.357116
*** - *** *** - ***
- INFO - === Final Ontology Generation === - INFO - === Final Ontology Generation ===
- INFO - -- Making complete factoid graph by merging sentence factoid graphs - INFO - -- Making complete factoid graph by merging sentence factoid graphs
- INFO - ----- Total factoid number: 176 - INFO - ----- Total factoid number: 176
- INFO - ----- Graph base: http://SolarSystemDev1/factoid - INFO - ----- Graph base: http://SolarSystemDev1/factoid
- INFO - -- Serializing graph to factoid file (./output/SolarSystemDev1-20221215/SolarSystemDev1_factoid.ttl) - INFO - -- Serializing graph to factoid file (./output/SolarSystemDev1-20221216/SolarSystemDev1_factoid.ttl)
- INFO - === Done === - INFO - === Done ===
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment