Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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"

(An attribute model=)
Line 9: Line 9:
 
* getAttributes() returns: typical attributes about this person (things like a homeAddress and phoneNumber)
 
* getAttributes() returns: typical attributes about this person (things like a homeAddress and phoneNumber)
 
* getType() returns: an identifier for this person's model node.  assume it's called “http://example.com/some/name/space#Person”
 
* getType() returns: an identifier for this person's model node.  assume it's called “http://example.com/some/name/space#Person”
* getTypeNode() returns: some impl of INode, assume it's called PersonModel
+
* getTypeNode() returns: some impl of INode, assume it returns a PersonModel.class
  
 
==A person's model==
 
==A person's model==
 
Now, say we look at the “person model” node we saw above (we got this either by calling INode.getTypeNode(), or INode.getType() followed by IContext.getTypeNode()), we see (NOTE: this node is a model element):
 
Now, say we look at the “person model” node we saw above (we got this either by calling INode.getTypeNode(), or INode.getType() followed by IContext.getTypeNode()), we see (NOTE: this node is a model element):
* Java type: some impl of INode – This is implemented by the context provider.
+
* Java type: some impl of INode – This is implemented by the context provider.  We can assume it's a PersonModel.class.
 
* getNodeID() returns: the contextually unique ID for this node.  This is the same value we got when calling INode.getType() on the person instance above, so in this case it would be “http://example.com/some/name/space#Person”.
 
* getNodeID() returns: the contextually unique ID for this node.  This is the same value we got when calling INode.getType() on the person instance above, so in this case it would be “http://example.com/some/name/space#Person”.
 
* getAttributes() returns: the following and other attributes:
 
* getAttributes() returns: the following and other attributes:
 
** http://www.eclipse.org/higgins/ontologies/2006/higgins#attributeTypes:  This attribute has values which are pointers to various attribute model nodes.  For example, a value might point at the “http://example.com/some/name/space#telephoneNumber” attribute model node, and another one might point at the “http://example.com/some/name/space#homeAddress” attribute model node.
 
** http://www.eclipse.org/higgins/ontologies/2006/higgins#attributeTypes:  This attribute has values which are pointers to various attribute model nodes.  For example, a value might point at the “http://example.com/some/name/space#telephoneNumber” attribute model node, and another one might point at the “http://example.com/some/name/space#homeAddress” attribute model node.
 
*** Note that the full list of valid attributes for this type of node must be discovered by looking at this list as well as the list of all this node 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 node must be discovered by looking at this list as well as the list of all this node model's supertypes.  We can talk about possible shortcuts to get them all at once.
** http://www.eclipse.org/higgins/ontologies/2006/higgins#supertype:  This attribute would point at another node model node.  If person is derived from something like “http://example.com/some/name/space#Mamal” it would point at that.  If person is at the top of it's node type hierarchy in this context, this attribute would point at a well-known node model node that defines INode in general (assume that would be called “http://www.eclipse.org/higgins/ontologies/2006/higgins#TopNode”)
+
** http://www.eclipse.org/higgins/ontologies/2006/higgins#supertype:  This attribute would point at another node model node.  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 node type hierarchy in this context, this attribute would point at a well-known node model node that defines INode in general (that would be called “http://www.eclipse.org/higgins/ontologies/2006/higgins#Node”)
 
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeModel”
 
* getType() returns: the well-known identifier “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeModel”
 
* getTypeNode() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeModel”.  This object would be implemented by Higgins and thus would be the same for all context providers.
 
* getTypeNode() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeModel”.  This object would be implemented by Higgins and thus would be the same for all context providers.
  
 
==The "top" node model==
 
==The "top" node model==
Ok, now let's look at the instance of the node called “http://www.eclipse.org/higgins/ontologies/2006/higgins#TopNode”.  This is simply the top-level model definition for all node model hierarchies.  Thus it contains model definitions for things common to all nodes:
+
Ok, now let's look at the instance of the node called “http://www.eclipse.org/higgins/ontologies/2006/higgins#Node”.  This is simply the top-level model definition for all node model hierarchies.  Thus it contains model definitions for things common to all nodes:
* Java type: an impl of INode called TopNode.  This is implemented by Higgins and is always the same
+
* Java type: an impl of INode (maybe we'll call it Node.class).  This is implemented by Higgins and is always the same
* getNodeID() returns: the unique ID for this node.  This is “http://www.eclipse.org/higgins/ontologies/2006/higgins#TopNode”
+
* getNodeID() returns: the unique ID for this node.  This is “http://www.eclipse.org/higgins/ontologies/2006/higgins#Node”
 
* getAttributes() returns: the following attributes:
 
* getAttributes() returns: the following attributes:
 
** http://www.eclipse.org/higgins/ontologies/2006/higgins#attributeTypes:  Only one value exists at this point, and that is “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeID”
 
** http://www.eclipse.org/higgins/ontologies/2006/higgins#attributeTypes:  Only one value exists at this point, and that is “http://www.eclipse.org/higgins/ontologies/2006/higgins#NodeID”
Line 82: Line 82:
 
* getTypeNode() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2006/higgins#ModelModel”.  This object would be implemented by Higgins and thus would be the same for all context providers.
 
* getTypeNode() returns: an implementation of “http://www.eclipse.org/higgins/ontologies/2006/higgins#ModelModel”.  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 a node that describes a value type called <TODO>
+
Then of course we have value models.  Again from the bottom-up, here's a node that describes a value type called <TODO: finish this>
 +
 
 +
<TODO> needs to be a way for people to extend NodeModel and AttributeModel such that they can add their own elements (like displayName, icon, etc.>

Revision as of 20:21, 22 February 2008

Today, IdAS defines a set of special interfaces for accessing a context's model elements. It may be better to not define special interfaces for this purpose, but instead simply re-use the existing interfaces that are used to access normal information within a Context (nodes and their attributes).

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

A person

Example of an instance of a person node.

  • Java type: some impl of INode. The context provider implements this class
  • getNodeID() returns: the contextually unique ID for this person
  • getAttributes() returns: typical attributes about this person (things like a homeAddress and phoneNumber)
  • getType() returns: an identifier for this person's model node. assume it's called “http://example.com/some/name/space#Person”
  • getTypeNode() returns: some impl of INode, assume it returns a PersonModel.class

A person's model

Now, say we look at the “person model” node we saw above (we got this either by calling INode.getTypeNode(), or INode.getType() followed by IContext.getTypeNode()), we see (NOTE: this node is a model element):

The "top" node model

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

The model for node models

What defines a node model node? This does:

The model for model elements

Finally, here's the model for model elements:

Note the recursive nature of getType and getTypeNode above. We could instead return null or throw some well-known exception.

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 node identified by “http://www.eclipse.org/higgins/ontologies/2006/higgins#AttributeModel” looks like:

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

<TODO> needs to be a way for people to extend NodeModel and AttributeModel such that they can add their own elements (like displayName, icon, etc.>

Back to the top