Mechanics relationship queries

Feb 24, 2012 at 4:00 PM

Hi:

I'm trying to use mechanics to model a specific system.

I have a language content type that contains a specific langauges name (english) for example.

I then have a language compitency wich contains a compitency level (intermediate) and the description of what a user should be able to do given that level.

I'm trying to link the two, and have successfully defined the following content type:

ContentDefinitionManager.AlterTypeDefinition("SpokenLanguage", cfg =>cfg.WithPart("ConnectorPart")
.WithSetting("ConnectorTypePartSettings.AllowedContentLeft", "Language")
.WithSetting("ConnectorPartSettings.AllowedContentRight", "Compitency")
.WithSetting("ConnectorTypePartSettings.AllowMany", "false")

.WithSetting("ConnectorTypePartSettings.AllowNone", "false");

 

it's the AllowMany settings I'm having problems with, if I look at this purely simanticly and from a users point of view, one language has one compitency, but many compitencies can belong to one language. but, if I look at this from a database point of view, one language could have many compitencies (one for each user) and one compitency could belong to many languages.

Which way is the correct way of looking at this?

Also can prototypes.lens allow searching of mechanics connectors, for example I want to be able to offer a search facility whereby a user can select a language and see which other users speak that language, limiting this to the provided compitency levels if they wish, is this something lens can do, or am I looking for something else?

Help apreciated as always.

Cheers

Sean.

 

Coordinator
Feb 25, 2012 at 6:59 AM

I think you need to involve the User in the relationship. This is a ternary relationship. Competency will actually be the connector:

Language->Competency->User

So define your competency as:

ContentDefinitionManager.AlterTypeDefinition("Competency", cfg =>cfg.WithPart("ConnectorPart")
.WithSetting("ConnectorTypePartSettings.AllowedContentLeft", "Language")
.WithSetting("ConnectorPartSettings.AllowedContentRight", "User")
.WithSetting("ConnectorTypePartSettings.AllowMany", "true")

.WithSetting("ConnectorTypePartSettings.AllowNone", "true");

So a User can have a Competency in many languages.

Regarding Lens: yes it will be able to search like that, that's one of the aims.

Feb 25, 2012 at 8:29 AM

Hi Pete:

Thanks you are indeed correct, having thought about this that was the correct way to look at this.

I’m glad to see lens will help, that will save me time!

Cheers

Sean.

From: randompete [email removed]
Sent: 25 February 2012 08:00
To: Sean Farrow
Subject: Re: Mechanics relationship queries [scienceproject:344728]

From: randompete

I think you need to involve the User in the relationship. This is a ternary relationship. Competency will actually be the connector:

Language->Competency->User

So define your competency as:

ContentDefinitionManager.AlterTypeDefinition("Competency", cfg =>cfg.WithPart("ConnectorPart")
.WithSetting("ConnectorTypePartSettings.AllowedContentLeft", "Language")
.WithSetting("ConnectorPartSettings.AllowedContentRight", "User")
.WithSetting("ConnectorTypePartSettings.AllowMany", "true")

.WithSetting("ConnectorTypePartSettings.AllowNone", "true");

So a User can have a Competency in many languages.

Regarding Lens: yes it will be able to search like that, that's one of the aims.