| 1 | /* semantique.h*/ |
| 2 | /* |
| 3 | * This file is part of PRAELECTOR. |
| 4 | * |
| 5 | * PRAELECTOR is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * COLLATINVS is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with PRAELECTOR; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | * © Yves Ouvrard, 2009 - 2019 |
| 20 | */ |
| 21 | |
| 22 | #ifndef SEMANTIQUE_H |
| 23 | #define SEMANTIQUE_H |
| 24 | |
| 25 | #include <QMap> |
| 26 | #include <QObject> |
| 27 | #include <QString> |
| 28 | |
| 29 | class Lien; |
| 30 | class Semantique; |
| 31 | |
| 32 | class Seme: public QObject |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | private: |
| 37 | QString _cle; |
| 38 | QList<Lien*> _lSynt; |
| 39 | QList<Lien*> _lOnto; |
| 40 | Semantique* _rete; |
| 41 | public: |
| 42 | Seme(QString c, QObject* parent=0); |
| 43 | //void aj(QString op, Seme* s); |
| 44 | //void aj(Lien* l); |
| 45 | void ajLin(QString op, Seme* s); |
| 46 | bool aLien(Lien* l); |
| 47 | QString cle(); |
| 48 | bool hyponyme(Seme* s); |
| 49 | //bool monteLien(Lien* l); |
| 50 | int nbOnto(); |
| 51 | Lien* onto(int i); |
| 52 | void rmLien(Lien* l); |
| 53 | QString toString(); |
| 54 | }; |
| 55 | |
| 56 | bool operator==(Seme& sa, Seme& sb); |
| 57 | |
| 58 | class Lien: public QObject |
| 59 | { |
| 60 | Q_OBJECT |
| 61 | |
| 62 | private: |
| 63 | Seme* _sup; |
| 64 | QString _id; |
| 65 | public: |
| 66 | Lien(QString idl, Seme* s); |
| 67 | Seme* sup(); |
| 68 | QString id(); |
| 69 | bool hypo(); |
| 70 | QString toString(); |
| 71 | }; |
| 72 | |
| 73 | bool operator==(Lien& la, Lien& lb); |
| 74 | |
| 75 | class Semantique: public QObject |
| 76 | { |
| 77 | |
| 78 | Q_OBJECT |
| 79 | |
| 80 | private: |
| 81 | QString _chemin; |
| 82 | QMap<QString, Seme*> _semes; |
| 83 | public: |
| 84 | Semantique(); |
| 85 | void ajLien(QString l); |
| 86 | int nbSemes(); |
| 87 | QList<Seme*> ontLien(Lien* l); |
| 88 | void sauve(); |
| 89 | Seme* seme(QString c); |
| 90 | Seme* seme(int i); |
| 91 | }; |
| 92 | |
| 93 | #endif |