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

New AMR Rule: transduction.odrl_rule_extractor

parent c4677489
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@ from scheme.amr_clara_rule.transduction.phenomena_mod_analyzer_1 import *
from scheme.amr_clara_rule.transduction.phenomena_or_analyzer_1 import *
from scheme.amr_clara_rule.transduction.phenomena_or_analyzer_2 import *
from scheme.amr_clara_rule.transduction.odrl_rule_extractor import *
from scheme.amr_clara_rule.odrl_generation.odrl_rule_generator import *
from scheme.amr_clara_rule import *
......@@ -157,7 +157,7 @@ def extract_atom_individual(graph):
# -- Search for patterns
_, pattern_set = __search_pattern(graph)
# -- Selection Analyzing (1)
# -- Pattern Analysis
rule_triple_list = []
for pattern in pattern_set:
......
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Rule to extract composite classes (rule 1)
#------------------------------------------------------------------------------
# Net Expansion AMR rule to extract composite classes
# Rule: property(arg0:class, arg1:class) => compositeClass
#==============================================================================
from rdflib import Graph
import transduction
from transduction import net
from transduction.query_builder import generate_select_query
from transduction.naming_computer import define_composite_naming_1, define_restriction_naming
#==============================================================================
# Pattern Search: modality phenomena
#==============================================================================
PHENOMENA_TYPE_RELATION = 'net:hasPhenomenaType'
POLARITY_RELATION = 'amr:role_polarity'
MODALITY_TABLE = [('permission', 'amr:phenomena_modality_possible'),
('obligation', 'amr:phenomena_modality_obligation'),
('prohibition', 'amr:phenomena_modality_prohibition')]
def __get_query_code(graph, phenomena_uri, arg_relation):
select_data_list = ['?phenomena_net', '?action_net']
clause_list = [f'?phenomena_net a [rdfs:subClassOf* net:Phenomena_Net].',
f'?phenomena_net {PHENOMENA_TYPE_RELATION} {phenomena_uri}.',
f'FILTER NOT EXISTS {{ ?phenomena_net a net:Deprecated_Net. }}',
f'?phenomena_net {arg_relation} ?action_net.']
return generate_select_query(graph, select_data_list, clause_list)
def __search_pattern(graph, phenomena_uri):
query_code = ''
result_set = []
for arg_relation in ['amr:role_arg1', 'amr:role_arg2']:
query_code = __get_query_code(graph, phenomena_uri, arg_relation)
result_set += graph.query(query_code)
return query_code, result_set
#==============================================================================
# Useful Computation Method(s)
#==============================================================================
def __define_naming(rule_relation):
return f'{rule_relation}'
def __filter_relation(relation_list):
result_list = []
for relation in relation_list:
check = True
(s, p, o) = relation
if s == o: check = False
if check: result_list.append(relation)
return result_list
def __propagate_relation(target_net, base_net):
# -- target_net.input_relation_list = base_net.input_relation_list
out_relation_list = __filter_relation(base_net.output_relation_list)
target_net.output_relation_list = out_relation_list
#==============================================================================
# Construct Method(s)
#==============================================================================
def __construct_rule_net(graph, rule_relation, phenomena_net, action_net):
# -- Net Composition
rule_net = net.RuleNet(graph)
rule_net.compose(phenomena_net, action_net)
# -- Data Computation
rule_net.rule_relation_name = rule_relation
rule_net.rule_action_net = action_net
# -- Relation Propagation
# None
# -- Net Naming
rule_net.naming = __define_naming(rule_relation)
# -- Finalization
rule_net.finalize()
triple_definition = rule_net.generate_triple_definition()
return rule_net, triple_definition
#==============================================================================
# Main Method
#==============================================================================
def extract_odrl_rule(graph):
# -- Rule Initialization
rule_label = 'extract ODRL rules'
rule_triple_list = []
for (rule_relation, phenomena_uri) in MODALITY_TABLE:
# -- Search for patterns
_, pattern_set = __search_pattern(graph, phenomena_uri)
# -- Pattern Analysis
for pattern in pattern_set:
phenomena_net = net.PhenomenaNet(graph, uri=pattern.phenomena_net)
action_net = net.ActionNet(graph, uri=pattern.action_net)
# -- New Net Construction
_, triple_list = __construct_rule_net(
graph, rule_relation, phenomena_net, action_net)
rule_triple_list += triple_list
return rule_label, rule_triple_list
\ No newline at end of file
......@@ -191,6 +191,10 @@ composite_class_extraction_sequence = ['composite class extraction sequence',
rule.extract_composite_class_1,
rule.extract_composite_class_2]
odrl_extraction_sequence = ['ODRL extraction sequence',
# rule.extract_odrl_action,
rule.extract_odrl_rule]
# # ---------------------------------------------
# # ODRL Generation
......@@ -216,15 +220,7 @@ scheme = {
phenomena_analyze_sequence_1,
phenomena_analyze_sequence_2,
composite_class_extraction_sequence,
],
# 'transduction': [transduction_refinement_sequence,
# phenomena_application_and_sequence,
# phenomena_checking_sequence,
# composite_property_extraction_sequence,
# composite_class_extraction_sequence_2,
# restriction_adding_sequence,
# classification_sequence],
odrl_extraction_sequence],
'generation': [default_refinement_sequence,
odrl_rule_generation_sequence]
......
......@@ -388,7 +388,7 @@ ns1:Role rdf:type owl:Class ;
### https://amr.tetras-libre.fr/rdf/schema#phenomena_modality_possible
:phenomena_modality_possible rdf:type owl:Class ;
rdfs:subClassOf :phenomena_modality ;
:hasConceptLink "possible-01", "permit-01", "likely-01", "grant-01" ;
:hasConceptLink "possible-01", "permit-01", "likely-01", "grant-01", "allow-01" ;
:label "possible-modality" .
......
......@@ -19,12 +19,6 @@ net:abstractionClass rdf:type owl:AnnotationProperty ;
rdfs:subPropertyOf net:objectValue .
### https://tenet.tetras-libre.fr/semantic-net#atomOf
net:atomOf rdf:type owl:AnnotationProperty ;
rdfs:label "atom of" ;
rdfs:subPropertyOf net:typeProperty .
### https://tenet.tetras-libre.fr/semantic-net#atomType
net:atomType rdf:type owl:AnnotationProperty ;
rdfs:label "atom type" ;
......@@ -191,24 +185,12 @@ net:has_value rdf:type owl:AnnotationProperty ;
rdfs:subPropertyOf net:netProperty .
### https://tenet.tetras-libre.fr/semantic-net#listBy
net:listBy rdf:type owl:AnnotationProperty ;
rdfs:label "list by" ;
rdfs:subPropertyOf net:typeProperty .
### https://tenet.tetras-libre.fr/semantic-net#listGuiding
net:listGuiding rdf:type owl:AnnotationProperty ;
rdfs:label "Guiding connector of a list (or, and)" ;
rdfs:subPropertyOf net:objectValue .
### https://tenet.tetras-libre.fr/semantic-net#listOf
net:listOf rdf:type owl:AnnotationProperty ;
rdfs:label "list of" ;
rdfs:subPropertyOf net:typeProperty .
### https://tenet.tetras-libre.fr/semantic-net#modCat1
net:modCat1 rdf:type owl:AnnotationProperty ;
rdfs:label "Modality Category (level 1)" ;
......@@ -243,23 +225,12 @@ net:objectValue rdf:type owl:AnnotationProperty ;
rdfs:subPropertyOf net:objectProperty .
### https://tenet.tetras-libre.fr/semantic-net#relationOf
net:relationOf rdf:type owl:AnnotationProperty ;
rdfs:label "relation of" ;
rdfs:subPropertyOf net:typeProperty .
### https://tenet.tetras-libre.fr/semantic-net#type
net:type rdf:type owl:AnnotationProperty ;
rdfs:label "type "@fr ;
rdfs:subPropertyOf net:netProperty .
### https://tenet.tetras-libre.fr/semantic-net#typeProperty
net:typeProperty rdf:type owl:AnnotationProperty ;
rdfs:label "type property" .
### https://tenet.tetras-libre.fr/semantic-net#verbClass
net:verbClass rdf:type owl:AnnotationProperty ;
rdfs:label "verb class" ;
......
......@@ -3,8 +3,8 @@
=== Process Initialization ===
- INFO - -- Process Setting
- INFO - ----- Corpus source: /home/lamenji/Workspace/Tetras/tenet/tests/input/amrDocuments/dev/asail_odrl_sentences/s01.stog.amr.ttl (amr)
- INFO - ----- Base output dir: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/aos01_factoid.ttl
- INFO - ----- technical dir path: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/
- INFO - ----- Base output dir: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/aos01_factoid.ttl
- INFO - ----- technical dir path: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/
- INFO - ----- Ontology target (id): https://tenet.tetras-libre.fr/demo/clara/01/
- INFO - ----- Current path: /home/lamenji/Workspace/Tetras/tenet/tenet
- DEBUG - ----- Config file: /home/lamenji/Workspace/Tetras/tenet/tenet/config.xml
......@@ -26,10 +26,10 @@
----- CTS directory: ./scheme/
----- target frame directory: ./../input/targetFrameStructure/
----- input document directory:
----- base output dir: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/aos01_factoid.ttl
----- output directory: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/aos01_factoid.ttltenet.tetras-libre.fr_demo_clara_01-20230411/
----- sentence output directory: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/
----- technical dir path: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/
----- base output dir: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/aos01_factoid.ttl
----- output directory: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/aos01_factoid.ttltenet.tetras-libre.fr_demo_clara_01-20230412/
----- sentence output directory: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/
----- technical dir path: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/
-- Config File Definition
----- schema file: ./structure/amr-rdf-schema.ttl
----- semantic net file: ./structure/odrl-snet-schema.ttl
......@@ -47,23 +47,23 @@
----- frame ontology seed file: ./../input/targetFrameStructure/base-ontology-seed.ttl
-- Output
----- ontology namespace: https://tenet.tetras-libre.fr/base-ontology/
----- output file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01.ttl
----- output file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01.ttl
*** - ***
- INFO -
=== Extraction Processing ===
- INFO - -- Work Structure Preparation
- DEBUG - --- Graph Initialization
- DEBUG - ----- Configuration Loading
- DEBUG - -------- RDF Schema (315)
- DEBUG - -------- Semantic Net Definition (475)
- DEBUG - -------- Config Parameter Definition (509)
- DEBUG - -------- RDF Schema (316)
- DEBUG - -------- Semantic Net Definition (462)
- DEBUG - -------- Config Parameter Definition (496)
- DEBUG - ----- Frame Ontology Loading
- DEBUG - -------- Base Ontology produced as output (539)
- DEBUG - -------- Base Ontology produced as output (526)
- DEBUG - --- Source Data Import
- DEBUG - ----- Sentence Loading
- DEBUG - -------- /home/lamenji/Workspace/Tetras/tenet/tests/input/amrDocuments/dev/asail_odrl_sentences/s01.stog.amr.ttl (556)
- DEBUG - -------- /home/lamenji/Workspace/Tetras/tenet/tests/input/amrDocuments/dev/asail_odrl_sentences/s01.stog.amr.ttl (543)
- DEBUG - --- Export work graph as turtle
- DEBUG - ----- Work graph file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01.ttl
- DEBUG - ----- Work graph file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01.ttl
- INFO - ----- Sentence (id): document-01
- INFO - ----- Sentence (text): Movie9898 can be used.
- INFO - -- Loading Extraction Scheme (amr_scheme_clara_1)
......@@ -72,80 +72,81 @@
- DEBUG - ----- Total rule number: 87
- INFO - -- Applying extraction step: preprocessing
- INFO - --- *** November Transduction *** Sequence: amrld-correcting-sequence
- DEBUG - ----- fix-amr-bug-about-system-solar-planet: 0/0 new triple (556, 0:00:00.036256)
- DEBUG - ----- fix-amr-bug-about-system-solar-planet: 0/0 new triple (543, 0:00:00.028270)
- INFO - --- *** November Transduction *** Sequence: amr-reification-sequence
- INFO - ----- reclassify-concept-1: 5/5 new triples (561, 0:00:00.138418)
- DEBUG - ----- reclassify-concept-2: 0/0 new triple (561, 0:00:00.089553)
- INFO - ----- reclassify-concept-3: 4/4 new triples (565, 0:00:00.064027)
- INFO - ----- reclassify-concept-4: 4/4 new triples (569, 0:00:00.085822)
- DEBUG - ----- reclassify-concept-5: 0/0 new triple (569, 0:00:00.064385)
- DEBUG - ----- reify-roles-as-concept: 0/0 new triple (569, 0:00:00.163300)
- INFO - ----- reclassify-existing-variable: 13/13 new triples (582, 0:00:00.041098)
- DEBUG - ----- add-new-variable-for-reified-concept: 0/0 new triple (582, 0:00:00.074518)
- INFO - ----- add-amr-leaf-for-reclassified-concept: 9/9 new triples (591, 0:00:00.044130)
- DEBUG - ----- add-amr-leaf-for-reified-concept: 0/0 new triple (591, 0:00:00.049568)
- INFO - ----- add-amr-edge-for-core-relation: 6/6 new triples (597, 0:00:00.127213)
- DEBUG - ----- add-amr-edge-for-reified-concept: 0/0 new triple (597, 0:00:00.104635)
- INFO - ----- add-amr-edge-for-name-relation: 5/5 new triples (602, 0:00:00.097994)
- DEBUG - ----- add-value-for-quant-relation: 0/0 new triple (602, 0:00:00.101918)
- DEBUG - ----- add-amr-edge-for-polarity-relation: 0/0 new triple (602, 0:00:00.102668)
- INFO - ----- update-amr-edge-role-1: 3/3 new triples (605, 0:00:00.037165)
- INFO - ----- add-amr-root: 5/5 new triples (610, 0:00:00.034615)
- INFO - ----- reclassify-concept-1: 5/5 new triples (548, 0:00:00.104339)
- DEBUG - ----- reclassify-concept-2: 0/0 new triple (548, 0:00:00.158565)
- INFO - ----- reclassify-concept-3: 4/4 new triples (552, 0:00:00.045084)
- INFO - ----- reclassify-concept-4: 4/4 new triples (556, 0:00:00.064150)
- DEBUG - ----- reclassify-concept-5: 0/0 new triple (556, 0:00:00.053422)
- DEBUG - ----- reify-roles-as-concept: 0/0 new triple (556, 0:00:00.044123)
- INFO - ----- reclassify-existing-variable: 13/13 new triples (569, 0:00:00.035977)
- DEBUG - ----- add-new-variable-for-reified-concept: 0/0 new triple (569, 0:00:00.055366)
- INFO - ----- add-amr-leaf-for-reclassified-concept: 9/9 new triples (578, 0:00:00.036535)
- DEBUG - ----- add-amr-leaf-for-reified-concept: 0/0 new triple (578, 0:00:00.030991)
- INFO - ----- add-amr-edge-for-core-relation: 6/6 new triples (584, 0:00:00.095660)
- DEBUG - ----- add-amr-edge-for-reified-concept: 0/0 new triple (584, 0:00:00.077738)
- INFO - ----- add-amr-edge-for-name-relation: 5/5 new triples (589, 0:00:00.076647)
- DEBUG - ----- add-value-for-quant-relation: 0/0 new triple (589, 0:00:00.076118)
- DEBUG - ----- add-amr-edge-for-polarity-relation: 0/0 new triple (589, 0:00:00.086418)
- INFO - ----- update-amr-edge-role-1: 3/3 new triples (592, 0:00:00.032250)
- INFO - ----- add-amr-root: 5/5 new triples (597, 0:00:00.025676)
- DEBUG - --- Serializing graph to tenet.tetras-libre.fr_demo_clara_01_preprocessing
- DEBUG - ----- step: preprocessing
- DEBUG - ----- id: https://tenet.tetras-libre.fr/demo/clara/01/
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_preprocessing.ttl
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_preprocessing.ttl
- DEBUG - ----- base: http://https://tenet.tetras-libre.fr/demo/clara/01//preprocessing
- INFO - ----- 54 triples extracted during preprocessing step
- INFO - -- Applying extraction step: transduction
- INFO - --- *** February Transduction *** Sequence: atomic extraction sequence
- INFO - ----- extract atom classes: 6/6 new triples (616, 0:00:00.049375)
- INFO - ----- extract atom individuals: 7/7 new triples (623, 0:00:00.058985)
- INFO - ----- extract atomic properties: 12/12 new triples (635, 0:00:00.056138)
- INFO - ----- extract atom values: 4/4 new triples (639, 0:00:00.044082)
- INFO - ----- extract atom phenomena: 7/7 new triples (646, 0:00:00.037112)
- INFO - ----- propagate atom relations: 4/12 new triples (650, 0:00:00.141900)
- INFO - ----- extract atom classes: 6/6 new triples (603, 0:00:00.043952)
- INFO - ----- extract atom individuals: 7/7 new triples (610, 0:00:00.043940)
- INFO - ----- extract atomic properties: 12/12 new triples (622, 0:00:00.051127)
- INFO - ----- extract atom values: 4/4 new triples (626, 0:00:00.027869)
- INFO - ----- extract atom phenomena: 7/7 new triples (633, 0:00:00.040272)
- INFO - ----- propagate atom relations: 4/12 new triples (637, 0:00:00.165620)
- INFO - --- *** February Transduction *** Sequence: phenomena analyze sequence (1)
- DEBUG - ----- analyze "polarity" phenomena: 0/0 new triple (650, 0:00:00.010470)
- DEBUG - ----- analyze modifier phenomena (mod): 0/0 new triple (650, 0:00:00.012524)
- DEBUG - ----- analyze "polarity" phenomena: 0/0 new triple (637, 0:00:00.009180)
- DEBUG - ----- analyze modifier phenomena (mod): 0/0 new triple (637, 0:00:00.010339)
- INFO - --- *** February Transduction *** Sequence: phenomena analyze sequence (2)
- DEBUG - ----- analyze "or" phenomena (1): 0/0 new triple (650, 0:00:00.013205)
- DEBUG - ----- analyze "or" phenomena (2): 0/0 new triple (650, 0:00:00.013459)
- DEBUG - ----- analyze "or" phenomena (1): 0/0 new triple (637, 0:00:00.011306)
- DEBUG - ----- analyze "or" phenomena (2): 0/0 new triple (637, 0:00:00.012883)
- INFO - --- *** February Transduction *** Sequence: composite class extraction sequence
- DEBUG - ----- extract composite classes (1): 0/0 new triple (650, 0:00:00.021303)
- DEBUG - ----- extract composite classes (2): 0/0 new triple (650, 0:00:00.018889)
- DEBUG - ----- extract composite classes (1): 0/0 new triple (637, 0:00:00.024933)
- DEBUG - ----- extract composite classes (2): 0/0 new triple (637, 0:00:00.020872)
- INFO - --- *** February Transduction *** Sequence: ODRL extraction sequence
- DEBUG - ----- extract ODRL rules: 0/0 new triple (637, 0:00:00.066762)
- DEBUG - --- Serializing graph to tenet.tetras-libre.fr_demo_clara_01_transduction
- DEBUG - ----- step: transduction
- DEBUG - ----- id: https://tenet.tetras-libre.fr/demo/clara/01/
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_transduction.ttl
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_transduction.ttl
- DEBUG - ----- base: http://https://tenet.tetras-libre.fr/demo/clara/01//transduction
- INFO - ----- 40 triples extracted during transduction step
- INFO - -- Applying extraction step: generation
- INFO - --- *** February Transduction *** Sequence: ODRL Rule Generation Sequence
- INFO - ----- generate ODRL rule: 1/1 new triple (651, 0:00:00.008208)
- DEBUG - ----- generate ODRL rule: 0/0 new triple (637, 0:00:00.008132)
- DEBUG - --- Serializing graph to tenet.tetras-libre.fr_demo_clara_01_generation
- DEBUG - ----- step: generation
- DEBUG - ----- id: https://tenet.tetras-libre.fr/demo/clara/01/
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_generation.ttl
- DEBUG - ----- work_file: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_generation.ttl
- DEBUG - ----- base: http://https://tenet.tetras-libre.fr/demo/clara/01//generation
- INFO - ----- 1 triples extracted during generation step
- DEBUG - --- Serializing graph to factoid file (/home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_factoid.ttl)
- DEBUG - ----- Number of factoids: 1
- INFO - ----- 0 triples extracted during generation step
- DEBUG - --- Serializing graph to factoid file (/home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/technical-data/tenet.tetras-libre.fr_demo_clara_01-0/tenet.tetras-libre.fr_demo_clara_01_factoid.ttl)
- DEBUG - ----- Number of factoids: 0
- DEBUG - ----- Graph base: http://https://tenet.tetras-libre.fr/demo/clara/01//factoid
- INFO -
=== Final Ontology Generation ===
- INFO - -- Making complete factoid graph by merging the result factoids
- INFO - ----- Total factoid number: 1
- INFO - ----- Total factoid number: 0
- INFO - -- Serializing graph to factoid string
- INFO - ----- Graph base: http://https://tenet.tetras-libre.fr/demo/clara/01//factoid
- INFO - -- Serializing graph to factoid file
- INFO - ----- Ontology Turtle File: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230411/aos01_factoid.ttl
- INFO - ----- Ontology Turtle File: /home/lamenji/Workspace/Tetras/tenet/tests/output/aos01-20230412/aos01_factoid.ttl
- INFO -
=== Done ===
- INFO -
*** Execution Time ***
----- Function: create_ontology_from_amrld_file (tenet.main)
----- Total Time: 0:00:02.351338
----- Process Time: 0:00:02.303288
----- Total Time: 0:00:02.039175
----- Process Time: 0:00:01.996954
*** - ***
- DEBUG - handle_close[88d346bad84911ed9c6914abc581ea52]({'header': {'msg_id': 'e2e4aee1-6cb9e7de392b41ee961b7195_10499_244', 'msg_type': 'comm_close', 'username': 'lamenji', 'session': 'e2e4aee1-6cb9e7de392b41ee961b7195', 'date': datetime.datetime(2023, 4, 11, 15, 30, 50, 117111, tzinfo=tzutc()), 'version': '5.3'}, 'msg_id': 'e2e4aee1-6cb9e7de392b41ee961b7195_10499_244', 'msg_type': 'comm_close', 'parent_header': {}, 'metadata': {}, 'content': {'comm_id': '88d346bad84911ed9c6914abc581ea52', 'data': {}}, 'buffers': []})
......@@ -21,3 +21,4 @@ from transduction.net.restriction_net import RestrictionNet
from transduction.net.axiom_net import AxiomNet
from transduction.net.rule_net import RuleNet
from transduction.net.action_net import ActionNet
#!/usr/bin/python3.10
# -*-coding:Utf-8 -*
#==============================================================================
# TENET: Class Net
#------------------------------------------------------------------------------
# Class to handle semantic nets
#==============================================================================
from transduction.net import Net
from transduction.rdfterm_computer import produce_uriref, produce_literal
#==============================================================================
# Net Class
#==============================================================================
class ActionNet(Net):
""" Class to handle semantic net.
"""
#--------------------------------------------------------------------------
# Constructor(s)
#--------------------------------------------------------------------------
def __init__(self, support_graph, uri=None):
# -- Parent init
super().__init__(support_graph, uri)
# -- Net Type
self.type_name = 'action'
self.type_id = 'Action_Net'
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.attr_list += ['action_name', 'target_net']
self._action_name = None
self._target_net = None
#--------------------------------------------------------------------------
# Accessors for Net Attributes
#--------------------------------------------------------------------------
@property
def action_name(self):
if self._action_name is None:
self._action_name = self.get_value_list_from_graph('action_name')
return self._action_name
@action_name.setter
def action_name(self, new_value):
self._action_name = self.set_attribute_value_list(new_value, produce_literal)
@property
def target_net(self):
if self._target_net is None:
self._target_net = self.get_value_list_from_graph('target_net')
return self._target_net
@target_net.setter
def target_net(self, new_value):
self._target_net = self.set_attribute_value_list(new_value, produce_uriref)
......@@ -34,9 +34,9 @@ class RuleNet(Net):
self.type_uri = f'net:{self.type_id}'
# -- Net Attributes
self.attr_list += ['rule_name', 'rule_uri']
self._rule_name = None
self._rule_uri = None
self.attr_list += ['rule_relation_name', 'rule_action_net']
self._rule_relation_name = None
self._rule_action_net = None
#--------------------------------------------------------------------------
......@@ -44,22 +44,22 @@ class RuleNet(Net):
#--------------------------------------------------------------------------
@property
def rule_name(self):
if self._rule_name is None:
self._rule_name = self.get_value_list_from_graph('rule_name')
return self._rule_name
def rule_relation_name(self):
if self._rule_relation_name is None:
self._rule_relation_name = self.get_value_list_from_graph('rule_relation_name')
return self._rule_relation_name
@rule_name.setter
def rule_name(self, new_value):
self._rule_name = self.set_attribute_value_list(new_value, produce_literal)
@rule_relation_name.setter
def rule_relation_name(self, new_value):
self._rule_relation_name = self.set_attribute_value_list(new_value, produce_literal)
@property
def rule_uri(self):
if self._rule_uri is None:
self._rule_uri = self.get_value_list_from_graph('rule_uri')
return self._rule_uri
@rule_uri.setter
def rule_uri(self, new_value):
self._rule_uri = self.set_attribute_value_list(new_value, produce_uriref)
def rule_action_net(self):
if self._rule_action_net is None:
self._rule_action_net = self.get_value_list_from_graph('rule_action_net')
return self._rule_action_net
@rule_action_net.setter
def rule_action_net(self, new_value):
self._rule_action_net = self.set_attribute_value_list(new_value, produce_uriref)
......@@ -75,6 +75,19 @@ class SemanticNetReferenceHandle:
'axiom_uri': 'hasAxiomURI',
'axiom_net_argument': 'hasNetArgument',
# Action Net
'action_name': 'hasActionName',
'target_net': 'hasTargetNet',
# Rule Net
'rule_relation_name': 'hasRuleRelationName',
'rule_action_net': 'hasRuleActionURI',
# Action Net
'axiom_name': 'hasAxiomName',
'axiom_uri': 'hasAxiomURI',
'axiom_net_argument': 'hasNetArgument',
# URI for OWL declaration
'class_uri': 'hasClassURI',
'property_uri': 'hasPropertyURI',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment