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

Generic CTS to generate atom classes and instances

parent 76f0fd21
No related branches found
No related tags found
No related merge requests found
......@@ -7,3 +7,4 @@ corpus/ERTMS*
.project
*.ttl.tbc
output*.ttl
output/*
This diff is collapsed.
......@@ -30,13 +30,15 @@ sys:Entity
rdfs:label "entity"@en ;
rdfs:label "entité"@fr ;
rdfs:subClassOf sys:Structure ;
sys:is_class "sys:Entity" ;
sys:is_class "Entity" ;
.
sys:Event
rdf:type owl:Class ;
rdfs:label "Event"@en ;
rdfs:label "Evénèment"@fr ;
rdfs:subClassOf sys:Structure ;
sys:has_object_property "eventObjectProperty" ;
sys:is_class "Event" ;
.
sys:Feature
rdf:type owl:Class ;
......@@ -50,10 +52,13 @@ sys:State_Property
rdfs:label "Propriété d'état"@fr ;
rdfs:label "State Property"@en ;
rdfs:subClassOf sys:Structure ;
sys:has_object_property "statePropertyObjectProperty" ;
sys:is_class "State_Property" ;
.
sys:Structure
rdf:type owl:Class ;
rdfs:label "System Ontology Structure" ;
sys:has_frame_uri "https://unsel.tetras-libre.fr/tenet/frame/system-ontology/" ;
.
sys:Verb
rdf:type owl:Class ;
......@@ -150,6 +155,11 @@ sys:has_frame_base_uri
rdfs:subPropertyOf sys:seedProperty ;
sys:has_frame_base_uri "https://unsel.tetras-libre.fr/tenet/frame/system-ontology/" ;
.
sys:has_frame_uri
rdf:type rdf:Property ;
rdfs:label "has frame uri" ;
rdfs:subPropertyOf sys:structureProperty ;
.
sys:has_mother_class
rdf:type rdf:Property ;
rdfs:label "has mother class" ;
......@@ -223,6 +233,10 @@ sys:statePropertyObjectProperty
rdfs:label "state property object property" ;
rdfs:subPropertyOf sys:objectProperty ;
.
sys:structureProperty
rdf:type rdf:Property ;
rdfs:label "structure property" ;
.
sys:verbClassProperty
rdf:type rdf:Property ;
rdfs:label "verb property" ;
......
......@@ -24,16 +24,19 @@ CONFIG_DIR = "config/"
FRAME_DIR = "frame/"
CORPUS_DIR = "corpus/"
CTS_DIR = "cts/"
OUTPUT_DIR = "output/"
# Config Definition
TURTLE_SUFFIX = ".ttl"
ONTO_FILE = "-ontology" + TURTLE_SUFFIX
dash_file = "dash-data-shapes.ttl" # data from "http://datashapes.org/dash.ttl"
schema_file = "unl-rdf-schema.ttl"
semantic_net_file = "semantic-net.ttl"
cts_file = "transduction-schemes.ttl"
c_param_file = "config-parameters.ttl"
req_onto_file = "requirement-ontology.ttl"
sys_onto_file = "system-ontology.ttl"
f_param_file = "ontology-parameters.ttl"
# -- old --- req_onto_file = "requirement" + ONTO_FILE
# -- old --- sys_onto_file = "system" + ONTO_FILE
# -- old --- f_param_file = "ontology-parameters.ttl"
# Dev Tests
base_uri = "https://unsel.tetras-libre.fr/tenet/working"
......@@ -78,20 +81,20 @@ def load_config(work_graph):
print("----- Config Parameter Definition (" + str(len(work_graph)) + ")")
def load_frame(work_graph):
def load_frame(work_graph, target_system):
print("-- Frame Ontology Loading:")
file_ref = FRAME_DIR + req_onto_file
work_graph.parse(file_ref)
print("----- Requirement Frame Ontology (" + str(len(work_graph)) + ")")
# -- old --- file_ref = FRAME_DIR + req_onto_file
# -- old --- work_graph.parse(file_ref)
# -- old --- print("----- Requirement Frame Ontology (" + str(len(work_graph)) + ")")
file_ref = FRAME_DIR + sys_onto_file
file_ref = FRAME_DIR + target_system + ONTO_FILE
work_graph.parse(file_ref)
print("----- System Frame Ontology (" + str(len(work_graph)) + ")")
file_ref = FRAME_DIR + f_param_file
work_graph.parse(file_ref)
print("----- Ontology Parameters (" + str(len(work_graph)) + ")")
# -- old --- file_ref = FRAME_DIR + f_param_file
# -- old --- work_graph.parse(file_ref)
# -- old --- print("----- Ontology Parameters (" + str(len(work_graph)) + ")")
#def define_namespace(work_graph):
......@@ -169,14 +172,14 @@ def finalize_export_file(export_file):
# Main Function
#==============================================================================
def run(corpus, output_ref, output_file):
def run(corpus, source_ref, target_ref):
try:
print("[Tenet] Prepare work data from corpus " + corpus)
print("\n" + "- Graph Initialization")
work_graph = Graph()
load_config(work_graph)
load_frame(work_graph)
load_frame(work_graph, target_ref)
#define_namespace(work_graph)
print("\n" + "- Preparation of Transduction Process")
......@@ -186,7 +189,8 @@ def run(corpus, output_ref, output_file):
load_sentences(work_graph, corpus)
print("\n" + "- Result")
export_result(work_graph, output_ref, output_file)
output_file = OUTPUT_DIR + source_ref + TURTLE_SUFFIX
export_result(work_graph, source_ref, output_file)
finalize_export_file(output_file)
print()
......@@ -200,11 +204,12 @@ def run(corpus, output_ref, output_file):
#==============================================================================
if __name__ == '__main__':
#run(req_100, 'R100', 'output100.ttl')
#run(req_200, 'R200', 'output200.ttl')
run(req_300, 'R300b', 'output300b.ttl')
run(corpus_40, 'Corpus-CCTP-40c', 'outputCCTP40c.ttl')
#run(corpus_ERTMS, 'Corpus-ERTMS', 'outputERTMS.ttl')
target_ref = "system"
run(req_100, 'R100', target_ref)
run(req_200, 'R200', target_ref)
run(req_300, 'R300a', target_ref)
run(corpus_40, 'Corpus-CCTP-40c', target_ref)
run(corpus_ERTMS, 'Corpus-ERTMS', target_ref)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment