package aminePlatform.samples.buildOntology; /******************************************************************* Amine - Artificial Intelligence platform for the development of Intelligent Systems. Copyright (C) 2004 AmineGroup. GNU Lesser General Public License This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, version 2.1 of the License. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *********************************************************************/ import java.util.*; import javax.swing.*; import java.awt.event.*; import java.io.*; import aminePlatform.kernel.lexicons.*; import aminePlatform.kernel.ontology.*; import aminePlatform.util.*; import aminePlatform.util.cg.*; import aminePlatform.util.parserGenerator.*; import aminePlatform.guis.util.*; /** *

Title : OntologyTopLevel class

*

Description : OntologyTopLevel corresponds to the ontology's top level proposed *

by john Sowa in his KR'2000 book and in his Web Site.

* @author Adil KABBAJ * @version 2 */ public class BuildOntologyTopLevel { public BuildOntologyTopLevel() { Identifier english = new Identifier("English"); Identifier rootIdentifier = new Identifier("Universal"); Identifier rootRelIdentifier = new Identifier("Relation"); try { Ontology ontology = new Ontology(rootIdentifier, rootRelIdentifier, english); Lexicon englishLexicon = ontology.getLexicon(english); Identifier Independent = new Identifier("Independent"); Identifier Continuant = new Identifier("Continuant"); Identifier Physical = new Identifier("Physical"); Identifier Relative = new Identifier("Relative"); Identifier Abstract = new Identifier("Abstract"); Identifier Occurrent = new Identifier("Occurrent"); Identifier Mediating = new Identifier("Mediating"); Object[] objs = {Independent, Continuant, Physical, Relative, Abstract, Occurrent, Mediating}; englishLexicon.linkSubTypesToType(objs, rootIdentifier); Identifier Actuality = new Identifier("Actuality"); Identifier Form = new Identifier("Form"); englishLexicon.linkSubTypesToType(new Object[] {Actuality, Form}, Independent); Identifier Prehension = new Identifier("Prehension"); Identifier Nexus = new Identifier("Nexus"); englishLexicon.linkSubTypesToType(new Object[] {Actuality, Prehension, Nexus}, Physical); Identifier Proposition = new Identifier("Proposition"); englishLexicon.linkSubTypesToType(new Object[] {Prehension, Proposition}, Relative); Identifier Intention = new Identifier("Intention"); englishLexicon.linkSubTypesToType(new Object[] {Form, Proposition, Intention}, Abstract); englishLexicon.linkSubTypesToType(new Object[] {Nexus, Intention}, Mediating); Identifier Object = new Identifier("Object"); Identifier Schema = new Identifier("Schema"); Identifier Juncture = new Identifier("Juncture"); Identifier Description = new Identifier("Description"); Identifier Structure = new Identifier("Structure"); Identifier Reason = new Identifier("Reason"); objs = new Object[] {Object, Schema, Juncture, Description, Structure, Reason}; englishLexicon.linkSubTypesToType(objs, Continuant); Identifier Process = new Identifier("Process"); Identifier Script = new Identifier("Script"); Identifier Participation = new Identifier("Participation"); Identifier History = new Identifier("History"); Identifier Situation = new Identifier("Situation"); Identifier Purpose = new Identifier("Purpose"); objs = new Object[] {Process, Script, Participation, History, Situation, Purpose}; englishLexicon.linkSubTypesToType(objs, Occurrent); englishLexicon.linkSubTypesToType(new Object[] {Object, Process}, Actuality); englishLexicon.linkSubTypesToType(new Object[] {Schema, Script}, Form); englishLexicon.linkSubTypesToType(new Object[] {Juncture, Participation}, Prehension); englishLexicon.linkSubTypesToType(new Object[] {Description, History}, Proposition); englishLexicon.linkSubTypesToType(new Object[] {Structure, Situation}, Nexus); englishLexicon.linkSubTypesToType(new Object[] {Reason, Purpose}, Intention); // Save the new created Lexicons/Ontology in the .ont and in .xml forms // in aminePlatform.samples.ontology. try { // Save the Lexicon/Ontology, by serialisation of Java object(s), in the specified file. ontology.store(AmineFrame.ontologyDirPath + "OntologyTopLevel.ont"); // Save the Lexicon/Ontology in the specified XML file. ontology.storeInXML(AmineFrame.ontologyDirPath + "OntologyTopLevel.xml"); } catch (Exception ex){ ex.printStackTrace(); } /********************* // Visualize the Ontology (Optional) TextualDisplayOntology txtDsplyOntFrm = new TextualDisplayOntology(ontology); txtDsplyOntFrm.displayOntology(); txtDsplyOntFrm.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(-1); } }); ************/ } catch (Exception ex) { System.out.println(ex.getMessage()); ex.printStackTrace(); } } }