CenitHub Presentations | 2- Libraries, Schemas & Data Types

24
CenitHub Chapter 2 Libraries, Schemas & Data Types

Transcript of CenitHub Presentations | 2- Libraries, Schemas & Data Types

Page 1: CenitHub Presentations | 2- Libraries, Schemas & Data Types

CenitHubChapter 2

Libraries, Schemas & Data Types

Page 2: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Libraries, Schemas & Data Types

Libraries are collections of schemas and data types.

Schemas define data types.

File data types can be validated against a schema.

Library

Schema

Data Type

File Data Type

Page 3: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Schemas

Define a data type is as simple as a JSON Schema.

http://json-schema.org

Page 4: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Basic JSON Schema

Title defines a title for the data type, use is optional.

Type object is mandatory for enhanced data types interaction.

Properties is mandatory for enhanced data types interaction.

Required properties definition is optional.

Page 5: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Basic JSON Schema

Title defines a title for the data type, use is optional.

Type object is mandatory for enhanced data types interaction.

Properties is mandatory for enhanced data types interaction.

Required properties definition is optional.

Page 6: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Basic JSON Schema

Title defines a title for the data type, use is optional.

Type object is mandatory for enhanced data types interaction.

Properties is mandatory for enhanced data types interaction.

Required properties definition is optional.

Page 7: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Basic JSON Schema

Title defines a title for the data type, use is optional.

Type object is mandatory for enhanced data types interaction.

Properties is mandatory for enhanced data types interaction.

Required properties definition is optional.

Page 8: CenitHub Presentations | 2- Libraries, Schemas & Data Types

The new schema action

Every schema have an URI and must be included in a library.

Page 9: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Loading Data types

When loading a data type Cenit creates a class model on the fly that can be used as any other model in the administration view.

Page 10: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Loading Data types

List of Data types

List of Costumers

Page 11: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Enhancing Schemas

Page 12: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Enhancing Schemas

Page 13: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Reusing Schemas

costumer.json address.json

Page 14: CenitHub Presentations | 2- Libraries, Schemas & Data Types

XML Schemas

Defining data types from XML Schemas is supported.

This example defines a data type element:Costumer with an embedded definition of Address.

Page 15: CenitHub Presentations | 2- Libraries, Schemas & Data Types

XML Schemas

Cenit defines a data type for every top level type or element, so a single XML Schema may define multiple data types.

This example defines two data types, type:Address and element:Costumer

Page 16: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Reusing XML Schemasaddress.xsd

costumer.xsd

Cenit automatically links data types when referencing XML Schemas.

Page 17: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Versioning SchemasURIs and data type names must be unique in the same library but data types versions with the same URI or name can be defined in different libraries.

Page 18: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Data Type StorageData type records derived from schemas are stored as JSONs structured documents.

Limitations:- Mapping XML documents to JSON is not always feasible.- What about data structured in other formats?- What about data non structured at all?

Page 19: CenitHub Presentations | 2- Libraries, Schemas & Data Types

File Data Types

File data types allow to store files as records.

Files content can be validated against a validator.

If no validator is selected then the file content can have any structure.

Page 20: CenitHub Presentations | 2- Libraries, Schemas & Data Types

File Data Types & Validators

By default every schema is also a validator.

Every file records can be fully validated against a XML Schema or a JSON Schema.

Page 21: CenitHub Presentations | 2- Libraries, Schemas & Data Types

File Data Types & Validators

Cenit prevents to store invalid data so every file content is validated when uploading and before storing.

Page 22: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Custom Validators: EDI

Cenit allows to customize file validators.

EDI Validators use schemas as grammars for EDI formats based on model storage by segments containing record fields:

Costumer*Jhon*Stark*[email protected]_addres*1*Street*Cityshipping_addres*2*Street*City

Page 23: CenitHub Presentations | 2- Libraries, Schemas & Data Types

Custom Validators: EDI

Several formats can be described by using JSON Schemas as grammars:

₋ ASCX12₋ EDIFACT₋ TRADACOM₋ CATAIR₋ …

Grammar of X12 IEA Segment

Page 24: CenitHub Presentations | 2- Libraries, Schemas & Data Types

CenitHubChapter 2

Libraries, Schemas & Data Types