Terfin / pyodata-old

An OData framework for Python. It will include a full (as much as possible) implementation of the OData Protocol v4.0
MIT License
0 stars 0 forks source link

Entity Data Model (EDM) #1

Closed Terfin closed 10 years ago

Terfin commented 10 years ago

Basically, this defines how the dataset that the OData protocol works with should look. Sadly, it seems like the OData protocol sprouted from the domain of static typed languages, we might need to think seriously about how to implement this, find an existing solution or provide an alternative solution instead of using the EDM approach. If you ever had the chance to deal with .NET Entity Framework, you should be familiar with the general idea of EDM.

Data Model (DM) Specifications:

1. Represented by a metadata document. 2. Entity Type:     a. Unique Key (a property)     b. Properties     c. Relationships     d. MAY derive from one base entity only. While it may be possible to implement the entity type to support multiple inheritance, limiting it to the single inheritance model will greatly simplify the implementation. It may be wise to keep this open for discussion and modifications in the future.

3. Complex Type:     a. Keyless     b. Composed of properties. (primitives or complex types)     c. private     d. Used as property value or parameters to operations.

4. Properties:     a. Declared property - statically declared property that is defined in the CSDL, can have a primitive value or complex type value.     b. Dynamic property - A property that is not defined in the CSDL.

5. Relationships:     a. Navigation property: A property that its value is a reference to a set of entities. It can be defined in the CSDL or be a dynamic property.     b. A relationship must have a cardinality (one to many, one to one, many to many)

6. Enumeration - A possible type for a property. (Closed set of primitive values that are also represented by numeric values). Implementation notes: Python >= 3.4, use the built in Enum type. Otherwise, find another solution.

7. Type     a. Used to describe a property's type.     b. minimal-maximal length.     c. Precision (if applicable)

8. Entity - Instance of entity type.

9, Entity Set - A collection of entities.

10. Operations -     a. Executes custom logic.     b. Function - Operation that does not a side effect the data, means, no updates or deletes. It MUST return a result.     c. Action - Operation that does have a side effect on the data, means update and delete are available. It MAY return a result.     d. Composition: functions can be composed. Actions MUST NOT be composed.     e. Operations can be bound to the entity type statically (via CSDL) or dynamically to the entity instance itself.     f. Invocation is possible not only from the operation's full URI, but from the service root when using operation import.

11. Singleton - An entity type that can only appear once in the service root. It is accessed regularly via URL, except that its instance is an entity and not an entity set. It supports $expand and $select.

12. OData resource - This basically means what could you require from a service. The possible resources available are entity sets, singletons, property or an operation.

13. Annotations     a. Both the entity type and the entity can be decorated.     b. Each annotation MUST specify one thing and one thing only regarding whatever it decorates.     c. An annotation MUST have 3 defining properties: term, value and target.     d. The annotation value can be either a primitive or an expression that MAY contain a path to one of the annotated entity's properties.     e. A set of related annotations are called "Vocabulary" and can be reused.

Terfin commented 10 years ago

25th April 2014. Feature reviewed and fixes applied. Unless stated otherwise, this feature can proceed to the design stage.