Skip to main content
Jump to: navigation, search

Difference between revisions of "Higgins/ModelAPIs"

(updated attribute models)
Line 59: Line 59:
  
 
==An attribute model==
 
==An attribute model==
Now for fun, let's look at an attribute's model, and follow that.  We'll take the example of “http://example.com/some/name/space#homeAddress”:
+
Now for fun, let's look at an attribute's model, and follow that.  We'll take the example of “http://example.com/prop/fullname”:
 
* Java type: an impl of IEntity. This is created by the context provider.
 
* Java type: an impl of IEntity. This is created by the context provider.
* getEntityID() returns: the unique ID for this entity.  In this case it's “http://example.com/some/name/space#homeAddress”
+
* getEntityID() returns: the unique ID for this entity.  In this case it's “http://example.com/prop/fullname”
 
* getAttributes() returns: the following attributes:
 
* getAttributes() returns: the following attributes:
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#valueTypes:  Each value would be the identifier of a model entity which represents a permitted data type for the value(s) of attribute instances that this attribute model defines.  An example might be ** ** “http://www.w3.org/2001/XMLSchema#string ”, but could also point at any other value model.
+
** http://www.w3.org/2000/01/rdf-schema#range:  Each value would be the identifier of a model entity which represents a permitted data type for the value(s) of attribute instances that this attribute model defines.  An example might be “http://www.w3.org/2001/XMLSchema#string ”, but could also point at any other value model.
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#maxCardinality: holds a value which represents the maximum values that can be placed on instances of attributes that this attribute model defines.
+
** http://www.w3.org/2002/07/owl#maxCardinality: holds a value which represents the maximum values that can be placed on instances of attributes that this attribute model defines. This can be made more restrictive as applied to a particular type of entity when the attribute is specified in the http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityAttributes on the entity model for that entity type.
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#minCardinality: holds a value which represents the minimum values that can be placed on instances of attributes that this attribute model defines.
+
** http://www.w3.org/2002/07/owl#minCardinality: holds a value which represents the minimum values that can be placed on instances of attributes that this attribute model defines. This can be made more restrictive as applied to a particular type of entity when the attribute is specified in the http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityAttributes on the entity model for that entity type.
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#supertype:  This attribute would point at another attribute model entity.  If homeAddress is derived from something like “http://example.com/some/name/space#postalAddress” it would point at that.  If homeAddress is at the top of it's entity type hierarchy in this context, this attribute would point at a well-known attribute model entity that defines IAttributes in general (assume that would be called “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#TopAttribute”)
+
** http://www.w3.org/2000/01/rdf-schema#subPropertyOf:  This attribute would point at another attribute model entity.  If fullname is derived from something like “http://example.com/prop#name” it would point at that.  If fullanme is at the top of it's attribute type hierarchy in this context, this attribute would be absent.
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#AttributeModel”
+
* getType() returns: the well-known identifier “ http://www.w3.org/2000/01/rdf-schema#Property”
* getTypeEntity() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#AttributeModel”.  This object would be implemented by Higgins and thus would be the same for all context providers.
+
* getTypeEntity() returns: an implementation of IEntity representing “ http://www.w3.org/2000/01/rdf-schema#Property”.  This object would be implemented by Higgins and thus would be the same for all context providers.
  
 
==The model for attribute models==
 
==The model for attribute models==
And here's that the entity identified by “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#AttributeModel” looks like:
+
And here's that the entity identified by “http://www.w3.org/2000/01/rdf-schema#Property” looks like:
* Java type: an impl of IEntity.  Higgins will provide a default class called AttributeModel.class, but a context provider is free to return its own (which may or may not be a subclass of the Higgins AttributeModel.class), as long as it contains the “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypes” and its values mentioned below.  A context provider is free to add more values to the “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypes” attribute.
+
* Java type: an impl of IEntity.  Higgins will provide a default class called AttributeModel.class, but a context provider is free to return its own (which may or may not be a subclass of the Higgins AttributeModel.class), as long as it contains the “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeAttributes” and its values mentioned below.  A context provider is free to add more values to the “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeAttributes” attribute.
* getEntityID() returns: the unique ID for this entity.  This is http://www.eclipse.org/higgins/ontologies/2008/6/higgins#AttributeModel”
+
* getEntityID() returns: the unique ID for this entity.  This is http://www.w3.org/2000/01/rdf-schema#Property”
 
* getAttributes() returns: the following attributes:
 
