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
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*
.project
*.ttl.tbc
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
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"
;
...
...
This diff is collapsed.
Click to expand it.
prepare_work_data.py
+
25
−
20
View file @
002d116f
...
...
@@ -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
,
ou
tput
_ref
,
output_file
):
def
run
(
corpus
,
s
ou
rce
_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
)
...
...
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