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.abs.*;
28 import JADE_SL.schema.*;
29
30 /***
31 * @author Federico Bergenti - Universita` di Parma
32 */
33 public interface Introspector {
34
35 /***
36 * Translate an object of a class representing an element in an
37 * ontology into a proper abstract descriptor
38 * @param onto The ontology that uses this Introspector.
39 * @param referenceOnto The reference ontology in the context of
40 * this translation i.e. the most extended ontology that extends
41 * <code>onto</code> (directly or indirectly).
42 * @param obj The Object to be translated
43 * @return The Abstract descriptor produced by the translation
44 * @throws UnknownSchemaException If no schema for the object to be
45 * translated is defined in the ontology that uses this Introspector
46 * @throws OntologyException If some error occurs during the translation
47 */
48 AbsObject externalise(Ontology onto, Ontology referenceOnto, Object obj)
49 throws UnknownSchemaException, OntologyException;
50
51 /***
52 * Translate an abstract descriptor into an object of a proper class
53 * representing an element in an ontology
54 * @param onto The ontology that uses this Introspector.
55 * @param referenceOnto The reference ontology in the context of
56 * this translation i.e. the most extended ontology that extends
57 * <code>onto</code> (directly or indirectly).
58 * @param abs The abstract descriptor to be translated
59 * @return The Java object produced by the translation
60 * @throws UngroundedException If the abstract descriptor to be translated
61 * contains a variable
62 * @throws UnknownSchemaException If no schema for the abstract descriptor
63 * to be translated is defined in the ontology that uses this Introspector
64 * @throws OntologyException If some error occurs during the translation
65 */
66 Object internalise(Ontology onto, Ontology referenceOnto, AbsObject abs)
67 throws UngroundedException, UnknownSchemaException, OntologyException;
68
69 /***
70 Check the structure of a java class associated to an ontological element
71 to ensure that translations to/from abstract descriptors and java objects
72 (instances of that class) can be accomplished by this introspector.
73 @param schema The schema of the ontological element
74 @param javaClass The java class associated to the ontologcal element
75 @throws OntologyException if the java class does not have the correct
76 structure
77 */
78 void checkClass(ObjectSchema schema, Class javaClass) throws OntologyException;
79 }
80