Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tenet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tetras MARS
tenet
Commits
002d116f
Commit
002d116f
authored
3 years ago
by
Aurélien Lamercerie
Browse files
Options
Downloads
Patches
Plain Diff
Generic CTS to generate atom classes and instances
parent
76f0fd21
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
config/transduction-schemes.ttl
+161
-281
161 additions, 281 deletions
config/transduction-schemes.ttl
frame/system-ontology.ttl
+15
-1
15 additions, 1 deletion
frame/system-ontology.ttl
prepare_work_data.py
+25
-20
25 additions, 20 deletions
prepare_work_data.py
with
202 additions
and
302 deletions
.gitignore
+
1
−
0
View file @
002d116f
...
@@ -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.
Click to expand it.
config/transduction-schemes.ttl
+
161
−
281
View file @
002d116f
This diff is collapsed.
Click to expand it.
frame/system-ontology.ttl
+
15
−
1
View file @
002d116f
...
@@ -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"
;
...
...
This diff is collapsed.
Click to expand it.
prepare_work_data.py
+
25
−
20
View file @
002d116f
...
@@ -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
,
ou
tput
_ref
,
output_file
):
def
run
(
corpus
,
s
ou
rce
_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
)
...
...
This diff is collapsed.
Click to expand it.
Aurélien Lamercerie
@alam
mentioned in issue
#8 (closed)
·
3 years ago
mentioned in issue
#8 (closed)
mentioned in issue #8
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment