Library

Video Player is loading.
 
Current Time 0:00
Duration 9:24
Loaded: 0%
 

x1.00


Back

Games & Quizzes

Training Mode - Typing
Fill the gaps to the Lyric - Best method
Training Mode - Picking
Pick the correct word to fill in the gap
Fill In The Blank
Find the missing words in a sentence Requires 5 vocabulary annotations
Vocabulary Match
Match the words to the definitions Requires 10 vocabulary annotations

You may need to watch a part of the video to unlock quizzes

Don't forget to Sign In to save your points

Challenge Accomplished

PERFECT HITS +NaN
HITS +NaN
LONGEST STREAK +NaN
TOTAL +
- //

We couldn't find definitions for the word you were looking for.
Or maybe the current language is not supported

  • 00:00

    Hello and welcome to modeling data relationships with OutSystems.
    Hello and welcome to modeling data relationships with OutSystems.

  • 00:04

    This is a follow-up to modeling data, so if you haven't watched that lesson yet
    This is a follow-up to modeling data, so if you haven't watched that lesson yet

  • 00:08

    please do so before proceeding.
    please do so before proceeding.

  • 00:11

    When we talked about data modeling, we described it as the process of mapping
    When we talked about data modeling, we described it as the process of mapping

  • 00:15

    concepts of your application into data types. Now, data types are rarely
    concepts of your application into data types. Now, data types are rarely

  • 00:21

    isolated, they normally are connected in some way, they are related in some way
    isolated, they normally are connected in some way, they are related in some way

  • 00:25

    and in this particular lesson we will use a data model around the concepts of
    and in this particular lesson we will use a data model around the concepts of

  • 00:30

    books and authors and publishers to describe how these relationships can be
    books and authors and publishers to describe how these relationships can be

  • 00:34

    obtained in the OutSystems platform. Before we go into the specifics of
    obtained in the OutSystems platform. Before we go into the specifics of

  • 00:40

    OutSystems
    OutSystems

  • 00:41

    let's talk a little bit about how data is referenced in general terms, in
    let's talk a little bit about how data is referenced in general terms, in

  • 00:45

    databases. You have the concept of a primary key, this is a way to uniquely
    databases. You have the concept of a primary key, this is a way to uniquely

  • 00:51

    identify a particular record of your data type. Now, primary keys can be of two
    identify a particular record of your data type. Now, primary keys can be of two

  • 00:56

    kinds, they can either be a simple primary key, where a single attribute on
    kinds, they can either be a simple primary key, where a single attribute on

  • 01:02

    that database table dictates the uniqueness of the record, or a composite
    that database table dictates the uniqueness of the record, or a composite

  • 01:08

    primary key, whereby a collection of columns in the database table dictates a
    primary key, whereby a collection of columns in the database table dictates a

  • 01:15

    unique record. Now, from the viewpoint of a second data type that wants to
    unique record. Now, from the viewpoint of a second data type that wants to

  • 01:21

    reference a data type that has a primary key, you have the concept of a foreign
    reference a data type that has a primary key, you have the concept of a foreign

  • 01:26

    key. The foreign key, on a record of the second data type, will hold the value of
    key. The foreign key, on a record of the second data type, will hold the value of

  • 01:30

    the primary key, on the record of the first data type, that it wants to
    the primary key, on the record of the first data type, that it wants to

  • 01:35

    reference. If for some reason you do not want to reference a record on the first
    reference. If for some reason you do not want to reference a record on the first

  • 01:40

    data type, there's a special value that the foreign key can have, which is the
    data type, there's a special value that the foreign key can have, which is the

  • 01:44

    Null, indicating that this particular record doesn't bear an equivalent on the
    Null, indicating that this particular record doesn't bear an equivalent on the

  • 01:50

    first data table. Now, in OutSystems, to implement a primary key, you need to have
    first data table. Now, in OutSystems, to implement a primary key, you need to have

  • 01:55

    an identifier attribute. This is created for you automatically by the
    an identifier attribute. This is created for you automatically by the

  • 02:00

    platform but you can adjust its type to be an integer, long integer, or
    platform but you can adjust its type to be an integer, long integer, or

  • 02:04

    text. These attributes are always mandatory and in the case that you opt
    text. These attributes are always mandatory and in the case that you opt

  • 02:10

    for an integer based
    for an integer based

  • 02:12

    identifier, it will be auto-numbered, meaning that every time you insert a new
    identifier, it will be auto-numbered, meaning that every time you insert a new

  • 02:18

    row into the table of this entity it will also generate the new ID. It is
    row into the table of this entity it will also generate the new ID. It is

  • 02:24

    important to note that only simple primary keys exist in OutSystems, so you
    important to note that only simple primary keys exist in OutSystems, so you

  • 02:29

    can only have one single attribute to index into a certain entity, so you
    can only have one single attribute to index into a certain entity, so you

  • 02:36

    cannot implement composite keys as we've seen in the first slide. To implement a
    cannot implement composite keys as we've seen in the first slide. To implement a

  • 02:41

    foreign key in OutSystems, you use a reference attribute in the second entity
    foreign key in OutSystems, you use a reference attribute in the second entity

  • 02:47

    that you have, and it needs to be of the data type of the identifier, of the first
    that you have, and it needs to be of the data type of the identifier, of the first

  • 02:54

    entity that you want to point to. By setting these mandatory, you will be able to tell
    entity that you want to point to. By setting these mandatory, you will be able to tell

  • 02:59

    the database that it should enforce a non-Null value every time a new record is
    the database that it should enforce a non-Null value every time a new record is

  • 03:04

    inserted. When creating an attribute, if you name it
    inserted. When creating an attribute, if you name it

  • 03:07

    EntityNameID, by the rules of the name matching and the accelerator that we
    EntityNameID, by the rules of the name matching and the accelerator that we

  • 03:13

    described in the other data modeling lesson, you will immediately get an
    described in the other data modeling lesson, you will immediately get an

  • 03:19

    attribute of the target entity identifier type. In case you want to
    attribute of the target entity identifier type. In case you want to

  • 03:25

    insert a null, therefore stating that this record has no equivalent on the first
    insert a null, therefore stating that this record has no equivalent on the first

  • 03:31

    entity, you can use the NullIdentifier() function. Let's look now into some of the
    entity, you can use the NullIdentifier() function. Let's look now into some of the

  • 03:37

    usual patterns for data modeling using relationships. The first one is an
    usual patterns for data modeling using relationships. The first one is an

  • 03:41

    extension entity, where its ID is actually of the type of another entity's
    extension entity, where its ID is actually of the type of another entity's

  • 03:48

    identifier, this carries the concept that the second entity cannot live, cannot
    identifier, this carries the concept that the second entity cannot live, cannot

  • 03:54

    exist, without the first entity having been created first.
    exist, without the first entity having been created first.

  • 03:59

    You must therefore always have created an author, obtain his ID and use it
    You must therefore always have created an author, obtain his ID and use it

  • 04:05

    explicitly in the biography that you're about to create in the database, before it
    explicitly in the biography that you're about to create in the database, before it

  • 04:10

    gets inserted. This extension or one-to-one relationship is called so
    gets inserted. This extension or one-to-one relationship is called so

  • 04:15

    because, each single biography belongs only to a single author and by view of
    because, each single biography belongs only to a single author and by view of

  • 04:22

    the fact, that author ID is a
    the fact, that author ID is a

  • 04:25

    primary key of biography, you cannot have two biographies with the same author ID
    primary key of biography, you cannot have two biographies with the same author ID

  • 04:30

    therefore each author has at most one biography. It's easy to see that in
    therefore each author has at most one biography. It's easy to see that in

  • 04:36

    concept, these two entities could actually be the same, they could actually
    concept, these two entities could actually be the same, they could actually

  • 04:40

    be joined together into a single entity, but for some design reason we decided
    be joined together into a single entity, but for some design reason we decided

  • 04:46

    not to do it explicitly and used instead the extension pattern. The second and most
    not to do it explicitly and used instead the extension pattern. The second and most

  • 04:53

    common pattern is the master detail pattern. In this case the detail entity
    common pattern is the master detail pattern. In this case the detail entity

  • 04:58

    references the master entity, in our example, a publisher publishes multiple
    references the master entity, in our example, a publisher publishes multiple

  • 05:03

    books, so each book has got a publisher ID referencing who is the publisher for
    books, so each book has got a publisher ID referencing who is the publisher for

  • 05:10

    that book. In your application, if you decided certain books may not have a
    that book. In your application, if you decided certain books may not have a

  • 05:15

    publisher (they might be self-published for example), you might want to not
    publisher (they might be self-published for example), you might want to not

  • 05:20

    enforce these as mandatory. Therefore you would be able to create books without
    enforce these as mandatory. Therefore you would be able to create books without

  • 05:24

    setting a publisher, by leaving the publisher ID as a Null identifier. This
    setting a publisher, by leaving the publisher ID as a Null identifier. This

  • 05:29

    master detail or one-too-many pattern is called so because each publisher may
    master detail or one-too-many pattern is called so because each publisher may

  • 05:35

    have many books and in turn multiple books may belong to a single publisher.
    have many books and in turn multiple books may belong to a single publisher.

  • 05:41

    The third pattern that we're going to talk about is the junction entity, it is
    The third pattern that we're going to talk about is the junction entity, it is

  • 05:46

    implemented by having a third entity that correlates two entities. Since the
    implemented by having a third entity that correlates two entities. Since the

  • 05:53

    book can have multiple authors and an author can, in turn, write multiple books
    book can have multiple authors and an author can, in turn, write multiple books

  • 05:57

    it's easy to see that we cannot use a master-detail relationship, as we
    it's easy to see that we cannot use a master-detail relationship, as we

  • 06:03

    described previously. So we use this junction entity BookAuthor, that
    described previously. So we use this junction entity BookAuthor, that

  • 06:08

    references the author by its ID and references the book also by its ID.
    references the author by its ID and references the book also by its ID.

  • 06:14

    This junction entity leverages and many-to-many relationship because each
    This junction entity leverages and many-to-many relationship because each

  • 06:19

    author may have written multiple books and each single book may have multiple
    author may have written multiple books and each single book may have multiple

  • 06:24

    authors. Now, how do you enforce the cohesion of your data model of the data
    authors. Now, how do you enforce the cohesion of your data model of the data

  • 06:29

    in your database, how do you enforce referential integrity? In the OutSystems
    in your database, how do you enforce referential integrity? In the OutSystems

  • 06:35

    platform you do so by specifying
    platform you do so by specifying

  • 06:37

    the delete rule on a reference attribute. You need to set the delete rule in every
    the delete rule on a reference attribute. You need to set the delete rule in every

  • 06:43

    single entity referenced attribute and it needs to be one of the following values:
    single entity referenced attribute and it needs to be one of the following values:

  • 06:49

    it can be set to protect, which means that a record on the entity being
    it can be set to protect, which means that a record on the entity being

  • 06:55

    referenced cannot be deleted as long as there are records in this entity that
    referenced cannot be deleted as long as there are records in this entity that

  • 07:01

    are pointing at it. This is the default setting. It can also be set to delete
    are pointing at it. This is the default setting. It can also be set to delete

  • 07:06

    which means that deleting a record on the entity, being referenced, will
    which means that deleting a record on the entity, being referenced, will

  • 07:11

    automatically delete the records on the current entity that point at it. Finally
    automatically delete the records on the current entity that point at it. Finally

  • 07:16

    there's the ignore option:
    there's the ignore option:

  • 07:18

    this means that deleting a record on the entity being referenced will do
    this means that deleting a record on the entity being referenced will do

  • 07:22

    nothing in the current entity. This does not guarantee, therefore, the referential
    nothing in the current entity. This does not guarantee, therefore, the referential

  • 07:28

    integrity in this relation and it's a very, very uncommon pattern to use. In
    integrity in this relation and it's a very, very uncommon pattern to use. In

  • 07:34

    the interest of performance, the OutSystems platform also allows you to create indexes
    the interest of performance, the OutSystems platform also allows you to create indexes

  • 07:39

    over attributes in your entities. If you want to speed up fetches when filtering
    over attributes in your entities. If you want to speed up fetches when filtering

  • 07:44

    over a known set of attributes, you should create an index over those attributes. It's
    over a known set of attributes, you should create an index over those attributes. It's

  • 07:50

    important to note that entity reference attributes, already have automatically
    important to note that entity reference attributes, already have automatically

  • 07:56

    indexes created on them.
    indexes created on them.

  • 07:58

    It's worth noting that you can set an index to be unique, which allows the
    It's worth noting that you can set an index to be unique, which allows the

  • 08:02

    database to enforce that no two records will ever have the same combined value
    database to enforce that no two records will ever have the same combined value

  • 08:07

    over the attributes that make up that unique index. This is quite handy and
    over the attributes that make up that unique index. This is quite handy and

  • 08:12

    among other things, it will allow you to simulate composite keys. Now you've been
    among other things, it will allow you to simulate composite keys. Now you've been

  • 08:18

    doing all of this modeling and it's quite useful to actually have a visual
    doing all of this modeling and it's quite useful to actually have a visual

  • 08:23

    representation of your model so you know where you're at, and this is where
    representation of your model so you know where you're at, and this is where

  • 08:26

    the entity diagram comes in. Inside service studio you can create as many entity
    the entity diagram comes in. Inside service studio you can create as many entity

  • 08:32

    diagrams as you want and by dragging and dropping your entities into it, you will
    diagrams as you want and by dragging and dropping your entities into it, you will

  • 08:37

    be able to get the visual representation
    be able to get the visual representation

  • 08:39

    of the data model of the relationships between the entities that you've dragged. In this
    of the data model of the relationships between the entities that you've dragged. In this

  • 08:44

    screenshot we can see our book related data model and the relationships that
    screenshot we can see our book related data model and the relationships that

  • 08:49

    all of the entities have with each other.
    all of the entities have with each other.

  • 08:51

    Notice that the relationships between the entities are actually color-coded in
    Notice that the relationships between the entities are actually color-coded in

  • 08:56

    the entity diagram: so in a strong gray you have those entity references where
    the entity diagram: so in a strong gray you have those entity references where

  • 09:03

    the delete rule is protect, in red you have those entity references where the
    the delete rule is protect, in red you have those entity references where the

  • 09:09

    delete rule is delete and finally, on the light gray you have ignore delete
    delete rule is delete and finally, on the light gray you have ignore delete

  • 09:16

    rules and this is it for modeling data relationships with OutSystems. See you
    rules and this is it for modeling data relationships with OutSystems. See you

  • 09:21

    guys on the next lesson!
    guys on the next lesson!

