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