jade.content.onto
Class BeanOntology

java.lang.Object
  extended by jade.content.onto.Ontology
      extended by jade.content.onto.BeanOntology
All Implemented Interfaces:
java.io.Serializable

public class BeanOntology
extends Ontology

Extension of Ontology that allows to build the ontological elements adding directly the classes of the corresponding JavaBeans. The BeanOntology internally needs to use its introspector BeanIntrospector. A typical pattern to create an ontology extending the BeanOntology is the following:

 public class MyOntology extends BeanOntology {
private static Ontology theInstance = new MyOntology(ONTOLOGY_NAME); public static Ontology getInstance() { return theInstance; } private MyOntology(String name) { super(name); try { add("com.acme.rocket.ontology"); add(C1.class); add(C2.class); } catch (OntologyException e) { e.printStackTrace(); } } }

The ontology MyOntology will be built creating the hierarchy of ontological items defined by the beans in package com.acme.rocket.ontology plus the two beans C1 and C2. An ontological bean is a class implementing either Concept or Predicate Example:

 public class CD extends Item {

     private String title;
     protected List tracks;

     public String getTitle() {
         return title;
     }

     public void setTitle(String t) {
         title = t;
     }

     @AggregateSlot(cardMin = 1)
     public List getTracks() {
         return tracks;
     }

     public void setTracks(List l) {
         tracks = l;
     }
 }

 

A set of annotatons allow to customize the ontological properties of the slots.

Author:
Paolo Cancedda
See Also:
Concept, Predicate, Element, Slot, SuppressSlot, AggregateSlot, Result, AggregateResult, Ontology, BasicOntology, Serialized Form

Constructor Summary
BeanOntology(java.lang.String name)
          Create an Ontology with the given name.
BeanOntology(java.lang.String name, Ontology base)
          Create an Ontology with the given name that extends the ontology base, which must have BasicOntology in its hierarchy.
BeanOntology(java.lang.String name, Ontology[] base)
          Create an Ontology with the given name that extends the base set of ontologies.
 
Method Summary
 void add(java.lang.Class clazz)
          Adds to the ontology the schema built from the class clazz.
 void add(java.lang.Class clazz, boolean buildHierarchy)
          Adds to the ontology the schema built from the class clazz.
 void add(java.lang.String pkgname)
          Adds all the ontological beans (the ones which implement either Concept or Predicate) found in the specified package.
 void add(java.lang.String pkgname, boolean buildHierarchy)
          Adds all the ontological beans (the ones which implement either Concept or Predicate) found in the specified package.
 
Methods inherited from class jade.content.onto.Ontology
add, add, checkIsTerm, createConceptSlotFunction, dump, dump, externalizeSlotValue, fromObject, getActionNames, getClassForElement, getConceptNames, getIntrospector, getName, getOwnActionNames, getOwnConceptNames, getOwnPredicateNames, getPredicateNames, getSchema, getSchema, internalizeSlotValue, toObject, toString, useConceptSlotsAsFunctions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanOntology

public BeanOntology(java.lang.String name)
Create an Ontology with the given name. The BasicOntology is automatically added as the base ontology.

Parameters:
name - The identifier of the ontology.

BeanOntology

public BeanOntology(java.lang.String name,
                    Ontology base)
Create an Ontology with the given name that extends the ontology base, which must have BasicOntology in its hierarchy.

Parameters:
name - The identifier of the ontology.
base - The base ontology.

BeanOntology

public BeanOntology(java.lang.String name,
                    Ontology[] base)
Create an Ontology with the given name that extends the base set of ontologies. At least one of the base ontologies must extend the ontology BasicOntology.

Parameters:
name - The identifier of the ontology.
base - The base ontologies
Method Detail

add

public void add(java.lang.Class clazz)
         throws BeanOntologyException
Adds to the ontology the schema built from the class clazz. The class must implement either Concept or Predicate.

Parameters:
clazz - class from which to build the ontological schema
Throws:
BeanOntologyException

add

public void add(java.lang.String pkgname)
         throws BeanOntologyException
Adds all the ontological beans (the ones which implement either Concept or Predicate) found in the specified package.

Parameters:
pkgname - name of the package containing the beans
Throws:
BeanOntologyException

add

public void add(java.lang.Class clazz,
                boolean buildHierarchy)
         throws BeanOntologyException
Adds to the ontology the schema built from the class clazz. The class must implement either Concept or Predicate.

Parameters:
clazz - class from which to build the ontological schema
buildHierarchy - if true, build the full hierarchy ontological elements. Otherwise, build a set of flat unrelated elements
Throws:
BeanOntologyException

add

public void add(java.lang.String pkgname,
                boolean buildHierarchy)
         throws BeanOntologyException
Adds all the ontological beans (the ones which implement either Concept or Predicate) found in the specified package.

Parameters:
pkgname - name of the package containing the beans
buildHierarchy - if true, build the full hierarchy ontological elements. Otherwise, build a set of flat unrelated elements
Throws:
BeanOntologyException


These are the official JADE API. For these API backward compatibility is guaranteed accross JADE versions