All noun
relationships
/rəˈlāSH(ə)nˌSHip/

word

way in which two or more people or things are connected

08 Modeling Data Relationships

18,619 views

Video Language:

  • English

Caption Language:

  • English (en)

Accent:

  • English (US)

Speech Time:

99%
  • 9:20 / 9:23

Speech Rate:

  • 151 wpm - Fast

Category:

  • Science & Technology

Tags :

Intro:

Hello and welcome to modeling data relationships with OutSystems.
This is a follow-up to modeling data, so if you haven't watched that lesson yet
please do so before proceeding.. When we talked about data modeling, we described it as the process of mapping
concepts of your application into data types. Now, data types are rarely
isolated, they normally are connected in some way, they are related in some way
and in this particular lesson we will use a data model around the concepts of
books and authors and publishers to describe how these relationships can be
obtained in the OutSystems platform. Before we go into the specifics of
OutSystems. let's talk a little bit about how data is referenced in general terms, in
databases. You have the concept of a primary key, this is a way to uniquely
identify a particular record of your data type. Now, primary keys can be of two
kinds, they can either be a simple primary key, where a single attribute on
that database table dictates the uniqueness of the record, or a composite
primary key, whereby a collection of columns in the database table dictates a
unique record. Now, from the viewpoint of a second data type that wants to
reference a data type that has a primary key, you have the concept of a foreign
key. The foreign key, on a record of the second data type, will hold the value of
the primary key, on the record of the first data type, that it wants to

