Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Higgins/ModelAPIs"

(refactor (entity models so far))
Line 17: Line 17:
 
* Java type: some impl of IEntity. The context provider implements this class
 
* Java type: some impl of IEntity. The context provider implements this class
 
* getEntityID() returns: the contextually unique ID for this person
 
* getEntityID() returns: the contextually unique ID for this person
* getAttributes() returns: typical attributes about this person (things like a homeAddress and phoneNumber)
+
* 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/some/name/space#Person”
+
* 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()
 
** Note that getType is only a convenience for getTypeEntity().getEntityID()
 
* getTypeEntity() returns: some impl of IEntity, assume it returns a PersonModel.class
 
* getTypeEntity() returns: some impl of IEntity, assume it returns a PersonModel.class
Line 25: Line 25:
 
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):
 
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):
 
* Java type: some impl of IEntity – This is implemented by the context provider.  We can assume it's a PersonModel.class.
 
* Java type: some impl of IEntity – This is implemented by the context provider.  We can assume it's a PersonModel.class.
* getEntityID() returns: the contextually unique ID for this entity.  This is the same value we got when calling IEntity.getType() on the person instance above, so in this case it would be “http://example.com/some/name/space#Person”.
+
* getEntityID() returns: the contextually unique ID for this entity.  This is the same value we got when calling IEntity.getType() on the person instance above, so in this case it would be “http://example.com/class#Person”.
 
* getAttributes() returns: the following and other attributes:
 
* getAttributes() returns: the following and other attributes:
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypes:  This attribute has values which are pointers to various attribute model entitiesFor example, a value might point at the “http://example.com/some/name/space#telephoneNumber” attribute model entity, and another one might point at the “http://example.com/some/name/space#homeAddress” attribute model entity.
+
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityAttributes:  This attribute has complex values, each of which represent a valid attribute for this type of entityEach value has the following literal elements:
 +
*** http://www.w3.org/2000/01/rdf-schema#Property = <attribute type uri like http://example.com/prop#fullname>
 +
*** http://www.w3.org/2002/07/owl#minCardinality = <minimum cardinality for values of this attribute as it applies to the person model.>  note that  this cannot be less restrictive than the http://www.w3.org/2002/07/owl#minCardinality attribute specified on the property definition representing this attribute.  In other words, if this attribute is in fact http://example.com/prop#fullname, there would be an attribute model for http://example.com/prop#fullname and that attribute model might specify a min cardinality of one.  In that case, min cardinality here cannot be set to zero.
 +
*** http://www.w3.org/2002/07/owl#maxCardinality = <maximum cardinality for values of this attribute as it applies to the person model.>  note that  the same rule applies here as applied to min cardinality. this value cannot be less restrictive than that on the attribute's model
 +
of an which are pointers to various attribute model entities.
 
*** Note that the full list of valid attributes for this type of entity must be discovered by looking at this list as well as the list of all this entity model's supertypes.  We can talk about possible shortcuts to get them all at once.
 
*** Note that the full list of valid attributes for this type of entity must be discovered by looking at this list as well as the list of all this entity model's supertypes.  We can talk about possible shortcuts to get them all at once.
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#supertype:  This attribute would point at another entity model entity.  If person is derived from something like “http://example.com/some/name/space#Mammal” it would point at that.  If person is at the top of it's entity type hierarchy in this context, this attribute would point at a well-known entity model entity that defines IEntity in general (that would be called “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#Entity”)
+
** http://www.w3.org/2000/01/rdf-schema#subClassOf:  This has a single, literal value which names the supertype of person.  If person is derived from something like “http://example.com/class#Mammal” it would name that.  If person is at the top of it's entity type hierarchy in this context, this attribute would name the well-known entity model entity that defines IEntitys in general (that would be called “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#Entity”)
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#EntityModel”
+
* 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#EntityModel”This object would be implemented by Higgins and thus would be the same for all context providers.
+
* getTypeEntity() returns: an implementation of IEntity which represents “http://www.w3.org/2002/07/owl#Class”A default object would be implemented by Higgins, but could be overridden by context providers which wish to add additional capabilities.
  
 
==The "top" entity model==
 
==The "top" entity model==
Line 38: Line 42:
 
* getEntityID() returns: the unique ID for this entity.  This is “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#Entity”
 
* getEntityID() returns: the unique ID for this entity.  This is “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#Entity”
 
