Scenario 5: Modelling the Buyer to Sales transaction relationship

Avatar

Avatar
Validate 1
Employee
Linda_Stinson
Employee

Likes

51 likes

Total Posts

250 posts

Correct reply

77 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 20
Ignite 10
View profile

Avatar
Validate 1
Employee
Linda_Stinson
Employee

Likes

51 likes

Total Posts

250 posts

Correct reply

77 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 20
Ignite 10
View profile
Linda_Stinson
Employee

20-06-2014

Using what you have learned, how would you model the relationship between a buyer and their sales transactions? What would you add and to what schema? What would be the impact on the underlying tables?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Employee
Linda_Stinson
Employee

Likes

51 likes

Total Posts

250 posts

Correct reply

77 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 20
Ignite 10
View profile

Avatar
Validate 1
Employee
Linda_Stinson
Employee

Likes

51 likes

Total Posts

250 posts

Correct reply

77 solutions
Top badges earned
Validate 1
Ignite 5
Ignite 3
Ignite 20
Ignite 10
View profile
Linda_Stinson
Employee

27-06-2014

Keeping in mind that every order has a single buyer, but every buyer (Recipient) can have multiple orders, you would define the link in the order schema.  Most relationships are 1:1 in one direction and 1:M in the reverse direction.  You define the link in the 1:1 "direction". This has been done with neo:order.

    <element label="buyer" name="buyer" target="nms:recipient" type="link"/>

The reverse link (revlink) is generated (and can be viewed in the Preview) but not stored in the database as shown in the nms:recipient schema Preview:

<element label="order" name="order-buyer" revLink="buyer" target="neo:order" type="link" unbound="true">

      <join xpath-dst="@buyer-id" xpath-src="@id"/>

    </element>

To define a true M:M relationship you have to define a table to hold each relationship. This has been done with the xtk:rights schema that is used to configure the Operator rights on folders. Each entry in this table has a link to an Operator or Operator Group and a link to a Folder:

   <element desc="Right associated to folder" label="Folder" name="folder" revIntegrity="own"

             revLabel="Rights" revLink="rights" target="xtk:folder" type="link"/>

    <element label="Operators or groups" name="operator" revIntegrity="own" revLabel="Rights"

             revLink="rights" target="xtk:opsecurity, xtk:operator" type="link"/>

Hope this helps!

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
ruby_comp
Level 1

Like

1 like

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
ruby_comp
Level 1

Like

1 like

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
ruby_comp
Level 1

20-06-2014

1) M:M

2) Add a database index to the srcSchema

3) Impact would be improved speed