1. Trang chủ
  2. » Kỹ Thuật - Công Nghệ

Tiêu chuẩn iso 16684 2 2014

46 4 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Graphic Technology — Extensible Metadata Platform (XMP) — Part 2: Description of XMP Schemas Using RELAX NG
Trường học University of Alberta
Chuyên ngành Graphic Technology
Thể loại Tiêu chuẩn
Năm xuất bản 2014
Thành phố Switzerland
Định dạng
Số trang 46
Dung lượng 432,37 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Cấu trúc

  • 5.1 General (8)
  • 5.2 XMP packet serialization (8)
  • 5.3 Property serialization (8)
  • 5.4 Structure value serialization (9)
  • 5.5 Array value serialization (9)
  • 5.6 Qualifier serialization (9)
  • 6.1 General (9)
  • 6.2 Modularization (10)
  • 6.3 Use of data types (10)
  • 6.4 RELAX NG for properties (12)
  • 6.5 RELAX NG for XMP packets (13)
  • 6.6 RELAX NG for qualifiers (14)
  • 6.7 Extensions (15)
  • 6.8 Extension for providing UI information (15)

Nội dung

© ISO 2014 Graphic technology — Extensible metadata platform (XMP) — Part 2 Description of XMP schemas using RELAX NG Technologie graphique — Plate forme de métadonnées extensibles (XMP) — Partie 2 De[.]

General

Validating XMP presents significant challenges due to its use of the RDF metadata format, which permits various XML representations for identical metadata content, as outlined in ISO 16684-1:2012, section 7.9 Additionally, the RELAX NG schema language is designed for validating serialized XML rather than the RDF or XMP data models.

The NG schema for XMP XML forms is overly complex, prompting the need for a canonical serialization to simplify it This canonical serialization, as outlined in ISO 16684-1:2012, Clause 7, specifies particular XMP serialization formats and prohibits others, ensuring a clear one-to-one mapping between the XMP data model and the canonical XML.

An XMP validation engine is required to generate a canonical serialization of XMP during the validation process It must accept any XMP input compliant with ISO 16684-1, which will then be parsed and serialized according to the canonical forms specified in this section Subsequently, the RELAX process will be applied.

The NG schema must be applied to the canonical serialization, ensuring that the XMP validation engine does not alter the original files that include the input XMP during the validation process.

XMP packet serialization

The canonical serialization of XMP must include an outermost XML element of rdf:RDF, which contains a single rdf:Description element that encompasses all XMP properties All top-level namespace properties are organized within this single rdf:Description element, and the properties are grouped by namespace, allowing for any order among the namespace groups.

EXAMPLE An XMP metadata packet is shown containing XMP properties of different namespaces in a single rdf:Description element.

The RDF (Resource Description Framework) is a framework for representing information about resources in the web It includes various data types such as HTML, language-tagged strings, and plain literals RDF properties define relationships between resources, with key properties including subject, predicate, and object RDF also categorizes data into classes like Bag, Seq, and Alt, which represent different types of containers Additionally, RDF supports structured values through properties like value, first, and rest, and includes data types for XML and JSON literals The RDF vocabulary is essential for semantic web applications, enabling better data interoperability and understanding.

image/jpeg

uuid:example1234

Property serialization

The canonical serialization of XMP shall use the XML element form for XMP properties The property attribute notation defined in ISO 16684-1:2012, 7.9.2.2 shall not be used.

Structure value serialization

The canonical serialization of XMP utilizes a nested rdf:Description element to represent structure values, with structure fields serialized as XML elements within this element Values within a structure can be classified as simple, structure, or array types, following the serialization guidelines outlined in sections 6.3, 6.4, and 6.5 It is important to note that the rdf:parseType="resource" attribute notation and the structure field attribute notation specified in ISO 16684-1:2012, sections 7.9.2.3 and 7.9.2.4, respectively, should not be employed An example of a structure value from an XMP metadata stream is provided in its canonically serialized form.

id:document

id:instance

Array value serialization