* getAttributes() returns: the following attributes:
** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypes”:  These values represent the types of attributes allowed on an attribute model entity (note that a context provider may add to this set of values):
+
** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeAttributes”:  These values represent the types of attributes allowed on an attribute model entity (note that a context provider may add to this set of values):
*** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#valueTypes”
+
*** “http://www.w3.org/2000/01/rdf-schema#range”
*** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#maxCardinality”
+
*** “http://www.w3.org/2002/07/owl#maxCardinality”
*** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#minCardinality”
+
*** “http://www.w3.org/2002/07/owl#minCardinality”
*** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#supertype”
+
*** “http://www.w3.org/2000/01/rdf-schema#subPropertyOf”
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#ModelModel”
+
* getType() returns: the well-known identifier “http://www.w3.org/2002/07/owl#Class”
* getTypeEntity() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#ModelModel”.  This object would be implemented by Higgins and thus would be the same for all context providers.
+
* getTypeEntity() returns: an implementation of IEntity representing “http://www.w3.org/2002/07/owl#Class”.  This object would be implemented by Higgins and thus would be the same for all context providers.
  
 
Then of course we have value models.  Again from the bottom-up, here's an entity that describes a value type called <TODO: finish this>
 
Then of course we have value models.  Again from the bottom-up, here's an entity that describes a value type called <TODO: finish this>

Revision as of 14:19, 29 August 2008

{{#eclipseproject:technology.higgins}}

Higgins logo 76Wx100H.jpg

Problem

Today, IdAS defines a set of special interfaces for accessing a context's model elements. There are a number of problems with these interfaces:

  1. They are 'fixed' in nature. The only way to represent extra information about the model of context elements is to revise these interfaces. For example, say there's a need to associate an image with the attribute called “http://example.com/some/name/space#telephoneNumber” (this image might be used by a management UI). To make that association we need a new method like IAttributeModel.getManagementImage().
    1. Even if we felt like it's ok to revise the current I*Model interfaces, we do not know what kinds of information will need to be associated with the models of elements in a context. It may be the case that some people will have needs that we think are unworthy of revising the interfaces for. For example, say someone wants to associate an astrological symbol to each different attribute model. Does that mean we should add a new IAttributeModel.getAstrologicalSymbol()?
  2. There is no way to update a context's model. We have a need to be able to add models for new entity types, attribute types and so-on. We also need to be able to change existing models (such as changing the cardinality of an attribute). Also, we may need to remove models.
  3. We cannot look up a model with partial information. For example, say I know there's an attribute with the word "telephoneNumber" in its ID, but I don't know the entire ID. It would be nice to be able to have a way to find what I need without enumerating through the entire set of attribute models.

Proposal

It may be better to move away from the existing special interfaces for the purpose of defining the model of elements, but instead simply re-use the existing interfaces that are used to access normal information within a Context (entities and their attributes).

Following is a proposal which shows how these model entities might look. To illustrate the proposal, we start by showing how an instance of a person looks (nothing new) and then examining the model entities that govern instances of entities and attributes:

A person

Example of an instance of a person entity.

  • Java type: some impl of IEntity. The context provider implements this class
  • getEntityID() returns: the contextually unique ID for this person
  • getAttributes() returns: typical attributes about this person (things like a full name and email address)
  • getType() returns: an identifier for this person's model entity. assume it's called “http://example.com/class#Person”
    • Note that getType is only a convenience for getTypeEntity().getEntityID()
  • getTypeEntity() returns: some impl of IEntity, assume it returns a PersonModel.class

A person's model

Now, say we look at the “person model” entity we saw above (we got this either by calling IEntity.getTypeEntity(), or IEntity.getType() followed by IContext.getEntity(EntityID)), we see (NOTE: this entity is a model element):

The "top" entity model

Ok, now let's look at the instance of the entity called “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#Entity”. This is simply the top-level model definition for all entity model hierarchies. Thus it contains model definitions for things common to all entities:

The model for entity models

What defines an entity model entity? This does:

An attribute model

Now for fun, let's look at an attribute's model, and follow that. We'll take the example of “http://example.com/prop/fullname”:

The model for attribute models

And here's that the entity identified by “http://www.w3.org/2000/01/rdf-schema#Property” looks like:

Then of course we have value models. Again from the bottom-up, here's an entity that describes a value type called <TODO: finish this>

TODO

  • We need to be able to specify min/max cardinality on each attributeType associated with a specific entity model so we can preserve the ability to say "person entities must have at least one surname attribute value, and may have a telephone number" without causing all instances of surname to be min=1

Back to the top