0% ont trouvé ce document utile (0 vote)
11 vues7 pages

Modélisation de données JSON

Transféré par

mohamed sayari
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd
0% ont trouvé ce document utile (0 vote)
11 vues7 pages

Modélisation de données JSON

Transféré par

mohamed sayari
Copyright
© All Rights Reserved
Nous prenons très au sérieux les droits relatifs au contenu. Si vous pensez qu’il s’agit de votre contenu, signalez une atteinte au droit d’auteur ici.
Formats disponibles
Téléchargez aux formats PDF, TXT ou lisez en ligne sur Scribd

1)

2)
Représentation d'un cours par un objet JSON.
{
"code":"api04",
"titre":"DW et
NOSQL",
"description":". ... ",
"credits":4

}
Prérequis
{
code:"api04",
requis:"api05
"
}
Étudiant
{
"num":1,
"nom":"Dupont"
,
"prenom":"Jean"
}
Adresse
{
"etudiant":1,
"num":8,
"rue":"Gury"
‘’cp’’ :10
‘’ville’’ : ‘’paris’’
}
Suit
{
"etudiant":1,
"cours":"api04"
}

3)
Cours
{
"_id":"30ae9e51-f5c8-4022-a68d-
3f3948dbdcb1", "code":"api04",
"titre":"DW et
NOSQL",
"description":". ... ",
"credits":4,

"prerequis":["a1449020-9b24-44a1-b12d-84ef592f8853","cf936817-19fa-4635-b009-
a383c90ab6d7"]
}
Etudiant
{
"_id":"850b1657-a070-4a25-ab63-6f61b436cf9d",
"nom":"Dupont",
"prenom":"Jean",
"cours":["30ae9e51-f5c8-4022-a68d-3f3948dbdcb1","cf936817-19fa-4635-b009-
a383c90ab6d7"]
}
Adresse
{
"_id":"7e93be68-7d6e-4506-9be5-ffd78e5afb5d",
"etudiant":"850b1657-a070-4a25-ab63-
6f61b436cf9d", "num":8,
"rue":"Gury",
‘’cp’’ :10,
‘’ville’’ : ‘’paris’’
}
Les principales différences avec le relationnel sont :
 les clés artificielles sont préférées aux clés naturelles ;
 on utilises des identifiants universels pour les clés artificielles ;

4)
Cours
{
"code":"api04",
"titre":"DW et
NOSQL",
"description":". ... ",
"credits":4
"prerequis"
:
[
{
"code":"api05",
"titre":"DW et NOSQL, volume
II", "description":". ",
"credits":4 "
},
...
]
"etudiants":
[
{
"nom":"Dupont",
"prenom":"Jean"
, "adresse":
{
"num":8,
"rue":"Gury",
‘’cp’’ :10,
‘’ville’’ : ‘’paris’’

}
},
...
]
}
La principal défaut de cette solution est sa redondance :
 toutes les données de tous les étudiants sont copiées dans chaque cours ;
 tous les cours sont copiés à chaque fois qu'ils sont prérequis d'un autre cours.
Si l'on avait un cycle de référence, par exemple deux cours pré-requis l'un de l'autre, alors
on aurait nécessairement besoin d'identification et de références

5)
Etudiant
{
"nom":"Dupont",
"prenom":"Jean"
, "adresse":
{
"num":8,
"rue":"Gury",
‘’cp’’ :10,
‘’ville’’ : ‘’paris’’
},
‘’Cour’’ :
[
{
"_id":"30ae9e51-f5c8-4022-a68d-
3f3948dbdcb1", "code":"api04",
"titre":"DW et NOSQL"
},
{
"_id":"cf936817-19fa-4635-b009-a383c90ab6d",
"code":"api05",
"titre":"DW et NOSQL, la suite"
}
]
}
Cours

{
"_id":"30ae9e51-f5c8-4022-a68d-
3f3948dbdcb1", "code":"api04",
"titre":"DW et
NOSQL",
"description":". ... ",
"credits":4,
"prerequis"
:
[

{
"_id":"a1449020-9b24-44a1-b12d-84ef592f8853",
"code":"api03"
}
]
}

Common questions

Alimenté par l’IA

Introducing artificial keys and universal identifiers could enhance security practices by abstracting data access from potentially sensitive natural data. Universal identifiers can minimize exposure of actual data values used in keys, reducing the likelihood of information leakage by obscuring the direct relations and dependencies between data items. However, it requires ensuring that the mapping from identifiers to actual data remains secure and isn't easily compromised .

The primary differences are that in the JSON object model, artificial keys are preferred over natural keys, and universal identifiers are used for these artificial keys. This is in contrast to relational databases, where natural keys are often used to maintain relationships. Additionally, the JSON model's structure leads to data redundancy, as each course contains copies of its prerequisites and students' data, which would not occur in a normalized relational database .

In the JSON data model, the student's personal information is embedded directly within course data structures, leading to tight coupling between student records and course information. This structure implies that whenever a course is managed or queried, relevant student data is inherently part of the retrieval process, affecting data management operations by integrating these facets closely, but also causing data redundancy .

The JSON object model's redundancy could adversely impact performance, especially in terms of storage and retrieval times. As all data must be copied to wherever it is referenced, this leads to increased storage requirements and potential inefficiencies in querying, as more data than necessary might be retrieved or processed. Additionally, updates need to propagate across multiple instances, which can strain resources and slow down transaction processing .

To handle a cycle of prerequisite courses in the JSON model, identification and references are necessary. Implementing a mechanism to track references externally and checking for cycles during course creation or updates could prevent their formation. Creating a directed acyclic graph structure to represent course relationships could help manage prerequisites effectively, ensuring clear paths without circular dependencies .

Transforming the JSON model into a relational database would address its limitations by normalizing the data structure, eliminating redundancy, and enforcing data integrity. Courses and students could be distinct entities with relationships explicitly defined through foreign keys, enabling seamless updates without duplicating data. This approach simplifies handling prerequisites and student data through join operations, ensuring consistent and reliable data management with less storage overhead .

Handling prerequisite courses in the JSON data model presents challenges due to potential data duplication and maintenance complexity. Each time a course is a prerequisite, its data must be replicated in each invoking instance, increasing chances of errors and inconsistency. Cyclic dependencies between courses require careful management to avoid infinite loops and ensure that all references are correctly maintained, which can be complex without normal relational constraints .

The main disadvantage of the JSON data model is its inherent redundancy. All student data and course prerequisites must be copied wherever they are referenced. This duplication can lead to inconsistencies and requires more storage and maintenance effort. Furthermore, in instances of cyclical references, identification and references become necessary, complicating the model and potentially increasing errors .

Redundancy introduces significant risks to data consistency and integrity. Any update to a student's or course's information must be replicated in each instance where it appears, increasing the chance of discrepancies. If one instance is updated but others are not, this leads to inconsistency. Moreover, ensuring integrity across a distributed environment with multiple potential data entry points makes maintaining data accuracy challenging .

The use of universal identifiers benefits the data model by providing a globally unique way to reference entities across the dataset. This can reduce conflicts and confusion that might arise with natural keys, especially in distributed systems where the same natural key might be used in different contexts. It aids in consistency and integrity of references within the dataset .

Vous aimerez peut-être aussi