The canonical serialization of XMP requires the use of a nested rdf:Bag, rdf:Seq, or rdf:Alt element to represent array values, with the individual array items specified as rdf:li elements within these elements.

EXAMPLE An array value from an XMP metadata stream is shown in its canonically serialized form.

subject 1

subject 2

Qualifier serialization

The canonical serialization of XMP follows the XML syntax specified in ISO 16684-1:2012, section 7.8, for qualifiers The xml:lang qualifier is represented as an xml:lang attribute in the start tag of the corresponding XML element for the XMP entity General qualifiers are serialized as XML elements within an rdf:Description element, which is nested inside the XML element named after the XMP entity The value of the XMP entity is contained within an rdf:value element, which should be positioned as the first XML element within the rdf:Description element.

The rdf:parseType="resource" notation, as outlined in ISO 16684-1:2012, section 7.9.2.3, is not applicable for XMP entities with general qualifiers Similarly, the field attribute notation specified in section 7.9.2.4 of the same standard is also not suitable for these XMP entities Additionally, the RDF TypedNode notation described in section 7.9.2.5 must not be utilized for an rdf:type qualifier.

EXAMPLE A part from an XMP metadata stream using a qualifier is shown in its canonically serialized form.

ISBN

6 RELAX NG idioms for XMP

General

A canonical serialization for XMP is essential for streamlining the development of RELAX NG schemas, allowing for greater flexibility in their creation.

This clause outlines idioms for RELAX NG schemas that enhance reuse and interchange, facilitating better functionality of validation engines and simplifying the provision of informative error messages The adoption of these idioms is optional.

Modularization

RELAX NG offers three primary methods for modularization: the rng:define element, the rng:grammar element, and the rng:include element The RELAX NG idioms for XMP suggest best practices for utilizing these elements, facilitating the development of comprehensive RELAX NG schemas for XMP while enhancing the reuse and interchangeability of schema modules.

The rng:define element is crucial as it allows for the creation of named patterns that define specific, easily understood aspects of XML for validation These lower-level rng:define patterns can be referenced by name in higher-level RELAX NG patterns.

The rng:grammar element provides a means to package rng:define patterns, and to control the scope of their names if desired.

The rng:include element provides a means to textually include one RELAX NG schema file within another While no specific naming conventions are required, the following approach can be chosen:

— names for individual properties can be composed as “prefix.localName”, e.g.”dc.title”;

— names for structure fields can be composed as “prefix.localName”, e.g “stRef:documentID”;

— names for types can be composed as “Standard/Origin.Types.QValue.Typename”, e.g.”ISO 16684-1.Types QValue.Boolean”, and “Standard/Origin.Types.Base.Typename”, e.g.”ISO 16684-1.Types.Base.Boolean”;

Array type names can explicitly indicate their type; for instance, an unordered array of the Boolean type can be represented as ISO 16684-1.Types.QValue.UnorderedArray.Boolean or ISO 16684-1.Types.Base.UnorderedArray.Boolean.

NOTE The QValue idiom ensures that properties with or without qualifiers can be validated, the Base idiom contains the actual RELAX NG grammar for the type.

Use of data types

The XMP data model, as outlined in ISO 16684-1:2012, section 6.3, utilizes three value forms: simple, structure, and array The specific value types employed are detailed in section 8.2 of the same standard, which categorizes them as data types and establishes formal definitions for validation purposes.

RELAX NG offers a basic data type for unrestricted text and includes capabilities to specify different types of constrained text It supports the integration of external data type libraries, particularly the W3C XML Schema Datatypes Additionally, the rng:define element enables the creation of custom data types.

The rng:text type is designated for unconstrained text values in XMP, while an rng:define element should be utilized to establish custom data types in other scenarios This approach enhances the modularity of data type semantics, simplifies the understanding of the RELAX NG schema, and promotes the reuse of data types.

The pattern within an rng:define for a simple XMP value should describe the XML character data of the serialized value with appropriate semantic restrictions.

EXAMPLE Two rng:define instances describe constraints on text values to create custom data types.

True|False

−1

0

5

