jade.content.schema
Class ObjectSchema

java.lang.Object
  |
  +--jade.content.schema.ObjectSchema
All Implemented Interfaces:
Serializable, java.io.Serializable
Direct Known Subclasses:
jade.content.schema.ObjectSchemaImpl

public abstract class ObjectSchema
extends java.lang.Object
implements Serializable

The common ancestor of all ontological schemas.

Author:
Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
See Also:
Serialized Form

Field Summary
static java.lang.String BASE_NAME
           
protected static ObjectSchema baseSchema
           
protected  boolean encodingByOrder
           
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
static int UNLIMITED
          Canstant value indicating that a slot in a schema has an infinite maximum cardinality
 
Constructor Summary
ObjectSchema()
           
 
Method Summary
protected abstract  void add(java.lang.String name, ObjectSchema slotSchema)
          Add a mandatory slot to the schema.
protected abstract  void add(java.lang.String name, ObjectSchema slotSchema, int optionality)
          Add a slot to the schema.
protected abstract  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 abstract  void add(java.lang.String name, ObjectSchema elementsSchema, int cardMin, int cardMax, java.lang.String aggType)
          Add a slot with cardinality between cardMin and cardMax to this schema and allow specifying the type of Aggregate to be used for this slot.
protected abstract  void addFacet(java.lang.String slotName, Facet f)
          Add a Facet on a slot of this schema
protected abstract  void addSuperSchema(ObjectSchema superSchema)
          Add a super schema tho this schema, i.e. this schema will inherit all characteristics from the super schema
abstract  boolean containsSlot(java.lang.String name)
          Indicate whether a given String is the name of a slot defined in this Schema
protected abstract  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)
static ObjectSchema getBaseSchema()
          Retrieve the generic base schema for all objects.
 boolean getEncodingByOrder()
          Get the indication whether the preferred encoding for the slots of concepts compliant to this schema is by order or by name.
abstract  Facet[] getFacets(java.lang.String slotName)
          Get the facets defined upon a slot.
abstract  java.lang.String[] getNames()
          Returns the names of all the slots in this Schema (including slots defined in super schemas).
abstract  ObjectSchema getSchema(java.lang.String name)
          Retrieves the schema of a slot of this Schema.
abstract  java.lang.String getTypeName()
          Retrieves the name of the type of this schema.
abstract  boolean isCompatibleWith(ObjectSchema s)
          Check if this schema is compatible with a given schema s.
abstract  boolean isMandatory(java.lang.String name)
          Indicate whether a slot of this schema is mandatory
abstract  AbsObject newInstance()
          Creates an Abstract descriptor to hold an object compliant to this Schema.
 void setEncodingByOrder(boolean b)
          Sets an indication about whether the preferred encoding for the slots of concepts compliants to this schema is by oredr or by name.
abstract  void validate(AbsObject abs, Ontology onto)
          Check whether a given abstract descriptor complies with this schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MANDATORY

public static final int MANDATORY
Canstant value indicating that a slot in a schema is mandatory, i.e. its value must not be null

See Also:
Constant Field Values

OPTIONAL

public static final int OPTIONAL
Canstant value indicating that a slot in a schema is optional, i.e. its value can be null

See Also:
Constant Field Values

UNLIMITED

public static final int UNLIMITED
Canstant value indicating that a slot in a schema has an infinite maximum cardinality

See Also:
Constant Field Values

BASE_NAME

public static final java.lang.String BASE_NAME
See Also:
Constant Field Values

baseSchema

protected static ObjectSchema baseSchema

encodingByOrder

protected boolean encodingByOrder
Constructor Detail

ObjectSchema

public ObjectSchema()
Method Detail

getBaseSchema

public static ObjectSchema getBaseSchema()
Retrieve the generic base schema for all objects.

Returns:
the generic base schema for all objects.

add

protected abstract void add(java.lang.String name,
                            ObjectSchema slotSchema,
                            int optionality)
Add a slot to the schema.

Parameters:
name - The name of the slot.
slotSchema - The schema defining the type of the slot.
optionality - The optionality, i.e., OPTIONAL or MANDATORY

add

protected abstract void add(java.lang.String name,
                            ObjectSchema slotSchema)
Add a mandatory slot to the schema.

