Metadata Support in Writer
Information about Writer's metadata support - to be extended in the future.
Handling of metadata on editing/updating a text document
Metadata can be assigned to various Writer's entities of a text document's content. These are for example paragraphs, headings, bookmarks, lists, list items, tables, table rows, table columns, table cells, sections, metadata texts, metadata fields and many more. For further information see the ODF 1.2 Metadata specification and ODF 1.2 Metadata example document.
The metadata in the Writer is stored in an RDF/RDFa repository. From this repository a Writer's entity metadata representation can be optained by its xml:id property in conjunction with the path of the ODF stream, to which the related ODF element belongs to. In the following we call this key metadata reference.
The handling of the metadata on Writer entities (e.g. edited/changed/deleted) are listed below:
Deletion of an entity
Deletion while change tracking is deactivated: The metadata of an deleted Writer's entity is lost for this entity. The entity loses its metadata reference. The related metadata stays in the RDF/RDFa repository and can still be referenced. The metadata reference for the deleted entity is restored, if the deletion of the entity is undone.
Deletion while change tracking is activated: The metadata of an deleted Writer's entity is kept. The Writer's entity does not lose its metadata reference. The deleted entity will be also stored in ODF and will still have its metadata.
Copy of an entity
When copying an entity the copy of an entity will also copy the metadata reference, but not its related metadata.
- A copy of an entity creates an corresponding entity in the clipboard and copies the content and the attributes of the entity to the created entity in the clipboard. It has to be assured that the metadata reference of the entity in the clipboard is the same as the one of its source entity.
Cut of an entity
A cut of an entity is represented by the copy of the entity followed by a deletion of this entity (see above).
Paste of an entity
In case the pasted entity holds a metadata reference, it is checked, if the related metadata is referenced by another entity of the current text document. If another entity references the metadata, the pasted entity will lose its metadata reference and thus has no metadata any more. If no other entity references the metadata, the pasted entity will keep its metadata reference and thus has metadata, if the referenced metadata exists in the RDF/RDFa repository.
Via Cut-and-Paste a certain entity can be moved from/to the document body context to/from the page header/footer context inside a certain text document. This means that the entity will be moved from/to the underlying ODF content.xml stream to/from the underlying ODF styles.xml stream. Due to the ODF 1.2 specification the value of the xml:id property have only to be unique inside a certain stream of an ODF. Thus, if the pasted entity holds a metadata reference, which does not correspond to the underlying ODF stream of the destination context, the following actions are performed:
- The metadata reference is changed in order to correspond to the underlying ODF stream of the destination context.
- It is checked, if the changed metadata is referenced by another entity of the current text document.
- If YES, the pasted entity lose its metadata reference and has no metadata any more.
- If NO, the pasted entity will keep the changed metadata reference and the metadata from the source ODF stream (if existing) is transfered to the destination ODF stream, if this metadata is not referenced by an entity of the source ODF stream.
- An entity references metadata, if it has a metadata reference. This holds for normal entities in the text document and for change tracked, deleted entities.
- The source of a paste is typically the clipboard.
- ODF 1.2 specification is currently (August 2008) work in progress. Please have a look at the OASIS ODF TC for the current ODF 1.2 specification draft
- A transfer of a metadata from one ODF stream to another ODF stream mainly means to adjust the metadata mapping in the manifest of the ODF.
Edit of entity content
In general the metadata of an entity is kept, when the content of this entity is edited. In case that the whole content of the entity is deleted, the metadata is treated as if the complete entity is deleted – see above for details.
- Editing the content of an entity means inserting and deleting content of this entity.
- When the complete content of a metadata text or a metadata field is deleted the metadata text respectively metadata field itself is deleted.
Split of entity
If an entity having metadata is splitted into two entities, the metadata is kept at the first entity.
- In Writer an ENTER at the beginning of a paragraph or a heading is implemented as a split of this paragraph/heading. Due to the handling of metadata this special split has to be treated as an insertion of a new paragraph/heading before the existing one. Thus for the metadata handling this is not a split of an entity.
Merge of two entities
Only one entity has metadata: The metadata is transferred to the merged entity.
Both entities have metadata: Only one metadata can be kept. In general the metadata of the first one is kept and the metadata of the second one is lost. Exception: The metadata of the second one is kept, in case it has content and the first has no content.
- For paragraphs it is typically that the user makes a certain selection, which contains certain parts of paragraphs and also complete paragraphs, and then hits BACKSPACE. This results typically in a merge of two paragraphs, while the selected parts are deleted. Due to the metadata handling such an action is splitted into the deletion of the selection and afterwards merging of the two paragraphs. See “Delete of entity” and “Edit of entity content” for the first part of this splitted action for the metadata handling.