CenitHub Presentations | 2- Libraries, Schemas & Data Types

Post on 29-Jan-2018

199 views 1 download

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

CenitHubChapter 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

Schemas

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

http://json-schema.org

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.

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.

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.

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.

The new schema action

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

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.

Loading Data types

List of Data types

List of Costumers

Enhancing Schemas

Enhancing Schemas

Reusing Schemas

costumer.json address.json

XML Schemas

Defining data types from XML Schemas is supported.

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

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

Reusing XML Schemasaddress.xsd

costumer.xsd

Cenit automatically links data types when referencing XML Schemas.

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.

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?

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.

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.

File Data Types & Validators

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

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*stark@mail.combilling_addres*1*Street*Cityshipping_addres*2*Street*City

Custom Validators: EDI

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

₋ ASCX12₋ EDIFACT₋ TRADACOM₋ CATAIR₋ …

Grammar of X12 IEA Segment

CenitHubChapter 2

Libraries, Schemas & Data Types