View Javadoc

1   /***
2    * ***************************************************************
3    * JADE - Java Agent DEvelopment Framework is a framework to develop
4    * multi-agent systems in compliance with the FIPA specifications.
5    * Copyright (C) 2000 CSELT S.p.A.
6    * 
7    * GNU Lesser General Public License
8    * 
9    * This library is free software; you can redistribute it and/or
10   * modify it under the terms of the GNU Lesser General Public
11   * License as published by the Free Software Foundation,
12   * version 2.1 of the License.
13   * 
14   * This library is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   * Lesser General Public License for more details.
18   * 
19   * You should have received a copy of the GNU Lesser General Public
20   * License along with this library; if not, write to the
21   * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22   * Boston, MA  02111-1307, USA.
23   * **************************************************************
24   */
25  package JADE_SL.onto;
26  
27  import JADE_SL.*;
28  import JADE_SL.acl.*;
29  import JADE_SL.schema.*;
30  
31  /***
32   * Ontology containing the concepts that ACL mandates.
33   *
34   * see JADE_SL.Ontology
35   *
36   * @author Federico Bergenti - Universita` di Parma
37   */
38  public class ACLOntology extends Ontology {
39  		public static final String       COMMUNICATIVE_ACT = "COMMUNICATIVEACT";
40  		public static final String       COMMUNICATIVE_ACT_SENDER = "sender";
41  		public static final String       COMMUNICATIVE_ACT_RECEIVERS = "receivers";
42  		
43      public static final String       INFORM = "INFORM";
44      public static final String       INFORM_PREDICATE = "predicate";
45      
46      public static final String       REQUEST = "REQUEST";
47      public static final String       REQUEST_ACTION = "action";
48      
49      public static final String       QUERY_REF = "QUERYREF";
50      public static final String       QUERY_REF_IRE = "ire";
51      
52      private static final ACLOntology theInstance = new ACLOntology();
53  
54      /***
55       * Constructor
56       */
57      private ACLOntology() {
58          super("ACL_ONTOLOGY", BasicOntology.getInstance(), new ReflectiveIntrospector());
59  
60          try {
61              AgentActionSchema baseSchema = new AgentActionSchema(COMMUNICATIVE_ACT);
62              baseSchema.add(COMMUNICATIVE_ACT_SENDER, (ConceptSchema) getSchema(BasicOntology.AID));
63              baseSchema.add(COMMUNICATIVE_ACT_RECEIVERS, (AggregateSchema) getSchema(BasicOntology.SEQUENCE));
64              add(baseSchema, CommunicativeActBase.class);
65  
66              AgentActionSchema informSchema = new AgentActionSchema(INFORM);
67              informSchema.addSuperSchema(baseSchema);
68              informSchema.add(INFORM_PREDICATE, (PredicateSchema) PredicateSchema.getBaseSchema());
69              add(informSchema, Inform.class);
70  
71              AgentActionSchema requestSchema = new AgentActionSchema(REQUEST);
72              requestSchema.addSuperSchema(baseSchema);
73              requestSchema.add(REQUEST_ACTION, (AgentActionSchema) AgentActionSchema.getBaseSchema());
74              add(requestSchema, Request.class);
75  
76              AgentActionSchema queryrefSchema = new AgentActionSchema(QUERY_REF);
77              queryrefSchema.addSuperSchema(baseSchema);
78              queryrefSchema.add(QUERY_REF_IRE, (IRESchema) IRESchema.getBaseSchema());
79              add(queryrefSchema); // As the content of a QUERYREF is an IRE a concrete QueryRef class makes no sense
80  
81          } 
82          catch (OntologyException oe) {
83              oe.printStackTrace();
84          } 
85      }
86  
87      /***
88       * Returns the singleton instance of the <code>ACLOntology</code>.
89       * @return the <code>ACLOntology</code>
90       */
91      public static Ontology getInstance() {
92          return theInstance;
93      } 
94  }