cwm-lab 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cwm_lab-0.3.0/LICENSE +201 -0
- cwm_lab-0.3.0/PKG-INFO +251 -0
- cwm_lab-0.3.0/README.md +226 -0
- cwm_lab-0.3.0/cwm_lab/.env.example +14 -0
- cwm_lab-0.3.0/cwm_lab/__init__.py +24 -0
- cwm_lab-0.3.0/cwm_lab/cache.py +330 -0
- cwm_lab-0.3.0/cwm_lab/config.yaml.example +18 -0
- cwm_lab-0.3.0/cwm_lab/engine.py +2165 -0
- cwm_lab-0.3.0/cwm_lab/exercises/GUIDE_ENSEIGNANT.md +93 -0
- cwm_lab-0.3.0/cwm_lab/exercises/README.md +43 -0
- cwm_lab-0.3.0/cwm_lab/exercises/famille/context.json +4 -0
- cwm_lab-0.3.0/cwm_lab/exercises/famille/donnees.n3 +16 -0
- cwm_lab-0.3.0/cwm_lab/exercises/famille/enonce.md +60 -0
- cwm_lab-0.3.0/cwm_lab/exercises/famille/regles.n3 +13 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/context.json +3 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/corriges/exo-cholesterol.n3 +31 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/corriges/exo-iib.n3 +31 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/corriges/exo-renal.n3 +30 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/corriges/exo-totaux.n3 +49 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/enonce.md +206 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/ingredients.n3 +224 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/medical.n3 +98 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/recettes.n3 +90 -0
- cwm_lab-0.3.0/cwm_lab/exercises/recettes/regles.n3 +161 -0
- cwm_lab-0.3.0/cwm_lab/server.py +345 -0
- cwm_lab-0.3.0/cwm_lab/static/app.js +1286 -0
- cwm_lab-0.3.0/cwm_lab/static/index.html +201 -0
- cwm_lab-0.3.0/cwm_lab/static/style.css +456 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/codemirror/LICENSE.md +40 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/codemirror/README.md +56 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/codemirror/codemirror.js +12 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/codemirror/entry.js +22 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/vis/LICENSE.md +21 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/vis/README.md +34 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/vis/vis-data.min.js +34 -0
- cwm_lab-0.3.0/cwm_lab/static/vendor/vis/vis-network.min.js +78 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/PKG-INFO +251 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/SOURCES.txt +44 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/dependency_links.txt +1 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/entry_points.txt +2 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/requires.txt +1 -0
- cwm_lab-0.3.0/cwm_lab.egg-info/top_level.txt +1 -0
- cwm_lab-0.3.0/pyproject.toml +71 -0
- cwm_lab-0.3.0/setup.cfg +4 -0
- cwm_lab-0.3.0/tests/test_cache.py +308 -0
- cwm_lab-0.3.0/tests/test_engine.py +987 -0
cwm_lab-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
cwm_lab-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cwm-lab
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: CWM Lab — tableau de bord local sur CWM 2.0 : parse N3/Turtle, raisonnement, SPARQL, preuves, graphe (outil de TP Web sémantique)
|
|
5
|
+
Author-email: Emmanuel Desmontils <emmanuel.desmontils@univ-nantes.fr>
|
|
6
|
+
Maintainer-email: Emmanuel Desmontils <emmanuel.desmontils@univ-nantes.fr>
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/edesmontils/cwm-lab
|
|
9
|
+
Project-URL: Repository, https://github.com/edesmontils/cwm-lab
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/edesmontils/cwm-lab/issues
|
|
11
|
+
Project-URL: CWM 2.0 (moteur), https://gitlab.univ-nantes.fr/desmontils-e/cwm
|
|
12
|
+
Keywords: semantic-web,rdf,n3,turtle,sparql,reasoner,education
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Education
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Topic :: Education
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: cwm>=2.9.3
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# CWM Lab — outil de TP Web sémantique (CWM 2.0)
|
|
27
|
+
|
|
28
|
+
> **Application web locale** pour un TP de Web sémantique (Master MIAGE)
|
|
29
|
+
> sur les notions de **cohérence**, **validité** et **règles** —
|
|
30
|
+
> tout ce que sait faire [CWM 2.0](https://gitlab.univ-nantes.fr/desmontils-e/cwm) :
|
|
31
|
+
> parser N3/Turtle, raisonner (chaînage avant), interroger (SPARQL),
|
|
32
|
+
> détecter les incohérences, tester l'inférence, générer et vérifier
|
|
33
|
+
> les preuves.
|
|
34
|
+
>
|
|
35
|
+
> Projet autonome : **CWM 2.0 est la seule dépendance** (publiée sur
|
|
36
|
+
> PyPI sous le nom [`cwm`](https://pypi.org/project/cwm/), source :
|
|
37
|
+
> [dépôt GitLab public](https://gitlab.univ-nantes.fr/desmontils-e/cwm)).
|
|
38
|
+
|
|
39
|
+
## Crédits
|
|
40
|
+
|
|
41
|
+
- **Auteur** : Emmanuel Desmontils
|
|
42
|
+
- **Institution** : Nantes Université
|
|
43
|
+
- **Copyright** : © 2026 Emmanuel Desmontils — Nantes Université
|
|
44
|
+
- **Date** : 2026-11-23 (projet autonome ; livraison P0–P8 + reprise d'ergonomie P7)
|
|
45
|
+
- **Version** : `cwm_lab.__version__` (affichée dans le pied de
|
|
46
|
+
page de l'outil, servie par `GET /api/version`)
|
|
47
|
+
- **Licence** : Apache-2.0 (code, voir `LICENSE`) ; le moteur
|
|
48
|
+
CWM 2.0 (dépendance) est sous licence W3C Software (code
|
|
49
|
+
d'origine) / Apache-2.0 (modifications du fork) ; CodeMirror 6 et
|
|
50
|
+
vis.js vendus en local (MIT, voir `cwm_lab/static/vendor/`).
|
|
51
|
+
|
|
52
|
+
## Statut
|
|
53
|
+
|
|
54
|
+
**P0 livrée** (2026-11-21) : parse N3/Turtle avec erreurs
|
|
55
|
+
ligne/colonne et stats, serveur stdlib, page minimale, tests
|
|
56
|
+
(`make test`).
|
|
57
|
+
|
|
58
|
+
**P1 livrée** (2026-11-22) : éditeur CodeMirror 6 (bundle local,
|
|
59
|
+
coloration Turtle + surcouche N3), auto-parse au frappage avec
|
|
60
|
+
erreurs surlignées dans la gouttière, base URI configurable,
|
|
61
|
+
exports N3 / Turtle / NTriples / RDF/XML (Turtle/NTriples refusés
|
|
62
|
+
si le graphe n'est pas du RDF pur, comme `cwm --turtle`).
|
|
63
|
+
|
|
64
|
+
**P2 livrée** (2026-11-22) : second éditeur pour les **règles N3**
|
|
65
|
+
(`{ … } log:implies { … } .`, variables déclarées avec `@forAll`),
|
|
66
|
+
bouton **Raisonner** → clôture (`think` = convergence, `applyRules`
|
|
67
|
+
= 1 passe, règles stockées ou non), **liste des nouveaux faits**,
|
|
68
|
+
signal d'**incohérence** (présence de `log:false`, en rouge) et
|
|
69
|
+
**timeout** propre sur les règles non convergentes — rien ne bloque
|
|
70
|
+
jamais le TP.
|
|
71
|
+
|
|
72
|
+
**P3 livrée** (2026-11-22) : troisième éditeur pour la **requête
|
|
73
|
+
SPARQL** (`PREFIX : <…>` + `SELECT` / `ASK`), case **« raisonner avant
|
|
74
|
+
d'interroger »** : la même requête s'exécute sur la KB brute *et* sur
|
|
75
|
+
la clôture, les **lignes nouvelles du diff avant/après sont surlignées**
|
|
76
|
+
— l'écart pédagogique clé du TP. L'exemple préchargé (grand-parent)
|
|
77
|
+
renvoie 0 ligne brute et 1 ligne après raisonnement. ASK s'affiche en
|
|
78
|
+
bannière (vrai/faux, avant/après). `POST /api/query`, `engine.query`.
|
|
79
|
+
|
|
80
|
+
**P4 livrée** (2026-11-22) : éditeur **Conclusion / Preuve**
|
|
81
|
+
(onglets, dans la colonne de droite). **« Entraîne ? »** : la clôture
|
|
82
|
+
(données + règles) contient-elle la conclusion ? → oui/non
|
|
83
|
+
(`testIncludes`, avertissement *ex falso* si la clôture est
|
|
84
|
+
incohérente). **« Pourquoi ? »** : génération de la **preuve** N3 de
|
|
85
|
+
la clôture, affichée colorée dans l'onglet « Preuve » — la preuve est
|
|
86
|
+
**auto-suffisante** (ses sources sont des URI `data:`, le texte des
|
|
87
|
+
documents est embarqué) et **altérable à la main**. **« Vérifier la
|
|
88
|
+
preuve »** : `check` rejoue la dérivation dans un subprocess →
|
|
89
|
+
verdict **valide / invalide** + étapes de dérivation numérotées. Une
|
|
90
|
+
preuve altérée (un prédicat de la conclusion, une source…) est
|
|
91
|
+
**rejetée**. `engine.entail` / `engine.prove` / `engine.check_proof`,
|
|
92
|
+
`POST /api/entail` / `/api/prove` / `/api/check`.
|
|
93
|
+
|
|
94
|
+
**P5 livrée** (2026-11-22) : **pack TP**. Le menu **Exercice** du
|
|
95
|
+
bandeau charge un exercice dans les éditeurs (données, règles,
|
|
96
|
+
requête, conclusion) et affiche son **énoncé** :
|
|
97
|
+
|
|
98
|
+
- `cwm_lab/exercises/famille/` — échauffement (~30 min) : parcourt
|
|
99
|
+
toutes les fonctions de l'outil en miniature ;
|
|
100
|
+
- `cwm_lab/exercises/recettes/` — exercice principal (~60–90 min) :
|
|
101
|
+
contre-indications alimentaires calculées par règles N3 (allergènes
|
|
102
|
+
absolus + nutriments à seuil avec calculs `math:`), 9 recettes,
|
|
103
|
+
5 patients, 6 exercices + **corrigés** (`recettes/corriges/`) +
|
|
104
|
+
discussion des limites du modèle ;
|
|
105
|
+
- `cwm_lab/exercises/GUIDE_ENSEIGNANT.md` — déroulé 2 h, points de
|
|
106
|
+
vigilance, barème suggéré ;
|
|
107
|
+
- convention d'exercice (dossier `enonce.md` + `*.n3` +
|
|
108
|
+
`context.json` optionnel) documentée dans
|
|
109
|
+
`cwm_lab/exercises/README.md` — un nouvel exercice s'ajoute sans
|
|
110
|
+
code. Les exercices sont **dans le paquet** : ils voyagent avec
|
|
111
|
+
`pip install` (source ou PyPI).
|
|
112
|
+
|
|
113
|
+
`engine.list_exercises` / `engine.load_exercise`,
|
|
114
|
+
`GET /api/exercises`, `GET /api/exercise?name=…`.
|
|
115
|
+
|
|
116
|
+
Le **graphe des triples** (option vis.js de la roadmap, vendue en
|
|
117
|
+
local) — ressources (bleu), littéraux (vert), nœuds vides (gris) ;
|
|
118
|
+
avec « après raisonnement », les nœuds créés par les règles et les
|
|
119
|
+
arcs nouveaux sont surlignés en orange. `engine.graph`,
|
|
120
|
+
`POST /api/graph`. (Depuis P7, il est **toujours visible** — voir ci-dessous.)
|
|
121
|
+
|
|
122
|
+
**P8 livrée** (2026-11-23) : **cache des traitements**. En TP, le
|
|
123
|
+
même traitement (parse, raisonnement, requête, preuve,
|
|
124
|
+
vérification de preuve, graphe, sérialisation) revient très
|
|
125
|
+
probablement : il est servi depuis un cache **à deux niveaux** —
|
|
126
|
+
mémoire (LRU, TTL 5 min) et **disque persisté** (TTL 7 jours,
|
|
127
|
+
borné 200 Mo) — au lieu d'être recalculé. La seconde occurrence
|
|
128
|
+
d'un traitement est quasi instantanée, et le cache **survit aux
|
|
129
|
+
redémarrages** : le gain se cumule sur plusieurs séances. Clé =
|
|
130
|
+
SHA-256 du payload complet (toute édition force le recalcul) ;
|
|
131
|
+
seuls les résultats complets et réussis sont cachés ; la réponse
|
|
132
|
+
porte le drapeau `cached`. Configuration facultative
|
|
133
|
+
(`config.yaml` non sensible, `.env` sensible/git-ignoré —
|
|
134
|
+
exemples commités) ; `cache.py`, 19 tests dont l'intégration
|
|
135
|
+
serveur.
|
|
136
|
+
|
|
137
|
+
**P7 livrée** (2026-11-23) : **reprise d'ergonomie** — l'interface
|
|
138
|
+
est repensée pour un étudiant qui découvre l'outil :
|
|
139
|
+
|
|
140
|
+
- **layout 2 colonnes** : à gauche les éditeurs + une
|
|
141
|
+
**barre d'actions unifiée** groupée par objectif (Raisonnement /
|
|
142
|
+
Interroger / Valider) ; à droite le **graphe, toujours visible**,
|
|
143
|
+
l'**éditeur Conclusion/Preuve** et les **résultats consolidés en
|
|
144
|
+
onglets** (Parse / Raisonnement / Requête / Entraînement /
|
|
145
|
+
Preuve / Export) — fini les N blocs empilés. L'éditeur
|
|
146
|
+
Conclusion/Preuve est à droite : une preuve générée fait des
|
|
147
|
+
dizaines de lignes (URI `data:` de plusieurs milliers de
|
|
148
|
+
caractères), elle ne gonfle plus la colonne des éditeurs ;
|
|
149
|
+
- **largeur des colonnes ajustable** : poignée de glissement entre
|
|
150
|
+
les deux colonnes (25–75 %, persistée en localStorage) ; les
|
|
151
|
+
pistes du grid sont `minmax(0, …)` — **un résultat ne change
|
|
152
|
+
jamais la largeur des colonnes** ;
|
|
153
|
+
- **graphe systématiquement visible et à jour** : le bouton
|
|
154
|
+
« Graphe » a disparu — le panneau persistant se re-rend à chaque
|
|
155
|
+
action (édition des données/règles, Raisonner, Interroger avec
|
|
156
|
+
raisonnement, chargement d'exercice, changement des options) ;
|
|
157
|
+
les cases « après raisonnement » et « attributs masqués » sont
|
|
158
|
+
dans l'en-tête du panneau ;
|
|
159
|
+
- **mode « attributs masqués »** : les nœuds-littéraux sont
|
|
160
|
+
remplacés par une **pastille compteur** sur le nœud (les
|
|
161
|
+
attributs masqués sont listés dans la bulle contextuelle au
|
|
162
|
+
survol) — le graphe devient lisible quand une ressource porte
|
|
163
|
+
beaucoup de littéraux (`recettes`) ;
|
|
164
|
+
- **énoncés rendus Markdown → HTML** : convertisseur minimal
|
|
165
|
+
**stdlib** (`engine.render_markdown` : titres, listes imbriquées,
|
|
166
|
+
tableaux, blocs code, gras/italique ; texte échappé d'abord,
|
|
167
|
+
aucune injection possible) ; les `.md` restent la source de
|
|
168
|
+
vérité dans le dépôt.
|
|
169
|
+
|
|
170
|
+
10 tests ajoutés (110 au total) ; version `0.2.0`.
|
|
171
|
+
|
|
172
|
+
Décisions actées :
|
|
173
|
+
|
|
174
|
+
- **Stack** : backend Python **stdlib uniquement** (`http.server` + JSON),
|
|
175
|
+
frontend navigateur avec **CodeMirror 6** (vendu en local, pas de CDN) ;
|
|
176
|
+
zéro dépendance ajoutée au dépôt ;
|
|
177
|
+
- **Dépendance** : CWM 2.0 (fork) — unique dépendance, publiée sur
|
|
178
|
+
PyPI sous le nom `cwm` ;
|
|
179
|
+
- **Public** : Master MIAGE.
|
|
180
|
+
|
|
181
|
+
## Lancement
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
pip install cwm-lab # installe l'outil + CWM 2.0 (cwm, dépendance unique)
|
|
185
|
+
|
|
186
|
+
cwm-lab # → http://127.0.0.1:8000
|
|
187
|
+
cwm-lab --port 8080
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`pip install cwm-lab` résout automatiquement `cwm>=2.9.3` (CWM 2.0,
|
|
191
|
+
fork, sur PyPI) ; en développement : `pip install -e .` depuis ce
|
|
192
|
+
dépôt. `make test` exécute les tests unitaires (110) ; `make serve`
|
|
193
|
+
démarre le serveur.
|
|
194
|
+
|
|
195
|
+
## Configuration (P8, facultative)
|
|
196
|
+
|
|
197
|
+
L'appli démarre **sans aucun fichier de config** (valeurs par
|
|
198
|
+
défaut). Deux fichiers optionnels, dans `cwm_lab/` :
|
|
199
|
+
|
|
200
|
+
- `config.yaml` — paramètres **non sensibles** : rétention du cache
|
|
201
|
+
disque/mémoire (`ttl_disk`, `ttl_memory`), taille max disque,
|
|
202
|
+
nombre d'entrées mémoire. Installer :
|
|
203
|
+
`cp cwm_lab/config.yaml.example cwm_lab/config.yaml && chmod 600 cwm_lab/config.yaml` ;
|
|
204
|
+
- `.env` — **données sensibles / locales** (ignoré par git) :
|
|
205
|
+
répertoire du cache (`CACHE_DIR`, défaut `~/.cache/lab_tp`), et
|
|
206
|
+
pour la P9, provider/modèle/clé de l'IA (`IA_*`). Installer :
|
|
207
|
+
`cp cwm_lab/.env.example cwm_lab/.env && chmod 600 cwm_lab/.env`.
|
|
208
|
+
|
|
209
|
+
## Arborescence
|
|
210
|
+
|
|
211
|
+
```
|
|
212
|
+
cwm-lab/
|
|
213
|
+
├── README.md # ce fichier
|
|
214
|
+
├── ROADMAP.md # feuille de route (phases, critères, risques)
|
|
215
|
+
├── pyproject.toml # paquet cwm-lab (dépendance : cwm>=2.9.3)
|
|
216
|
+
├── Makefile # test / serve
|
|
217
|
+
├── cwm_lab/
|
|
218
|
+
│ ├── __init__.py # version
|
|
219
|
+
│ ├── server.py # http.server + endpoints /api/*
|
|
220
|
+
│ ├── engine.py # wrapper stateless sur les API swap (cœur testable)
|
|
221
|
+
│ ├── cache.py # P8 : cache deux niveaux (mémoire + disque)
|
|
222
|
+
│ ├── config.yaml.example # config non sensible (TTL, tailles) — facultatif
|
|
223
|
+
│ ├── .env.example # config sensible (cache dir, IA) — facultatif
|
|
224
|
+
│ ├── static/
|
|
225
|
+
│ │ ├── index.html # tableau de bord (2 colonnes — éditeurs + barre
|
|
226
|
+
│ │ │ # d'actions | graphe persistant + onglets)
|
|
227
|
+
│ │ ├── app.js # éditeur CodeMirror + appels API + affichage
|
|
228
|
+
│ │ │ # (onglets de résultats, graphe auto, pastilles)
|
|
229
|
+
│ │ ├── style.css # styles du tableau de bord
|
|
230
|
+
│ │ ├── vendor/codemirror/ # CodeMirror 6 en bundle local (esbuild)
|
|
231
|
+
│ │ └── vendor/vis/ # vis-network + vis-data (UMD, graphe)
|
|
232
|
+
│ └── exercises/ # exercices de TP : .n3 + énoncés .md + corrigés
|
|
233
|
+
│ # (dans le paquet — voyagent avec pip install)
|
|
234
|
+
└── tests/ # tests de cwm_lab (engine, cache, serveur)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Principes
|
|
238
|
+
|
|
239
|
+
- **Stateless** : chaque requête reconstruit le store depuis le texte des
|
|
240
|
+
éditeurs ; pas d'état serveur à gérer — le **cache** (P8) est une
|
|
241
|
+
**optimisation, pas un état** : seule la réponse JSON déjà calculée
|
|
242
|
+
est mémorisée (mémoire + disque), jamais un store ;
|
|
243
|
+
- **API CWM directes** : `think()`, `applyRules()`, `applyQueries()`,
|
|
244
|
+
`applySparqlQueries()`, `testIncludes()`, `why`/`explainFormula`,
|
|
245
|
+
parser `notation3` — pas de passage par les CLI, sauf `check`
|
|
246
|
+
(subprocess `python -m swap.check`, car il manipule `sys.argv`/`stdin`) ;
|
|
247
|
+
- **Timeout par requête** : une règle récursive ne doit jamais bloquer
|
|
248
|
+
le TP (chaînage avant non garanti sur des règles cycliques) ;
|
|
249
|
+
- **Zéro dépendance propre** : CWM 2.0 est la seule dépendance ;
|
|
250
|
+
CodeMirror et vis.js sont téléchargés une fois dans
|
|
251
|
+
`cwm_lab/static/vendor/` et commités (pas de CDN).
|