It is very common to want to have some basic metadata for files
with·out needing to include them in their entirety and then parse out
the metadata during the transform phase. This can be done, to an
extent, using a multi·stage build, but it would be a lot easier to
simply allow basic metadata to be parsed out of documents at the same
time as they are being parsed otherwise. This commit implements this
functionality.
The approach taken essentially changes the result of parsing to look
like :—
```xml
<?xml version="1.0"?>
<书社:parsed>
<书社:result>
<!-- the result of the parse -->
</书社:result>
<书社:metadata>
<rdf:RDF>
<rdf:Description>
<!-- the result of the new 书社:about mode -->
</rdf:Description>
</rdf:RDF>
</书社:metadata>
</书社:parsed>
```
This requires adding an additional step to extract out the contents of
`/书社:parsed/书社:result`, which is very fast conceptually but yet
another file read∕write. Fortunately, as with parsed results in
general, this file should be infrequenly updated.
The parsed metadata is applied to
`$书社:about//*[@rdf:about=$IDENTIFIER]/nie:interpretedAs/*`; i·e it is
metadata on the _interpretation_ of the file; this aligns with it being
“parsed out” of the file by the parser.
Many of the best use·cases for this feature depend on being able to
declare “soft dependencies” (depending on a file with·out embedding
it), so that files can read in metadata from else·where with·out costly
reads and embeds, and files can depend on each others metadata in a
circular manner. “Soft dependency” support is planned, but not yet
implemented.
Right now, assets do not have parsed metadata. How·ever, it would be
nice if parsed metadata support could be added for assets which have
X·M·P metadata, which matches this format. That would have to be an
optional feature if `exiftool` (or similar) is available, and is left
as future work.