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   The updating of this file to JADE 2.0 has been partially supported by the IST-1999-10211 LEAP Project
7   
8   GNU Lesser General Public License
9   
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation, 
13  version 2.1 of the License. 
14  
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  Lesser General Public License for more details.
19  
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the
22  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  Boston, MA  02111-1307, USA.
24  *****************************************************************/
25  
26  
27  package sl;
28  
29  import java.util.Map;
30  import java.util.HashMap;
31  /***
32     @author Giovanni Caire - CSELT S.p.A.
33     @version $Date: 2003/10/09 13:00:36 $ $Revision: 1.1.1.1 $
34  */
35  
36  /***
37     This class represents an ontology including basic concepts
38     that are common to a lot of different applications.
39     There is only a single instance of this class.
40     <p>
41     The <code>jade.onto.basic</code> package contains one class for 
42     each role in this ontology.
43     <p>
44   */
45  public class BasicOntology {
46  
47    /***
48      A symbolic constant, containing the name of this ontology.
49     */
50    public static final String NAME = "basic-ontology";
51  
52    private static Ontology theInstance = new DefaultOntology();
53  
54     // Concepts
55    public static final String ACTION = "action";
56    public static final String AGENTIDENTIFIER = "agent-identifier";
57  
58    // Propositions
59    public static final String TRUE = "true";
60    public static final String FALSE = "false";
61    
62    // Predicates
63    public static final String DONE = "done";
64    public static final String RESULT = "result";
65    public static final String NOT = "not";
66  	
67  
68    /***
69       This method grants access to the unique instance of the
70       basic ontology.
71       @return An <code>Ontology</code> object, containing the concepts
72       of the basic ontology.
73    */
74    public static Ontology instance() {
75      return theInstance;
76    }
77  
78    private BasicOntology() {
79    }
80  
81    static { 
82      initInstance();
83    }
84  
85    private static void initInstance() {
86      try {
87  			// Adds ACTION role
88        theInstance.addRole(
89  				ACTION, 
90  				new SlotDescriptor[] {
91  	  			new SlotDescriptor(Ontology.FRAME_SLOT, AGENTIDENTIFIER, Ontology.M),
92  	  			new SlotDescriptor(Ontology.FRAME_SLOT, Ontology.ANY_TYPE, Ontology.M)
93  				}, Action.class);
94  
95  			// Adds AGENTIDENTIFIER role
96  			theInstance.addRole(
97  				AGENTIDENTIFIER, 
98  				new SlotDescriptor[] {
99  	  			new SlotDescriptor("name", Ontology.PRIMITIVE_SLOT, Ontology.STRING_TYPE, Ontology.M),
100 	  			new SlotDescriptor("addresses", Ontology.SEQUENCE_SLOT, Ontology.STRING_TYPE, Ontology.O),
101 	  			new SlotDescriptor("resolvers", Ontology.SEQUENCE_SLOT, AGENTIDENTIFIER, Ontology.O)
102 				}, AID.class);
103 
104 	
105 			// Adds TRUE role
106 			theInstance.addRole(
107 				TRUE, 
108 				new SlotDescriptor[]{
109 				}, TrueProposition.class);
110 
111 			// Adds FALSE role
112 			theInstance.addRole(
113 				FALSE, 
114 				new SlotDescriptor[]{
115 				}, FalseProposition.class);
116 
117 			// Adds DONE role
118 			theInstance.addRole(
119 				DONE, 
120 				new SlotDescriptor[] {
121 					new SlotDescriptor(Ontology.FRAME_SLOT, ACTION, Ontology.M)
122 				}, DonePredicate.class);
123 
124 			// Adds RESULT role
125 			theInstance.addRole(
126 				RESULT, 
127 				new SlotDescriptor[] {
128 					new SlotDescriptor(Ontology.FRAME_SLOT, ACTION, Ontology.M),
129 					new SlotDescriptor(Ontology.SET_SLOT, Ontology.ANY_TYPE, Ontology.M)
130 				}, ResultPredicate.class);
131 	   	   
132 			// Adds NOT role
133     	theInstance.addRole(
134 				NOT, 
135 				new SlotDescriptor[] {
136 	  			new SlotDescriptor(Ontology.FRAME_SLOT, Ontology.ANY_TYPE, Ontology.M)
137 				}, Not.class);
138 
139 			// DEBUG: PRINT VOCABULARY
140 	  	//List voc = theInstance.getVocabulary();
141 	  	//Iterator i = voc.iterator();
142 	  	//while (i.hasNext())
143 	  	//	System.out.println((String) (i.next()));
144 	  	
145     }	// End of try
146     catch(OntologyException oe) {
147       oe.printStackTrace();
148     }
149   } //end of initInstance
150 
151 
152 
153 }