The combine="choice" attribute in the rng:define element serves as a workaround for the interaction between rng:define and rng:include When a Boolean type is defined in one schema file and included in two other schema files, which are then included in a final schema file, this can lead to two identical definitions of Boolean Since RELAX NG does not recognize these definitions as identical, the combine attribute is necessary to specify how to select between them By using combine="choice," it indicates that either definition can be chosen, which is suitable given their identical nature.

In an rng:define for a structure value type, the pattern must outline the nested rdf:Description element along with its structure fields Each field requires a distinct rng:define that details its XML element and value, with the value represented as an rng:ref element pointing to the corresponding data type For instance, multiple rng:define instances can effectively describe a structure value type through the use of rng:ref elements.

NOTE Only two of the RenditionRef fields, defined in ISO 16684-1:2012, 8.2.2.9, are shown above in order to reduce the size of the example.

The rng:interleave element indicates that the fields within a structure can be arranged in any sequence Conversely, the rng:optional element signifies that a structure field is not mandatory and can be excluded, while required structure fields must always be included.

The pattern defined within an rng:define for an array value type must outline the structure of the nested rdf:Bag, rdf:Seq, or rdf:Alt elements, along with the rdf:li elements that represent the items in the array.

EXAMPLE 1 An rng:define instance describes an array data type.

© ISO 2014 – All rights reserved 5

The rng:zeroOrMore element is suitable for arrays that can be empty and have no upper limit, while the rng:oneOrMore element is intended for arrays that must contain at least one item without an upper limit To specify multiple required items, use the corresponding number of explicit rdf:li patterns For arrays with a closed upper bound, the necessary rdf:li patterns should be enclosed within rng:optional.

EXAMPLE 2 An rng:define instance describes minimum and maximum number of entries in an array data type.

A RELAX NG schema file should compile essential data types, featuring an outer rng:grammar element that encompasses the rng:defines for these data types.

EXAMPLE An rng:grammar element in a separate schema file describes a collection of often used data types.

True|False

\d+/[1-9]\d*

NOTE Only three of the types defined in ISO 16684-1:2012, 8.2 are shown above in order to reduce the size of the example.

RELAX NG for properties

A top-level namespace must include a RELAX NG schema file featuring an outer rng:grammar element Inside this element, an rng:define must be present to enumerate all contained properties, with each property clearly defined.

`,`````,,,,,``,,``,,,,`,,,`-`-`,,`,,`,`,,` - separate rng:define that describes its XML element and value The value should be given as an rng:ref element referring to the appropriate data type.

EXAMPLE An outer rng:grammar element in its own file for a top-level namespace lists the rng:define elements for all of the properties it contains.

−1

0

5

NOTE Only two of the XMP namespace properties defined in ISO 16684-1:2012, 8.4 are shown above in order to reduce the size of the example.

The rng:interleave element indicates that properties can be arranged in any sequence, while the rng:optional element signifies that a property is not mandatory and can be excluded if a property is deemed required.

RELAX NG for XMP packets

A complete XMP packet requires a RELAX NG schema with an outer rng:grammar element, which includes rng:include elements for the permitted top-level namespaces and a single rng:start element The rng:start element must define patterns for the outer rdf:RDF and rdf:Description elements in the canonical XMP serialization Inside the rdf:Description pattern, an rng:interleave element should reference the properties from the allowed namespaces.

An outer rng:grammar element, stored in a separate file for a complete XMP packet, includes rng:include elements for two top-level namespaces and features an rng:start element that defines patterns for the outer rdf:RDF and rdf:Description elements.

© ISO 2014 – All rights reserved 7

RELAX NG for qualifiers

The use of an xml:lang qualifier in XMP metadata causes an xml:lang attribute to be added to the serialized

According to ISO 16684-1:2012, section 7.8, XMP can be described using a RELAX NG schema by incorporating an rng:attribute element into the data type rng:define pattern when it exists If a data type pattern is absent, the rng:attribute element should be included in the rng:define pattern of the XMP entity.

An rng:optional element around the rng:attribute element shall be used if the qualifier is optional, it shall be omitted if the qualifier is required.