Parameters:
name - name of the slot.
slotSchema - schema of the slot.

add

protected abstract void add(java.lang.String name,
                            ObjectSchema elementsSchema,
                            int cardMin,
                            int cardMax)
Add a slot with cardinality between cardMin and cardMax to this schema. Adding such a slot corresponds 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. By default the Aggregate is of type BasicOntology.SEQUENCE.

Parameters:
name - The name of the slot.
elementsSchema - The schema for the elements of this slot.
cardMin - This slot must get at least cardMin values
cardMax - This slot can get at most cardMax values

add

protected abstract void add(java.lang.String name,
                            ObjectSchema elementsSchema,
                            int cardMin,
                            int cardMax,
                            java.lang.String aggType)
Add a slot with cardinality between cardMin and cardMax to this schema and allow specifying the type of Aggregate to be used for this slot.

Parameters:
name - The name of the slot.
elementsSchema - The schema for the elements of this slot.
cardMin - This slot must get at least cardMin values
cardMax - This slot can get at most cardMax values
aggType - The type of Aggregate to be used
See Also:
add(String, ObjectSchema, int, int)

addSuperSchema

protected abstract void addSuperSchema(ObjectSchema superSchema)
Add a super schema tho this schema, i.e. this schema will inherit all characteristics from the super schema

Parameters:
superSchema - the super schema.

addFacet

protected abstract void addFacet(java.lang.String slotName,
                                 Facet f)
                          throws OntologyException
Add a Facet on a slot of this schema

Parameters:
slotName - the name of the slot the Facet must be added to.
f - the Facet to be added.
Throws:
OntologyException - if slotName does not identify a valid slot in this schema

setEncodingByOrder

public void setEncodingByOrder(boolean b)
Sets an indication about whether the preferred encoding for the slots of concepts compliants to this schema is by oredr or by name. It should be noted however that the Content Language encoder is free to use or ignore this indication depending on the CL grammar and actual implementation.


getEncodingByOrder

public boolean getEncodingByOrder()
Get the indication whether the preferred encoding for the slots of concepts compliant to this schema is by order or by name.


getTypeName

public abstract java.lang.String getTypeName()
Retrieves the name of the type of this schema.

Returns:
the name of the type of this schema.

getNames

public abstract java.lang.String[] getNames()
Returns the names of all the slots in this Schema (including slots defined in super schemas).

Returns:
the names of all slots.

getSchema

public abstract ObjectSchema getSchema(java.lang.String name)
                                throws OntologyException
Retrieves the schema of a slot of this Schema.

Parameters:
name - The name of the slot.
Returns:
the Schema of slot name
Throws:
OntologyException - If no slot with this name is present in this schema.

containsSlot

public abstract boolean containsSlot(java.lang.String name)
Indicate whether a given String is the name of a slot defined in this Schema

Parameters:
name - The String to test.
Returns:
true if name is the name of a slot defined in this Schema.

isMandatory

public abstract boolean isMandatory(java.lang.String name)
                             throws OntologyException
Indicate whether a slot of this schema is mandatory

Parameters:
name - The name of the slot.
Returns:
true if the slot is mandatory.
Throws:
OntologyException - If no slot with this name is present in this schema.

newInstance

public abstract AbsObject newInstance()
                               throws OntologyException
Creates an Abstract descriptor to hold an object compliant to this Schema.

OntologyException

validate

public abstract void validate(AbsObject abs,
                              Ontology onto)
                       throws OntologyException
Check whether a given abstract descriptor complies with this schema.

Parameters:
abs - The abstract descriptor to be checked
Throws:
OntologyException - If the abstract descriptor does not complies with this schema

isCompatibleWith

public abstract boolean isCompatibleWith(ObjectSchema s)
Check if this schema is compatible with a given schema s. This is the case if 1) This schema is equals to s 2) s is one of the super-schemas of this schema 3) This schema descends from s i.e. - 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)


descendsFrom

protected abstract 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)


getFacets

public abstract Facet[] getFacets(java.lang.String slotName)
Get the facets defined upon a slot. More in details this method returns all facets defined in this schema plus all facets defined in super-schemas up to the schema actually declaring the given slot.

Parameters:
slotName - the name of the slot
Returns:
the facets defined upon a slot or null if the specified slot is not found.


JADE