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.schema;
26
27 import JADE_SL.abs.*;
28 import JADE_SL.onto.OntologyException;
29
30 /***
31 * @author Federico Bergenti - Universita` di Parma
32 */
33 public class TermSchema extends ObjectSchema {
34 public static final String BASE_NAME = "Term";
35 private static TermSchema baseSchema = new TermSchema();
36
37 /***
38 * Construct a schema that vinculates an entity to be a generic
39 * term
40 */
41 private TermSchema() {
42 super(BASE_NAME);
43 }
44
45 /***
46 * Creates a <code>TermSchema</code> with a given type-name.
47 *
48 * @param typeName The name of this <code>TermSchema</code>.
49 */
50 protected TermSchema(String typeName) {
51 super(typeName);
52 }
53
54 /***
55 * Retrieve the generic base schema for terms.
56 *
57 * @return the generic base schema for terms.
58 */
59 public static ObjectSchema getBaseSchema() {
60 return baseSchema;
61 }
62
63 /***
64 * Creates an Abstract descriptor to hold a term of
65 * the proper type.
66 */
67 public AbsObject newInstance() throws OntologyException {
68 throw new OntologyException("AbsTerm cannot be instantiated");
69 }
70
71 /***
72 Return true if
73 - s is the base schema for the XXXSchema class this schema is
74 an instance of (e.g. s is ConceptSchema.getBaseSchema() and this
75 schema is an instance of ConceptSchema)
76 - s is the base schema for a super-class of the XXXSchema class
77 this schema is an instance of (e.g. s is TermSchema.getBaseSchema()
78 and this schema is an instance of ConceptSchema)
79 */
80 protected boolean descendsFrom(ObjectSchema s) {
81 if (s != null) {
82 if (s.equals(getBaseSchema())) {
83 return true;
84 }
85 return super.descendsFrom(s);
86 }
87 else {
88 return false;
89 }
90 }
91 }
92