The thesis Ontological foundations for structural conceptual models states that
"Every relationally dependent entity (role and role mixins) must be
connected to an association end of a «mediation» relation."
(p.332). Why is a <<member of>> relation not enough to satisfy the relational dependance?
There is indeed a pattern of roles and role mixins for members of collectives, however, the membership to the collective has a truthmaker of its own.
If you only use the «memberOf» relation you'll be hiding the relator of "membership" that makes it true that "the endurant plays the role of a member of some collective". In order to have the complete pattern, you should capture the relator and the «mediation» relation between the role and the relator.
Notice that this is a pattern specific to the case involving roles (e.g., employees, students, band members). You can still have cases where there may not be a relator as the truthmaker of the «memberOf» relation.
Take, for instance, the collective Forest whose members are instances of Tree. In this case, you would not be interested in capturing the "membership" between trees and forests and that is OK as Tree should not be a role, but a category, kind or subkind. (hint: the truthmaker here is something more "tricky")
Related
Currently, I'm working on design class model and domain class model.
I have entity class Account and class Member .
I know that class diagrams and ER models can differ from each other.
However, Should I in the ER model include such entities as Account and Member , or can I combine them into Account entity?
First of all, it seems to me that Member belongs to the domain and matters to the business users. It should therefore also be «Entity». But your question seems not really about entities, but more about tables:
Members and Accounts are in your UML distinct classes, since they have different structural and behavioral characteristics. But also in an ER model they would be different entities, as their attributes may vary independently:
Considering that Account and Member are associated one to one in your model, you could consider to store both in a combo-table. That’s an implementation decision about the tables. But it does not really change the entity semantics: a member is still something different from an account.
While you can do this combo-table shortcut, you should ask yourself if this is a good idea in view of the principle of separation of concerns. Keeping them separate will ease your ORM mapping and facilitate maintenance.
If the association of Member with Account would be one-to-many or many-to-many, it would be another story: if you’d combine them into a single table, your relational model would no longer be normalised, and this has many inconveniences.
I've looked at how to do data modelling and have some questions in regards to the use of roles specifically in Grakn.
Let's take a simple case. I have a Company, and that Company can be a Distributor, Supplier, Customer, or any such combination. Company A could be a distributor and a customer at the same time.
If I use a relational database, I would have a table for CompanyS and then tables for SupplierS, CustomerS, etc, which then would reference the Company table.
However, I want to start with a Company and know what roles it is playing without having to create these extra tables. So that in my application I can know that a company is both a distributor and a supplier in a single query.
There's a few ways I can think how to do it, but as I feel this problem domain is so common there must be some best practices for modelling these concepts.
So I am looking for common patterns or strategies to model and name certain entity roles. I am using Grakn. Any help is appreciated.
If I understand right, you mean to ask for general rules of thumb for choosing roles. Choosing roles is also caught up in choosing the naming for your relations, entities and attributes. In the case given, company is ubiquitously modelled as an entity, but there are plenty of examples where you may realise that you had the naming for an entity/relation/role mixed up.
Try this for general guidance:
Entity: Should be capable of its own existence in the world. Can be an abstract concept. Use abstract nouns (company, religion), collective nouns, common nouns.
Relation: Should have existence dependent upon the existence of its role players. Use abstract nouns (marriage, membership, hierarchy) and verbal nouns (authorship, ownership, ).
Role: Should describe a behaviour within the context of a relation. You can try using this sentence: A [entity] behaves like a [role] in a [relation]. For example a station behaves like a stop in a train-route. Should use nouns.
Attributes: Should describe a quantity only e.g. name (string), age (long), colour (string), is-green (boolean), verbose (boolean), is-running (boolean), score (double). Typically nouns or verbs. Anything goes if it describes a value well.
If you struggle to find a noun, use a name that ends with a noun, but prepend with a descriptive term, like authored-book.
At times it may be easier to think of relations in terms of verbs too -- as long as they are gerund tense. For example:
faceting sub relation,
relates facet-assignment,
relates assigned-facet.
listing sub relation,
relates list-assignment,
relates assigned-list.
I'm searching for a solution to model a "can-be" relationship.
E.g.: A User can be Special User.
Any suggestions?
Types for entities can be viewed (results) as one of the following two things:
Relationships
Fields
The types that results in fields are usually seen as functional redundancy, where different rows/records in a table can have the same type. For example, the sex/gender of a user, or access privileges or permission level from a user as well.
If, however, this field has attributes/properties, so we have a new entity. In this case, users would be relating to, for example, address, which may have the street name, house number, among other things. Or, in your case, if Special User has attributes/properties, we have a "Special Users" entity. The cardinality here depends on how many types a user can have, and that takes into account the problem context.
As you say that a user "can be", it means it "can not be" too. You could:
Set a nullable functional redundancy field in Users entity or,
Set an entity "Types of Users" and create a relationship N-N for
"Users". In this case, you would have an intermediate table that
would allow or not the connection between the two entities.
In both approaches you have the ability to add new types of users in the future without effort.
There is a third case, however, referred to as partitioning, where we have types and subtypes of entities. In this case, entities subtypes inherit fields of their super entities. I believe this is not your case here.
If you have any questions, please comment and I will answer.
In EER modelling is it possible and correct to have a disjoint specialization where none of the sub-classes have any specific attributes(local to them) but are entirely grouped on the basis of a defining attribute.For example we can have a USER entity with some attributes of which one is "role".Based on value of role(admin or author or editor) we will have the subclass entities ADMIN ,AUTHOR and EDITOR.None of them has any attributed which are only specific to them.Also please note that the specialization is disjoint and the superclass entity USER has total participation.
And if this is possible, can I convert it to relational model by creating a single relation for the superclass entity USER
Yes, it's possible and valid to do so if you want to record relationships that are restricted to the subtypes. If you don't have subtype-specific attributes or relationships, there's no point in distinguishing subtypes in the ER model. A simple role attribute on the User is sufficient for queries.
If you define subtypes in the ER model, this converts to a relation per subtype in the relational model. If you're looking for something like dependent types, you won't find it in the relational model, which corresponds to first-order logic. ER is even more limited.
In my domain:
Users have many Bills
Bills have many BillItems (and therefore Users have many BillItems through Bills)
Every BillItem is one of:
Call
SMS (text message)
MMS (multimedia message)
Data
Here are the properties of each individual BillItem (some are common):
alt text http://dl.dropbox.com/u/2792776/screenshots/2010-04-13_2146-1.png
My question is whether I should model this arrangement with single-table inheritance (i.e., one "bill_items" table with a "type" column) or polymorphism (separate tables for each BillItem type), and why.
I would go with a Polymorphic association as there are enough fields already that don't apply to all/most of the items. STI will just waste a lot of space, but ignoring optimization, it's also a very rigid design as the most natural way to extend on that design when more fields are required will be to add them to the table.
Polymorphic association on the other hand only specifies a contract that all implementors must follow. In this case the contract only says that an item must be billable, and allows each individual type of item to evolve independently. If there is logic to be shared among these different classes, it might be better to just convert it into a module and include that.