EXAMPLE 1 An rng:attribute in an rng:define pattern describes a language qualifier.

The implementation of a general qualifier alters the XML serialization of an XMP value, as outlined in ISO 16684-1:2012, 7.8 This alteration is evident in a RELAX NG schema, which describes the XML serialization It is essential to utilize the data type rng:define to detail the nested rdf:Description element, the initial rdf:type element, and the general qualifier elements.

EXAMPLE 2 This example shows how general qualifiers impact the XML serialization of XMP values.

In Example 2, the qualifier is required If all qualifiers are optional, an rng:choice element shall be used to allow matching of either the unqualified or qualified forms.

EXAMPLE 3 This example shows the use of rng:choice elements to allow matching of either unqualified or qualified forms.

Extensions

All validation features of RELAX NG are defined as XML elements within the rng: namespace, utilizing the URI “http://relaxng.org/ns/structure/1.0” The schema supports additional XML elements and attributes, allowing for customization without affecting RELAX NG validation, provided they use a different namespace This flexibility enables the schema to be compatible with various tools and validation engines, potentially enhancing functionality, such as offering user interface information through extension XML.

Extension for providing UI information

This subclause outlines the use of XML to convey information for displaying an XMP schema, formatted in RELAX NG, within a user interface (UI) The information pertains to XMP schemas, properties, and data types, and can be presented in multiple natural languages.

The namespace for user interface information related to XMP schemas, data types, and properties is defined as `xmlns:ui="http://ns.iso.org/iso-16684-2/xmp-schema-ui-info/1.0"` The definitions for this namespace are detailed in Table 1.

Table 1 — Entries in the ui namespace

The Entry Usage schema offers user interface information for an XMP schema, which may include label and description entries Similarly, the property provides UI information for an XMP property, also containing potential label and description entries The type delivers UI information for an XMP data type, with the possibility of including label and description entries The label consists of text that provides a human-readable identifier for a schema, property, or type, and should be accompanied by a language attribute to specify the natural language used Lastly, the description offers a human-readable explanation for a schema, property, or type, and should likewise be qualified by a language attribute indicating the natural language of the text.

The following example illustrates how to include UI information for the Dublin Core property dc:subject :

EXAMPLE An rng:define element contains a label and descriptive information that can be used for presentation in a user interface.

© ISO 2014 – All rights reserved 9

The RELAX NG schema for the Dublin Core namespace, included in Annex B, utilizes the "Extension for providing UI information" as outlined in this subclause, offering labels and descriptions in both English and German.

Annexes A through F of ISO 16684 include examples of RELAX NG schemas that illustrate different XMP data types, namespaces, and packets These examples are integral to understanding the application of RELAX in this context.

— Annex A: RELAX NG schemas for Standard data types; attached as “ISO 16684-1_Types-Array.rng”,

“ISO 16684-1_Types-Simple.rng”, and “ISO 16684-1_Types-Structure.rng”

— Annex B: RELAX NG schema for the Dublin Core namespace; attached as “ISO 16684-1_Properties- dc.rng”

— Annex C: RELAX NG schema for the XMP namespace; attached as “ISO 16684-1_Properties-xmp.rng”

— Annex D: RELAX NG schema for the XMP Media Management namespace; attached as “ISO 16684-1_ Properties-xmpMM.rng”

— Annex E: RELAX NG schema for the XMP Rights Management namespace; attached as “ISO 16684-1_ Properties-xmpRights.rng”

— Annex F: RELAX NG schema for a complete XMP packet; attached as “ISO 16684-1_CompletePacket.rng”

The RELAX NG schema files provided as Annexes A through F are text files and can be opened using a simple text editor.

The source code for these schemas is available for unrestricted use, allowing for copying, modification, and distribution in both original and altered forms This includes the ability to create derivative works and utilize the code in standalone projects or as part of other initiatives, whether they are open source or commercial, with or without fees.

RELAX NG schema for standard data types

Core simple value types for XMP defined in ISO 16684-1 clause 8.2 All stored values are of course text, the types such as Integer or Boolean are the semantic interpretations.