* getAttributes() returns: the following attributes:
 
* getAttributes() returns: the following attributes:
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypesOnly one value exists at this point, and that is “http://www.eclipse.org/higgins/ontologies/2006/higgins#EntityID”
+
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityAttributesIn the base higgins definition of the top entity model, only one value exists at this point, and that is:
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#EntityModel”
+
*** http://www.w3.org/2000/01/rdf-schema#Property = http://www.eclipse.org/higgins/ontologies/2006/higgins#EntityID
* getTypeEntity() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#EntityModel”This object would be implemented by Higgins and thus would be the same for all context providers.
+
*** http://www.w3.org/2002/07/owl#minCardinality = 1
 +
*** http://www.w3.org/2002/07/owl#maxCardinality = 1
 +
* getTypeEntity() returns: an implementation of IEntity which represents “http://www.w3.org/2002/07/owl#Class”A default object would be implemented by Higgins, but could be overridden by context providers which wish to add additional capabilities.
  
 
==The model for entity models==
 
==The model for entity models==
 
What defines an entity model entity?  This does:
 
What defines an entity model entity?  This does:
* Java type: an impl of IEntity.  Higgins will provide a default class called EntityModel.class, but a context provider is free to return its own (which may or may not be a subclass of the Higgins EntityModel.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 EntityModel.class, but a context provider is free to return its own (which may or may not be a subclass of the Higgins EntityModel.class), as long as it contains the “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#EntityModelAttributes” and its values mentioned below.  A context provider is free to override and add more values here.
* getEntityID() returns: the unique ID for this entity.  This is “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#EntityModel”
+
* getEntityID() returns: the unique ID for this entity.  This is http://www.w3.org/2002/07/owl#Class
 
* getAttributes() returns: the following attributes:
 
* getAttributes() returns: the following attributes:
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#attributeTypes: These values exists here (note that a context provider may add to this set of values):
+
** http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityModelAttributes: Like http://www.eclipse.org/higgins/ontologies/2006/higgins#entityAttributes, this names the attributes (along with their min/max cardinality) valid for entity modelsThese values exists here (note that a context provider may add to this set of values):
*** “http://www.eclipse.org/higgins/ontologies/2006/higgins#attributeTypes”
+
*** {http://www.w3.org/2000/01/rdf-schema#Property = http://www.eclipse.org/higgins/ontologies/2006/higgins#entityAttributes, minCard = 0, maxCard = 0}
**** Note there's a subtlety here that may look confusing.  The attribute is called attributeTypes and this value is also called attributeTypes.  What we're saying is that this model (which defines what it means to be an entity model – really an entity model model to be precise) specifies that instances (like the model for person, or organization) can have an attribute called attributeTypesWe could rename this value to something like “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#entityAttributeTypes” if that would make it more clear.
+
*** {http://www.w3.org/2000/01/rdf-schema#Property = http://www.w3.org/2000/01/rdf-schema#subClassOf, minCard = 0, maxCard = 1}
*** “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#supertype”
+
* getType() returns: the well-known identifier “http://www.w3.org/2002/07/owl#Class", or maybe null
**** This says that instances (like the model for person, or organization) can have an attribute called supertype. 
+
* getTypeEntity() returns this object, or maybe it should be null
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#ModelModel”
+
* 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.
+
** alternately, this could be null if we just tell people there is no such thing and teach them conceptually what it is.
+
 
+
==The model for model elements==
+
Finally, here's the model for model elements:
+
* Java type: an impl of IEntity called ModelModel.  This is implemented by Higgins and is always the same.
+
* getEntityID() returns: the unique ID for this entity.  This is “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#ModelModel”
+
* getAttributes() returns: the following attributes:
+
** http://www.eclipse.org/higgins/ontologies/2008/86/higgins#attributeTypes:  This only has:
+
*** “http://www.eclipse.org/higgins/ontologies/200/6/higgins#attributeTypes”
+
**** This says that instances (the entities for EntityModel, attributeModel, and valueModel) have an attribute called attributeTypes
+
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2008/6/higgins#ModelModel”
+
* 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.
+
Note the recursive nature of getType and getTypeEntity above.  We could instead return null or throw some well-known exception.
+
  
 
==An attribute model==
 
==An attribute model==

Revision as of 23:38, 28 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):

of an which are pointers to various attribute model entities.

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/some/name/space#homeAddress”:

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:

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