public abstract class ObjectSchema extends java.lang.Object implements Serializable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
ObjectSchema() |
Modifier and Type | Method and Description |
---|---|
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 including super-schemas |
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)
Retrieves 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 java.lang.String[] |
getOwnNames()
Returns the names of the slots defined in this
Schema
(excluding slots defined in super schemas). |
abstract ObjectSchema |
getSchema(java.lang.String name)
Retrieves the schema of a slot of this
Schema . |
abstract ObjectSchema[] |
getSuperSchemas()
Retrieves an array containing the direct super-schemas of this schema.
|
abstract java.lang.String |
getTypeName()
Retrieves the name of the type of this schema.
|
abstract boolean |
isAssignableFrom(ObjectSchema s)
This method checks whether or not an abstract object that is an instance
of schema s can be used in place of an abstract object that is an instance
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 boolean |
isOwnSlot(java.lang.String name)
Indicate whether a given
String is the name of a
slot actually defined in this Schema (excluding super-schemas) |
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.
|
public static final int MANDATORY
public static final int OPTIONAL
public static final int UNLIMITED
public static final java.lang.String BASE_NAME
protected static ObjectSchema baseSchema
protected boolean encodingByOrder
public static ObjectSchema getBaseSchema()
protected abstract 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 abstract void add(java.lang.String name, ObjectSchema slotSchema)
name
- name of the slot.slotSchema
- schema of the slot.protected abstract void add(java.lang.String name, ObjectSchema elementsSchema, int cardMin, int cardMax)
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
.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 abstract void add(java.lang.String name, ObjectSchema elementsSchema, int cardMin, int cardMax, java.lang.String aggType)
cardMin
and cardMax
to this schema and allow specifying the type
of Aggregate to be used for this slot.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
valuesaggType
- The type of Aggregate to be usedadd(String, ObjectSchema, int, int)
protected abstract void addSuperSchema(ObjectSchema superSchema)
superSchema
- the super schema.protected abstract void addFacet(java.lang.String slotName, Facet f) throws OntologyException
Facet
on a slot of this schemaslotName
- 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 void setEncodingByOrder(boolean b)
public boolean getEncodingByOrder()
public abstract java.lang.String getTypeName()
public abstract java.lang.String[] getNames()
Schema
(including slots defined in super schemas).public abstract java.lang.String[] getOwnNames()
Schema
(excluding slots defined in super schemas).Schema
.public abstract 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 abstract boolean containsSlot(java.lang.String name)
String
is the name of a
slot defined in this Schema
including super-schemasname
- The String
to test.true
if name
is the name of a
slot defined in this Schema
including super-schemas.public abstract boolean isOwnSlot(java.lang.String name)
String
is the name of a
slot actually defined in this Schema
(excluding super-schemas)name
- The String
to test.true
if name
is the name of a
slot actually defined in this Schema
(excluding super-schemas).public abstract boolean isMandatory(java.lang.String name) throws OntologyException
name
- The name of the slot.true
if the slot is mandatory.OntologyException
- If no slot with this name is present
in this schema.public abstract AbsObject newInstance() throws OntologyException
Schema
.OntologyException
public abstract void validate(AbsObject abs, Ontology onto) throws OntologyException
abs
- The abstract descriptor to be checkedOntologyException
- If the abstract descriptor does not
complies with this schemapublic abstract boolean isCompatibleWith(ObjectSchema s)
protected abstract boolean descendsFrom(ObjectSchema s)
public abstract boolean isAssignableFrom(ObjectSchema s)
public abstract ObjectSchema[] getSuperSchemas()
public abstract Facet[] getFacets(java.lang.String slotName)
slotName
- the name of the slot