Video Vocabulary

/ˈprīˌmerē/

adjective noun verb

principal. preliminary election. run as opponent of incumbent in preliminary election.

welcome - welcome

/ˈwelkəm/

adjective exclamation noun verb

gladly received. used to greet someone in polite or friendly way. Friendly greeting to someone who has arrived. To accept or receive something happily and gladly.

/ˌôdəˈmadiklē/

adverb

by itself with little or no direct human control.

/wäCH/

verb

To look at something for entertainment, e.g. TV.

/dəˈskrīb/

verb

give detailed account in words of.

/ˈindəˌkāt/

verb

point out.

/ˈspeSHəl/

adjective noun

Being additional or extra. Heavily discounted sales item.

/īˈden(t)əˌfīər/

noun

Character establishing the identity of something.

/rəˈlāSH(ə)nˌSHip/

noun other

way in which two or more people or things are connected. Ways in which people interact/live with each other.

/īˈden(t)əˌfī/

verb

To indicate who or what someone or something is.

/(h)werˈbī/

adverb

by which.

/pə(r)ˈtikyələr/

adjective noun

singling out individual member of group. individual item.

/ˈref(ə)rəns/

verb

provide book or article with citations of sources of information.

/yo͞oˈnēknəs/

noun

quality of being only one of its kind.

/ˈfôrən/

adjective

Being of a different place or country.