View Javadoc

1   /******************************************************************
2   JADE - Java Agent DEvelopment Framework is a framework to develop
3   multi-agent systems in compliance with the FIPA specifications.
4   Copyright (C) 2000 CSELT S.p.A. 
5   
6   GNU Lesser General Public License
7   
8   This library is free software; you can redistribute it and/or
9   modify it under the terms of the GNU Lesser General Public
10  License as published by the Free Software Foundation, 
11  version 2.1 of the License. 
12  
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  Lesser General Public License for more details.
17  
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library; if not, write to the
20  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  *****************************************************************/
23  
24  
25  package sl;
26  
27  
28  import java.util.Map;
29  import java.util.HashMap;
30  /***
31     @author Fabio Bellifemine - CSELT S.p.A.
32     @version $Date: 2003/10/09 13:00:37 $ $Revision: 1.1.1.1 $
33  */
34  
35  /***
36     This class represents the meta-ontology used by JADE. 
37     There is only a single instance of this class.
38     <p>
39     The <code>jade.onto.JadeMetaOntology</code> package contains one class for 
40     each role in this ontology.
41     <p>
42   */
43  public class JADEMetaOntology {
44  
45    /***
46      A symbolic constant, containing the name of this ontology.
47     */
48    public static final String NAME = "JADE-meta-ontology";
49  
50    private static Ontology theInstance = new DefaultOntology();
51  
52     // Concepts 
53    public static final String ANONTOLOGY = "AnOntology";
54    public static final String ROLE = "Role";
55    public static final String SLOT = "Slot";
56  	
57  
58    /***
59       This method grants access to the unique instance of the
60       basic ontology.
61       @return An <code>Ontology</code> object, containing the concepts
62       of the basic ontology.
63    */
64    public static Ontology instance() {
65      return theInstance;
66    }
67  
68    private JADEMetaOntology() {
69    }
70  
71    static { 
72      initInstance();
73    }
74  
75    private static void initInstance() {
76      try {
77        theInstance.addRole(ANONTOLOGY,
78  	new SlotDescriptor[] { //the slots must have no name otherwise SL-0 complains
79  	  new SlotDescriptor(Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
80  	  new SlotDescriptor(Ontology.SET_SLOT, ROLE, Ontology.M)
81  	    }, AnOntology.class);
82  
83        theInstance.addRole(ROLE,
84  	new SlotDescriptor[] {
85    	  new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
86  	  new SlotDescriptor("className", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.O),
87  	  new SlotDescriptor("slots", Ontology.SET_SLOT, SLOT, Ontology.O)
88  	    }, Role.class);
89  
90        theInstance.addRole(SLOT,
91  	new SlotDescriptor[] {
92    	  new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.O),
93  	  new SlotDescriptor("category", Ontology.PRIMITIVE_SLOT, Ontology.LONG_TYPE, Ontology.M),
94  	  new SlotDescriptor("type", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
95  	  new SlotDescriptor("presence", Ontology.PRIMITIVE_SLOT, Ontology.BOOLEAN_TYPE, Ontology.M)
96  	    }, Slot.class);
97      }	// End of try
98      catch(OntologyException oe) {
99        oe.printStackTrace();
100     }
101   } //end of initInstance
102 
103 }