There are two patterns for each type, one named ISO16684-1.Types.QValue.Xyz and one named ISO16684-1.Types.Base.Xyz The

“Base” pattern defines the raw type It should only be used in the “QValue” pattern, or in cases where use of XMP qualifiers is explicitly not allowed

The QValue pattern includes an rng:choice that allows for either a Base type or an rdf:Description element containing a nested rdf:value element of the Base type Additionally, the second choice addresses the use of unexpected XMP qualifiers, which may trigger validation errors, although the qualified value itself remains unaffected.

I don't know!

x-default|([a-zA-Z]+(-[a- zA-Z0-9]+)*)

© ISO 2014 – All rights reserved 11

True|False

(\d{4}((-)?(0[1-9]|1[0-2])((-)?(0[1-9]|[1-2] [0-9]|3[0-1])(T(24:00(:00(\.[0]+)?)?|(([0-1][0-9]|2[0-3])(:)[0-5][0-9])((:)[0-5][0-9] (\.[\d]+)?)?)((\+|-)(14:00|(0[0-9]|1[0-3])(:)[0-5][0-9])|Z)?)?)?)?)

\d+/[1-9]\d*

© ISO 2014 – All rights reserved 13

[a-zA-Z]+(-[a-zA-Z0-9]+)*

(application|audio|example|image|message|model|multipart|text|video)/

Core array value types for XMP defined in ISO 16684-1 clause 8.2.

The article discusses two patterns for each type: ISO16684-1.Types.QValue.Xyz and ISO16684-1.Types.Base.Xyz The "Base" pattern represents the raw type and is intended for use only within the "QValue" pattern or when XMP qualifiers are explicitly prohibited The QValue pattern features an rng:choice that includes both the Base type and an rdf:Description element containing a nested rdf:value element of the Base type Additionally, the second choice addresses the use of unexpected XMP qualifiers, which may result in validation errors for the qualifiers themselves, but not for the qualified value.

All combinations are specified for arrays of general simple types, while only essential types are defined for specialized arrays The item types utilized in these arrays are all classified as "QTypes," which permit the use of qualifiers.

© ISO 2014 – All rights reserved 17

© ISO 2014 – All rights reserved 19

© ISO 2014 – All rights reserved 21

Core structure value types defined in ISO 16684-1 clause 8.2.

There are three patterns for each type, one named ISO16684-1.Types.QValue.Xyz, one named ISO16684-1.Types.Base.Xyz, and one named ISO16684-1.Types.Fields.Xyz.

The “Base” pattern defines the raw type It should only be used in the “QValue”

`,`````,,,,,``,,``,,,,`,,,`-`-`,,`,,`,`,,` - pattern, or in cases where use of XMP qualifiers is explicitly not allowed The

The QValue pattern includes an rng:choice that allows for either a Base type or an rdf:Description element containing a nested rdf:value element of the Base type Additionally, the second choice addresses the use of unexpected XMP qualifiers, which may result in validation errors for the qualifiers themselves, but not for the qualified value.

The Fields pattern is essentially a compilation of fields, while the Base pattern includes the standard rdf:Description element for the struct value, along with a nested rng:interleave element that references the Fields pattern through an rng:ref.

This allows derived struct types to contain more fields and still easily include the Base fields.

The article discusses the structure and syntax of Relax NG, a schema language for XML It highlights the importance of namespaces, such as RDF and Adobe's resource reference, in defining data types The content emphasizes the role of Relax NG in ensuring data integrity and validation in XML documents.

© ISO 2014 – All rights reserved 23

RELAX NG schema for the Dublin Core namespace

The Dublin Core namespace properties are defined in ISO 16684-1, specifically in clause 8.3, where each top-level property is accompanied by an rng:define element that offers its formal definition Additionally, an rng:define is provided for the pattern.

The "ISO16684-1.Properties-dc" includes an rng:interleave of all top-level properties A complete RelaxNG grammar should encompass the outer rdf:RDF and rdf:Description elements, subsequently referencing the appropriate ISO16684-1.Properties-xx patterns for the required namespaces.

Ngày đăng: 12/04/2023, 18:16