Typed DataONE System Metadata domain model with direct root properties,
owned child domains, tolerant XML parsing, and canonical v2 XML
serialization.
Parsing silently repairs harmless XML shape issues such as missing
namespaces, unknown child elements, out-of-order known children, and
duplicate singleton elements where the last value wins. `parseWarnings`
is only populated when parsing had to drop invalid optional content.
Properties:
| Name |
Type |
Description |
serialVersion |
number
|
null
|
Optional sysmeta serial version. |
identifier |
string
|
null
|
DataONE identifier. |
formatId |
string
|
null
|
DataONE format identifier. |
size |
number
|
null
|
Object size in bytes. |
submitter |
string
|
null
|
Optional submitter subject. |
rightsHolder |
string
|
null
|
Rights holder subject. |
obsoletes |
string
|
null
|
PID obsoleted by this object. |
obsoletedBy |
string
|
null
|
PID that obsoletes this object. |
archived |
boolean
|
null
|
Archived flag. |
dateUploaded |
Date
|
null
|
Upload timestamp. |
dateSysMetadataModified |
Date
|
null
|
Sysmeta-modified timestamp. |
originMemberNode |
string
|
null
|
Origin member node. |
authoritativeMemberNode |
string
|
null
|
Authoritative member node. |
seriesId |
string
|
null
|
Optional series identifier. |
fileName |
string
|
null
|
Optional file name. |
checksum |
Checksum
|
Owned checksum value object. |
accessPolicy |
AccessPolicy
|
Owned access-policy collection. |
replicationPolicy |
ReplicationPolicy
|
Owned replication policy. |
replicas |
ReplicaList
|
Owned replica collection. |
mediaType |
MediaType
|
Owned media-type value object. |
parseWarnings |
Array.<object>
|
Lossy parse warnings from the most
recent successful XML parse. |
- Since:
- Source:
Methods
Create an independent copy of this System Metadata.
- Since:
- Source:
Returns:
Cloned System Metadata
-
Type
-
SystemMetadata
Normalize this instance's values in-place
- Since:
- Source:
Returns:
This instance with normalized values.
-
Type
-
SystemMetadata
Parse and normalize a System Metadata XML document onto this instance.
Harmless XML cleanup such as missing namespaces, unknown child elements,
out-of-order known children, and duplicate singleton elements is
repaired silently. `parseWarnings` is only populated when parsing had to
drop invalid optional content.
Parameters:
| Name |
Type |
Description |
xmlString |
string
|
System Metadata XML string to parse. |
- Source:
Throws:
-
Throws when the XML is malformed, is a DataONE error
document, has the wrong root element, or is missing required core data
after recovery.
-
-
Type
-
Error
Returns:
The same instance with parsed values.
-
Type
-
SystemMetadata
reset()
Reset all fields to default values.
- Since:
- Source:
serialize(optionsopt) → {string}
Serialize the current System Metadata state to canonical v2 XML.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Serialization options.
Properties
| Name |
Type |
Attributes |
Description |
validate |
boolean
|
<optional>
|
Whether to validate before
serializing. |
|
- Since:
- Source:
Throws:
-
Throws when validation is enabled and the model is
invalid.
-
-
Type
-
Error
Returns:
Canonical v2 XML serialization.
-
Type
-
string
toJSON() → {object}
Return a JSON-safe snapshot of the current normalized state.
- Source:
Returns:
Plain system metadata JSON.
-
Type
-
object
toObject() → {object}
Return values for all sysMeta fields in a plain object.
- Since:
- Source:
Returns:
Plain snapshot of the current state.
-
Type
-
object
validate() → {Array.<object>}
Validate the current System Metadata state.
- Since:
- Source:
Returns:
Validation issues for invalid fields.
-
Type
-
Array.<object>
Create a new SystemMetadata instance from XML.
Parameters:
| Name |
Type |
Description |
xmlString |
string
|
System Metadata XML string. |
- Since:
- Source:
Returns:
Parsed System Metadata instance.
-
Type
-
SystemMetadata
getDefaults() → {object}
Get default values for all sysMeta fields.
- Since:
- Source:
Returns:
Default values object.
-
Type
-
object
normalizeValues(values) → {object}
Normalize sysMeta values, applying defaults and type conversions when
necessary.
Parameters:
| Name |
Type |
Description |
values |
object
|
An object with sysMeta fields to normalize. |
- Since:
- Source:
Returns:
Normalized values object.
-
Type
-
object
resetFieldToDefault(values, field)
Reset a single field to its default in-place.
Parameters:
| Name |
Type |
Description |
values |
object
|
Values object to reset a field on. |
field |
string
|
Field name to reset to default. |
- Since:
- Source:
validateValues(values) → {Array.<object>}
Validate values without requiring mutation of a caller-owned object.
Parameters:
| Name |
Type |
Description |
values |
object
|
Candidate System Metadata values. |
- Since:
- Source:
Returns:
Validation issues.
-
Type
-
Array.<object>