|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjade.content.onto.Ontology
jade.content.onto.BeanOntology
public class BeanOntology
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.
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 |
|---|
public BeanOntology(java.lang.String name)
name.
The BasicOntology is automatically added
as the base ontology.
name - The identifier of the ontology.
public BeanOntology(java.lang.String name,
Ontology base)
name that
extends the ontology base, which must have
BasicOntology in its hierarchy.
name - The identifier of the ontology.base - The base ontology.
public BeanOntology(java.lang.String name,
Ontology[] base)
name that
extends the base set of ontologies. At least
one of the base ontologies must extend the
ontology BasicOntology.
name - The identifier of the ontology.base - The base ontologies| Method Detail |
|---|
public void add(java.lang.Class clazz)
throws BeanOntologyException
clazz.
The class must implement either Concept
or Predicate.
clazz - class from which to build the ontological schema
BeanOntologyException
public void add(java.lang.String pkgname)
throws BeanOntologyException
Concept or Predicate) found in the
specified package.
pkgname - name of the package containing the beans
BeanOntologyException
public void add(java.lang.Class clazz,
boolean buildHierarchy)
throws BeanOntologyException
clazz.
The class must implement either Concept
or Predicate.
clazz - class from which to build the ontological schemabuildHierarchy - if true, build the full hierarchy
ontological elements. Otherwise, build a set of
flat unrelated elements
BeanOntologyException
public void add(java.lang.String pkgname,
boolean buildHierarchy)
throws BeanOntologyException
Concept or Predicate) found in the
specified package.
pkgname - name of the package containing the beansbuildHierarchy - if true, build the full hierarchy
ontological elements. Otherwise, build a set of
flat unrelated elements
BeanOntologyException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||