|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectJADE_SL.schema.ObjectSchema
| Nested Class Summary | |
private class |
ObjectSchema.SlotDescriptor
|
| Field Summary | |
static java.lang.String |
BASE_NAME
|
private static ObjectSchema |
baseSchema
|
private java.util.Hashtable |
facets
|
static int |
MANDATORY
Canstant value indicating that a slot in a schema is mandatory, i.e. its value must not be null |
static int |
OPTIONAL
Canstant value indicating that a slot in a schema is optional, i.e. its value can be null |
private java.util.Hashtable |
slots
|
private java.util.Vector |
superSchemas
|
private java.lang.String |
typeName
|
static int |
UNLIMITED
Canstant value indicating that a slot in a schema has an infinite maximum cardinality |
| Constructor Summary | |
private |
ObjectSchema()
Construct a schema that vinculates an entity to be a generic object (i.e. no constraints at all) |
protected |
ObjectSchema(java.lang.String typeName)
Creates an ObjectSchema with a given type-name. |
| Method Summary | |
protected void |
add(java.lang.String name,
ObjectSchema slotSchema)
Add a mandatory slot to the schema. |
protected void |
add(java.lang.String name,
ObjectSchema slotSchema,
int optionality)
Add a slot to the schema. |
protected void |
add(java.lang.String name,
ObjectSchema elementsSchema,
int cardMin,
int cardMax)
Add a slot with cardinality between cardMin
and cardMax to this schema.
|
protected void |
addFacet(java.lang.String slotName,
Facet f)
Add a Facet on a slot of this schema |
protected void |
addSuperSchema(ObjectSchema superSchema)
Add a super schema tho this schema, i.e. this schema will inherit all characteristics from the super schema |
boolean |
containsSlot(java.lang.String name)
Indicate whether a given String is the name of a
slot defined in this Schema |
protected boolean |
descendsFrom(ObjectSchema s)
Return true if - s is the base schema for the XXXSchema class this schema is an instance of (e.g. s is ConceptSchema.getBaseSchema() and this schema is an instance of ConceptSchema) - s is the base schema for a super-class of the XXXSchema class this schema is an instance of (e.g. s is TermSchema.getBaseSchema() and this schema is an instance of ConceptSchema) |
boolean |
equals(java.lang.Object o)
|
private void |
getAllSlotDescriptors(java.util.Vector v)
|
static ObjectSchema |
getBaseSchema()
Retrieve the generic base schema for all objects. |
java.lang.String[] |
getNames()
Returns the names of all the slots in this Schema
(including slots defined in super schemas). |
ObjectSchema |
getSchema(java.lang.String name)
Retrieves the schema of a slot of this Schema. |
java.lang.String |
getTypeName()
Retrieves the name of the type of this schema. |
boolean |
isCompatibleWith(ObjectSchema s)
Check if this schema is compatible with a given schema s. |
private boolean |
isSubSchemaOf(ObjectSchema s)
Return true if s is a super-schema (directly or indirectly) of this schema |
AbsObject |
newInstance()
Creates an Abstract descriptor to hold an object compliant to this Schema. |
java.lang.String |
toString()
|
void |
validate(AbsObject abs,
Ontology onto)
Check whether a given abstract descriptor complies with this schema. |
private boolean |
validate(java.lang.String slotName,
AbsObject value,
Ontology onto)
Validate a given abstract descriptor as a value for a slot defined in this schema |
protected void |
validateSlots(AbsObject abs,
Ontology onto)
For each slot - get the corresponding attribute value from the abstract descriptor abs - Check that it is not null if the slot is mandatory - Check that its schema is compatible with the schema of the slot - Check that it is a correct abstract descriptor by validating it against its schema. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MANDATORY
public static final int OPTIONAL
public static final int UNLIMITED
private java.util.Hashtable slots
private java.util.Vector superSchemas
private java.lang.String typeName
private java.util.Hashtable facets
public static final java.lang.String BASE_NAME
private static ObjectSchema baseSchema
| Constructor Detail |
private ObjectSchema()
protected ObjectSchema(java.lang.String typeName)
ObjectSchema with a given type-name.
typeName - The name of this ObjectSchema.| Method Detail |
public static ObjectSchema getBaseSchema()
protected void add(java.lang.String name,
ObjectSchema slotSchema,
int optionality)
name - The name of the slot.slotSchema - The schema defining the type of the slot.optionality - The optionality, i.e., OPTIONAL
or MANDATORY
protected void add(java.lang.String name,
ObjectSchema slotSchema)
name - name of the slot.slotSchema - schema of the slot.
protected void add(java.lang.String name,
ObjectSchema elementsSchema,
int cardMin,
int cardMax)
cardMin
and cardMax to this schema.
Adding such a slot is equivalent to add a slot
of type Aggregate and then to add proper facets (constraints)
to check that the type of the elements in the aggregate are
compatible with elementsSchema and that the
aggregate contains at least cardMin elements and
at most cardMax elements.
name - The name of the slot.elementsSchema - The schema for the elements of this slot.cardMin - This slot must get at least cardMin
valuescardMax - This slot can get at most cardMax
valuesprotected void addSuperSchema(ObjectSchema superSchema)
superSchema - the super schema.
protected void addFacet(java.lang.String slotName,
Facet f)
throws OntologyException
Facet on a slot of this schema
slotName - the name of the slot the Facet
must be added to.f - the Facet to be added.
OntologyException - if slotName does not identify
a valid slot in this schemapublic java.lang.String getTypeName()
public java.lang.String[] getNames()
Schema
(including slots defined in super schemas).
public ObjectSchema getSchema(java.lang.String name)
throws OntologyException
Schema.
name - The name of the slot.
Schema of slot name
OntologyException - If no slot with this name is present
in this schema.public boolean containsSlot(java.lang.String name)
String is the name of a
slot defined in this Schema
name - The String to test.
true if name is the name of a
slot defined in this Schema.
public AbsObject newInstance()
throws OntologyException
Schema.
OntologyExceptionprivate void getAllSlotDescriptors(java.util.Vector v)
public void validate(AbsObject abs,
Ontology onto)
throws OntologyException
abs - The abstract descriptor to be checked
OntologyException - If the abstract descriptor does not
complies with this schema
protected void validateSlots(AbsObject abs,
Ontology onto)
throws OntologyException
OntologyException
private boolean validate(java.lang.String slotName,
AbsObject value,
Ontology onto)
throws OntologyException
slotName - The name of the slotvalue - The abstract descriptor to be validated
OntologyException - If the abstract descriptor is not a
valid valuepublic boolean isCompatibleWith(ObjectSchema s)
protected boolean descendsFrom(ObjectSchema s)
private boolean isSubSchemaOf(ObjectSchema s)
public java.lang.String toString()
public boolean equals(java.lang.Object o)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||