MgdSchema

From MidgardWiki

Jump to: navigation, search

Midgard Schema is a data abstraction system which is used to define data structures in XML files. Each MgdSchema class corresponds to one table in the database (or two tables, in the case of MultiLang content). The rows of the table can be accessed as GObjects on the C level and as native objects in PHP, Java and other languages with Midgard Metadata attached.

Contents

MgdSchema XML structure

MgdSchema XML definitions include information about fieldnames (which are available as object attributes) and the corresponding data types. Aside from that, they can mark fields as links (allowing querying by linked constraints) and they can also include hierarchic information, i.e. tree structures. Since 8.09, MgdSchema fields can also include indexes and field descriptions.

On the MidCOM Level, an additional Schema functionality is available via MidCOM Datamanager. Although they are named quite similar, their actual function is quite different. MgdSchema are used to control the basic data structures, while DM2 schemas are more useful for site-specific modifications of standard functionality.

Usage

Midgard Query Builder or Midgard Collector are used to retrieve MgdSchema objects from the database. Midgard Reflection is available for writing Schema agnostic applications like Asgard 2.

Custom Schemas are defined in XML files. Running either Datagard or midgard-schema will create the corresponding tables in the Midgard MySQL Database. The necessary base classes for MidCOM are automatically generated the next time Apache is launched. See MidCOM Database Abstraction Layer for a short howto about Schema creation.

Availability

In standard Midgard installations, most data structures hve been converted to this new model, including:

Articles
Attachments
Groups
Events
Hosts
Pages
Page Elements
Pagelinks
Parameters
Persons
Snippetdirs
Snippets
Styles
Style Elements
Topics

They are defined in the file MgdObjects.xml

Weblinks

http://www.midgard-project.org/documentation/mgdschema/
http://www.midgard-project.org/documentation/mgdschema-file-properties/
http://www.midgard-project.org/documentation/mgdschema-in-php/
Personal tools