Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Macao Legacy
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
MACAO
Macao Legacy
Commits
befe1e22
Commit
befe1e22
authored
Jul 29, 2024
by
Eliott Sammier
Browse files
Options
Downloads
Patches
Plain Diff
Adapt module/subsection parsing to Macao3
parent
852c7d08
No related branches found
No related tags found
1 merge request
!1
Main
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tetras_extraction/result/macao_3/macao_content.ttl
+175
-10
175 additions, 10 deletions
tetras_extraction/result/macao_3/macao_content.ttl
tetras_extraction/script/src/extract.py
+16
-4
16 additions, 4 deletions
tetras_extraction/script/src/extract.py
with
191 additions
and
14 deletions
tetras_extraction/result/macao_3/macao_content.ttl
+
175
−
10
View file @
befe1e22
...
@@ -7,46 +7,211 @@
...
@@ -7,46 +7,211 @@
rdfs:
label
"macao-content"
;
rdfs:
label
"macao-content"
;
owl:
imports
<http://www.semanticweb.org/eliott/ontologies/2024/4/macao>
.
owl:
imports
<http://www.semanticweb.org/eliott/ontologies/2024/4/macao>
.
:
seq100407
a
:
SousPartie,
:
doc171337
a
owl:
NamedIndividual
;
rdfs:
label
"Le prétérit"
;
:
id
"doc171337"
;
:
titre
"Le prétérit"
.
:
doc266709
a
owl:
NamedIndividual
;
rdfs:
label
"La voyelle"
;
:
id
"doc266709"
;
:
titre
"La voyelle"
.
:
doc28886
a
owl:
NamedIndividual
;
rdfs:
label
"Le present perfect"
;
:
id
"doc28886"
;
:
titre
"Le present perfect"
.
:
doc713286
a
owl:
NamedIndividual
;
rdfs:
label
"Les consonnes"
;
:
id
"doc713286"
;
:
titre
"Les consonnes"
.
:
doc972802
a
owl:
NamedIndividual
;
rdfs:
label
"Le phonème"
;
:
id
"doc972802"
;
:
titre
"Le phonème"
.
:
act153876
a
:
SousPartie,
owl:
NamedIndividual
;
owl:
NamedIndividual
;
rdfs:
label
"Assimilation"
;
rdfs:
label
"Se servir de données grammaticales et phonologiques"
;
:
__protege_display_name
"01 | seq100407 | Assimilation"
;
:
__protege_display_name
"02 | act153876 | Se servir de données grammaticales et phonologiques"
;
:
id
"seq100407"
;
:
id
"act153876"
;
:
index
2
;
:
titre
"Se servir de données grammaticales et phonologiques"
;
rdfs:
subClassOf
:
seq100407
.
:
act482478
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Découvrir le phénomène de proximité"
;
:
__protege_display_name
"00 | act482478 | Découvrir le phénomène de proximité"
;
:
id
"act482478"
;
:
index
0
;
:
titre
"Découvrir le phénomène de proximité"
;
rdfs:
subClassOf
:
seq68058
.
:
act56626
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Des sons et des formes"
;
:
__protege_display_name
"00 | act56626 | Des sons et des formes"
;
:
id
"act56626"
;
:
index
0
;
:
titre
"Des sons et des formes"
;
rdfs:
subClassOf
:
seq602682
.
:
act56672
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Utiliser différents types d'indices"
;
:
__protege_display_name
"03 | act56672 | Utiliser différents types d'indices"
;
:
id
"act56672"
;
:
index
3
;
:
titre
"Utiliser différents types d'indices"
;
rdfs:
subClassOf
:
seq906956
.
:
act592613
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Présentation"
;
:
__protege_display_name
"00 | act592613 | Présentation"
;
:
id
"act592613"
;
:
index
0
;
:
titre
"Présentation"
;
rdfs:
subClassOf
:
seq502762
.
:
act687805
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Découvrir le phénomène d'homophonie"
;
:
__protege_display_name
"00 | act687805 | Découvrir le phénomène d'homophonie"
;
:
id
"act687805"
;
:
index
0
;
:
titre
"Découvrir le phénomène d'homophonie"
;
rdfs:
subClassOf
:
seq906956
.
:
act704962
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Utiliser différents types d'indices"
;
:
__protege_display_name
"03 | act704962 | Utiliser différents types d'indices"
;
:
id
"act704962"
;
:
index
3
;
:
titre
"Utiliser différents types d'indices"
;
rdfs:
subClassOf
:
seq100407
.
:
act759984
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Utiliser différents types d'indices"
;
:
__protege_display_name
"03 | act759984 | Utiliser différents types d'indices"
;
:
id
"act759984"
;
:
index
3
;
:
titre
"Utiliser différents types d'indices"
;
rdfs:
subClassOf
:
seq68058
.
:
act761960
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Découvrir le phénomène d'assimilation"
;
:
__protege_display_name
"00 | act761960 | Découvrir le phénomène d'assimilation"
;
:
id
"act761960"
;
:
index
0
;
:
titre
"Découvrir le phénomène d'assimilation"
;
rdfs:
subClassOf
:
seq100407
.
:
act765533
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Se servir d'indices grammaticaux"
;
:
__protege_display_name
"02 | act765533 | Se servir d'indices grammaticaux"
;
:
id
"act765533"
;
:
index
2
;
:
titre
"Se servir d'indices grammaticaux"
;
rdfs:
subClassOf
:
seq906956
.
:
act828642
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Se servir d'indices grammaticaux"
;
:
__protege_display_name
"02 | act828642 | Se servir d'indices grammaticaux"
;
:
id
"act828642"
;
:
index
2
;
:
titre
"Se servir d'indices grammaticaux"
;
rdfs:
subClassOf
:
seq68058
.
:
act838137
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Repérer les indices pertinents"
;
:
__protege_display_name
"01 | act838137 | Repérer les indices pertinents"
;
:
id
"act838137"
;
:
index
1
;
:
index
1
;
:
titre
"
Assimilation
"
;
:
titre
"
Repérer les indices pertinents
"
;
rdfs:
subClassOf
:
MacaoRoot
.
rdfs:
subClassOf
:
seq906956
.
:
seq502762
a
:
SousPartie,
:
act89909
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Repérer des indices pertinents"
;
:
__protege_display_name
"01 | act89909 | Repérer des indices pertinents"
;
:
id
"act89909"
;
:
index
1
;
:
titre
"Repérer des indices pertinents"
;
rdfs:
subClassOf
:
seq68058
.
:
act957420
a
:
SousPartie,
owl:
NamedIndividual
;
rdfs:
label
"Se servir d'indices provenant du texte"
;
:
__protege_display_name
"01 | act957420 | Se servir d'indices provenant du texte"
;
:
id
"act957420"
;
:
index
1
;
:
titre
"Se servir d'indices provenant du texte"
;
rdfs:
subClassOf
:
seq100407
.
:
seq502762
a
:
Module,
owl:
NamedIndividual
;
owl:
NamedIndividual
;
rdfs:
label
"Présentation"
;
rdfs:
label
"Présentation"
;
:
__protege_display_name
"00 | seq502762 | Présentation"
;
:
__protege_display_name
"00 | seq502762 | Présentation"
;
:
contientSousPartie
:
act592613
;
:
id
"seq502762"
;
:
id
"seq502762"
;
:
index
0
;
:
index
0
;
:
titre
"Présentation"
;
:
titre
"Présentation"
;
rdfs:
subClassOf
:
MacaoRoot
.
rdfs:
subClassOf
:
MacaoRoot
.
:
seq602682
a
:
SousParti
e,
:
seq602682
a
:
Modul
e,
owl:
NamedIndividual
;
owl:
NamedIndividual
;
rdfs:
label
"Mémentos"
;
rdfs:
label
"Mémentos"
;
:
__protege_display_name
"04 | seq602682 | Mémentos"
;
:
__protege_display_name
"04 | seq602682 | Mémentos"
;
:
contientSousPartie
:
act56626
;
:
id
"seq602682"
;
:
id
"seq602682"
;
:
index
4
;
:
index
4
;
:
titre
"Mémentos"
;
:
titre
"Mémentos"
;
rdfs:
subClassOf
:
MacaoRoot
.
rdfs:
subClassOf
:
MacaoRoot
.
:
seq68058
a
:
SousPartie,
:
seq100407
a
:
Module,
owl:
NamedIndividual
;
rdfs:
label
"Assimilation"
;
:
__protege_display_name
"01 | seq100407 | Assimilation"
;
:
contientSousPartie
:
act153876,
:
act704962,
:
act761960,
:
act957420
;
:
id
"seq100407"
;
:
index
1
;
:
titre
"Assimilation"
;
rdfs:
subClassOf
:
MacaoRoot
.
:
seq68058
a
:
Module,
owl:
NamedIndividual
;
owl:
NamedIndividual
;
rdfs:
label
"Proximité"
;
rdfs:
label
"Proximité"
;
:
__protege_display_name
"02 | seq68058 | Proximité"
;
:
__protege_display_name
"02 | seq68058 | Proximité"
;
:
contientSousPartie
:
act482478,
:
act759984,
:
act828642,
:
act89909
;
:
id
"seq68058"
;
:
id
"seq68058"
;
:
index
2
;
:
index
2
;
:
titre
"Proximité"
;
:
titre
"Proximité"
;
rdfs:
subClassOf
:
MacaoRoot
.
rdfs:
subClassOf
:
MacaoRoot
.
:
seq906956
a
:
SousParti
e,
:
seq906956
a
:
Modul
e,
owl:
NamedIndividual
;
owl:
NamedIndividual
;
rdfs:
label
"Homophonie"
;
rdfs:
label
"Homophonie"
;
:
__protege_display_name
"03 | seq906956 | Homophonie"
;
:
__protege_display_name
"03 | seq906956 | Homophonie"
;
:
contientSousPartie
:
act56672,
:
act687805,
:
act765533,
:
act838137
;
:
id
"seq906956"
;
:
id
"seq906956"
;
:
index
3
;
:
index
3
;
:
titre
"Homophonie"
;
:
titre
"Homophonie"
;
...
...
This diff is collapsed.
Click to expand it.
tetras_extraction/script/src/extract.py
+
16
−
4
View file @
befe1e22
...
@@ -99,7 +99,7 @@ def parse_manifest_rec(
...
@@ -99,7 +99,7 @@ def parse_manifest_rec(
graph
.
add
((
subject
,
RDF
.
type
,
OWL
.
NamedIndividual
))
graph
.
add
((
subject
,
RDF
.
type
,
OWL
.
NamedIndividual
))
graph
.
add
((
subject
,
NS
[
"
id
"
],
Literal
(
id
)))
graph
.
add
((
subject
,
NS
[
"
id
"
],
Literal
(
id
)))
set_title
(
graph
,
subject
,
str
(
title
))
set_title
(
graph
,
subject
,
str
(
title
))
if
i
d
.
startswith
(
"
MosMod
"
):
if
i
s_module
(
id
):
# It's a Module:
# It's a Module:
graph
.
add
((
subject
,
RDF
.
type
,
NS
[
"
Module
"
]))
graph
.
add
((
subject
,
RDF
.
type
,
NS
[
"
Module
"
]))
# Add parent properties if necessary
# Add parent properties if necessary
...
@@ -112,7 +112,7 @@ def parse_manifest_rec(
...
@@ -112,7 +112,7 @@ def parse_manifest_rec(
for
child_index
,
child
in
enumerate
(
ns_findall
(
elem
,
"
item
"
)):
for
child_index
,
child
in
enumerate
(
ns_findall
(
elem
,
"
item
"
)):
parse_manifest_rec
(
graph
,
child
,
subject
,
child_index
)
parse_manifest_rec
(
graph
,
child
,
subject
,
child_index
)
el
se
:
el
if
is_subsection
(
id
)
:
# It's a Subsection
# It's a Subsection
graph
.
add
((
subject
,
RDF
.
type
,
NS
[
"
SousPartie
"
]))
graph
.
add
((
subject
,
RDF
.
type
,
NS
[
"
SousPartie
"
]))
# Add parent properties if necessary
# Add parent properties if necessary
...
@@ -125,6 +125,18 @@ def parse_manifest_rec(
...
@@ -125,6 +125,18 @@ def parse_manifest_rec(
extract_mosetp
.
parse_mosetp
(
graph
,
f
"
{
Context
.
source_dir
}
/sco/
{
id
}
.html
"
,
id
)
extract_mosetp
.
parse_mosetp
(
graph
,
f
"
{
Context
.
source_dir
}
/sco/
{
id
}
.html
"
,
id
)
def
is_module
(
id
:
str
):
return
(
Context
.
version
==
"
macao_12
"
and
id
.
startswith
(
"
MosMod
"
))
or
(
Context
.
version
==
"
macao_3
"
and
id
.
startswith
(
"
seq
"
)
)
def
is_subsection
(
id
:
str
):
return
(
Context
.
version
==
"
macao_12
"
and
id
.
startswith
(
"
MosEtp
"
))
or
(
Context
.
version
==
"
macao_3
"
and
id
.
startswith
(
"
act
"
)
)
def
compare_files
(
f1
:
str
,
f2
:
str
):
def
compare_files
(
f1
:
str
,
f2
:
str
):
log
.
info
(
log
.
info
(
"
Files {} and {} {}.
"
.
format
(
"
Files {} and {} {}.
"
.
format
(
...
@@ -146,8 +158,8 @@ def main():
...
@@ -146,8 +158,8 @@ def main():
if
MACAO_VERSION
==
"
full
"
:
if
MACAO_VERSION
==
"
full
"
:
# Run the parser once for each version, but with the same RDF graph
# Run the parser once for each version, but with the same RDF graph
for
Context
.
version
in
[
"
12
"
,
"
3
"
]:
for
Context
.
version
in
[
"
macao_12
"
,
"
macao_
3
"
]:
Context
.
source_dir
=
f
"
{
SOURCE_DIR
}
/
macao_
{
Context
.
version
}
"
Context
.
source_dir
=
f
"
{
SOURCE_DIR
}
/
{
Context
.
version
}
"
parse_manifest
(
g
)
parse_manifest
(
g
)
else
:
else
:
parse_manifest
(
g
)
parse_manifest
(
g
)
...
...
This diff is collapsed.
Click to expand it.
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