Class: DataPackage

DataPackage()

new DataPackage()

Manage the members, resource map, edits, and uploads for a DataONE data package.
Since:
  • 2.39.0
Source:

Members

comparator :string

Used to keep the collection sorted by model "sortOrder". The three model types are ordered as: Metadata: 1; Data: 2; DataPackage: 3. See getMember(). We do this so that Metadata get rendered first, and Data are rendered as DOM siblings of the Metadata rows of the DataPackage table.
Type:
  • string
Source:

dataPackageGraph :RDFGraph

The RDF graph representing this data package
Type:
Source:

derivations :Array.<DataONEObject>

Package members that are derivations in provenance relationships.
Type:
Source:

editable :boolean

A flag used for the package's edit status. Can be set to false to 'lock' the package
Type:
  • boolean
Source:

filterModel :Filter

A Filter model that should filter the Solr index for only the objects aggregated by this package.
Type:
Source:

id :string

The package identifier
Type:
  • string
Source:

namespaces :object

Namespaces used in the RDF XML. The key is the prefix and the value is the namespace URI.
Type:
  • object
Source:

nodeLevel :number

The nesting level in a data package hierarchy
Type:
  • number
Source:

numSaves :number

The number of models that have been updated during the current save(). This is reset to zero after the current save() is complete.
Type:
  • number
Source:

originalIsDocBy :object

The science data identifiers associated with this data package (from cito:documents), mapped to the science metadata identifier that documents it. Not to be changed after initial fetch - this is to keep track of the relationships in their original state
Type:
  • object
Source:

originalMembers :Array.<string>

An array of ids that are aggregated in the resource map on the server. Taken from the original RDF XML that was fetched from the server. Used for comparing the original aggregation with the aggregation of this collection.
Type:
  • Array.<string>
Source:

packageModel :DataONEObject

A DataONEObject representing the resource map itself
Type:
Source:

provEdits :Array.<Array.<string>>

Contains provenance relationships added or deleted to this DataONEObject. Each entry is [operation ('add' or 'delete'), prov field name, object id], i.e. ['add', 'prov_used', 'urn:uuid:5678']
Type:
  • Array.<Array.<string>>
Source:

provenanceFlag :string|null

Set to "complete" to signal that all prov queries have finished
Type:
  • string | null
Source:

solrResults :SolrResults

The SolrResults collection associated with this DataPackage. This can be used to fetch the package from Solr by passing the 'fromIndex' option to fetch().
Type:
Source:

sources :Array.<DataONEObject>

Package members that are sources in provenance relationships.
Type:
Source:

transferQueue :DataPackage|Metadata|Array.<Data>

The type of the object (DataPackage, Metadata, Data) Simple queue to enqueue file transfers. Use push() and shift() to add and remove items. If this gets to large/slow, possibly switch to http://code.stephenmorley.org/javascript/queues/
Type:
Source:

type :string

The name of this type of collection
Type:
  • string
Source:

Methods

addGeneratedByProgram(dataPid, programPid) → {DataPackage}

Record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addNewModel(model)

Adds a DataONEObject model to this DataPackage collection
Parameters:
Name Type Description
model DataONEObject The DataONEObject model to add
Source:

addProgramToGraph(programId) → {string}

Add a program identifier to the RDF graph and create an execution node
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

addToAggregation(id)

Adds a new object to the resource map RDF graph
Parameters:
Name Type Description
id string The identifier of the object to add
Source:

addToGraph(subject, predicate, object)

Add the specified relationship to the RDF graph only if it has not already been added.
Parameters:
Name Type Description
subject object The subject of the statement to add
predicate object The predicate of the statement to add
object object The object of the statement to add
Source:

addUsedByProgram(dataPid, programPid) → {DataPackage}

Record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addViewServiceEntities(entities) → {void}

Merge entity summaries from a rendered metadata document into matching package members.
Parameters:
Name Type Description
entities Array.<object> Plain entity summaries from ViewServiceDoc
Source:
Returns:
Type
void

addWasDerivedFrom(…args) → {DataPackage}

Record that one data object was derived from another.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

allocatePid(optionsopt) → {Promise.<string>}

Reserve a new PID for a package member, or confirm a requested PID is available.
Parameters:
Name Type Attributes Description
options object <optional>
Allocation options
Properties
Name Type Attributes Description
requestedPid string <optional>
Custom PID to reserve
resourceMap boolean <optional>
Allocate a ResourceMap PID
Source:
Throws:
When allocation fails or the reserved PID does not match
Type
Error
Returns:
Allocated PID
Type
Promise.<string>

assertCanEdit(memberPidopt) → {true}

Reject a package edit while a full save is queued or active, or a member edit while that member is uploading eagerly.
Parameters:
Name Type Attributes Description
memberPid string <optional>
Member being edited
Source:
Throws:
With `code === "upload_in_progress"` while locked
Type
Error
Returns:
True when editing is allowed
Type
true

assertNotNestedResourceMap(member, rootResourceMapopt) → {DataPackageMember}

Reject direct edits to ResourceMaps aggregated by the root package.
Parameters:
Name Type Attributes Description
member DataPackageMember Package member
rootResourceMap DataPackageMember <optional>
Root ResourceMap member
Source:
Throws:
When the member is a nested resource map
Type
Error
Returns:
The accepted member
Type
DataPackageMember

assignNewMemberPid(member, optionsopt) → {Promise.<string>}

Assign a PID to a new member when it does not already have one.
Parameters:
Name Type Attributes Description
member DataPackageMember Member to assign
options object <optional>
Allocation options
Source:
Returns:
Desired PID
Type
Promise.<string>

assignReplacementPid(member, optionsopt) → {Promise.<string>}

Assign one stable replacement PID to an existing member.
Parameters:
Name Type Attributes Description
member DataPackageMember Member being replaced
options object <optional>
Allocation options
Source:
Returns:
Desired replacement PID
Type
Promise.<string>

broadcastAccessPolicy(accessPolicy)

Broadcast an accessPolicy across members of this package Note: Currently just sets the incoming accessPolicy on this object and doesn't broadcast to other members (such as data). How this works is likely to change in the future. Closely tied to the AccessPolicyView.broadcast property.
Parameters:
Name Type Description
accessPolicy AccessPolicy The accessPolicy to broadcast
Source:

checkResourceMapWritePermission(optionsopt) → {Promise.<boolean>}

Check whether the user can write to the root resource map specifically. Provenance editing depends on resource map writability rather than metadata write permission, so this is intentionally separate from DataPackage#checkWritePermissions, which requires write access to every member.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether the root resource map is writable Returns false when no resource map has been resolved
Type
Promise.<boolean>

checkWritePermissions(optionsopt) → {Promise.<boolean>}

Check if the user has write permission on the resource map and metadata if they both exist, or just the one that exists if only one exists. If neither exists, then return false.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether every checked member is writable
Type
Promise.<boolean>

cloneNode(nodeToClone) → {Node}

Clone an rdflib.js Node by creaing a new node based on the original node RDF term type and data type.
Parameters:
Name Type Description
nodeToClone Node The node to clone
Source:
Returns:
- The cloned node
Type
Node

discardFileReplacement(pid) → {DataPackageMember}

Restore the remote file after a failed replacement, retaining independent sharing and ownership edits.
Parameters:
Name Type Description
pid string Replacement PID currently assigned to the member
Source:
Throws:
When the original member state cannot be restored
Type
Error
Returns:
Restored member
Type
DataPackageMember

ensureMetadataUploadPid(member) → {Promise.<string>}

Ensure changed metadata has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember Metadata member
Source:
Throws:
When changed metadata has no replacement PID
Type
Error
Returns:
Desired PID
Type
Promise.<string>

ensureResourceMapUploadPid(member) → {Promise.<string>}

Ensure the ResourceMap has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember ResourceMap member
Source:
Returns:
Desired PID
Type
Promise.<string>

fetch(sourceOptionsopt) → {Promise}

Fetch the resource map RDF XML for this package
Parameters:
Name Type Attributes Description
sourceOptions object <optional>
Optional options for this fetch that get sent with the XHR request
Properties:
Name Type Description
fetchModels boolean If false, this fetch will not fetch each model in the collection. It will only get the resource map object.
fromIndex boolean If true, the collection will be fetched from Solr rather than fetching the system metadata of each model. Useful when you only need to retrieve limited information about each package member. Set query-specific parameters on the `solrResults` SolrResults set on this collection.
Source:
Returns:
A promise that resolves when the fetch is complete
Type
Promise

fetchFromIndex()

Fetches this DataPackage from the Solr index by using a SolrResults collection and merging the models in.
Source:

fetchMemberModels(models, batchSizeopt, timeoutopt, maxRetriesopt) → {Promise}

Fetches member models in batches to avoid fetching all members simultaneously.
Parameters:
Name Type Attributes Description
models Array.<Backbone.Model> The array of member models to fetch.
batchSize number <optional>
The number of models to fetch in each batch.
timeout number <optional>
The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout.
maxRetries number <optional>
The maximum number of retries for each fetch request.
Since:
  • 2.32.0
Source:
Returns:
A promise that resolves when all models have been fetched.
Type
Promise

fetchPromise(model) → {object}

Fetch a model using Backbone's fetch method but return a promise that resolves when the fetch is complete, along with the XHR object
Parameters:
Name Type Description
model DataONEObject The model to fetch
Since:
  • 2.32.1
Source:
Returns:
An object with a promise and an XHR reference
Type
object

fetchSysMeta(memberPids, optionsopt) → {Promise.<Array.<{pid: string, error: Error}>>}

Fetch missing system metadata for selected package members.
Parameters:
Name Type Attributes Description
memberPids Array.<string> | null PIDs to fetch, or null for all members
options object <optional>
Fetch options
Properties
Name Type Attributes Description
maxConcurrent number <optional>
Fetch concurrency
Source:
Returns:
Fetch failures
Type
Promise.<Array.<{pid: string, error: Error}>>

fetchSysMetaForPlaceholders() → {Promise}

Fetches the system metadata for all member models that are marked as placeholder documents (i.e., isPlaceHolder_b === true). This property is retrieved from Solr and indicates that the file ID is referenced in a resource map, but has either not yet been indexed or is missing from the repository.
Since:
  • 2.36.2
Source:
Returns:
A promise that resolves when all placeholder member models have been fetched.
Type
Promise

fetchWithRetryAndTimeout(memberModel, maxRetries, timeout, attemptopt) → {DataONEObject}

Fetch a model with a timeout and a maximum number of retries. Fetch a model with a timeout, aborting the fetch if it takes too long.
Parameters:
Name Type Attributes Description
memberModel DataONEObject The model to fetch
maxRetries number The maximum number of retries
timeout number The timeout in milliseconds. If set to anything other than a positive number greater than 0, the fetch will not have a timeout (i.e., will wait indefinitely)
attempt number <optional>
The current attempt number
Since:
  • 2.32.1
Source:
Returns:
The fetched model
Type
DataONEObject

getAbsolutePath(relativePath) → {string}

Get the absolute path from a relative path, handling '~', '..', and '.'.
Parameters:
Name Type Description
relativePath string The relative path to be converted to an absolute path.
Since:
  • 2.28.0
Source:
Returns:
The absolute path after processing '~', '..', and '.'. If the result is empty, returns '/'.
Type
string

getAtLocation() → {object}

Returns atLocation information found in this resourceMap for all the PIDs in this resourceMap
Since:
  • 2.28.0
Source:
Returns:
- object with PIDs as key and atLocation paths as values
Type
object

getChangedMembers() → {Array.<DataPackageMember>}

Return active members that require an object write or system metadata update. Removed members are deaggregated by the ResourceMap, not uploaded, so they are excluded.
Source:
Returns:
Changed members
Type
Array.<DataPackageMember>

getCnURI() → {string}

Parses out the CN Resolve URL from the existing statements in the RDF or if not found in the RDF, from the app configuration.
Source:
Returns:
- The CN resolve URL
Type
string

getContentMembers() → {Array.<DataPackageMember>}

Return active members excluding the root ResourceMap. Includes metadata, nested ResourceMaps, and staged files not yet linked to the graph.
Source:
Returns:
Active package content
Type
Array.<DataPackageMember>

getExecutionId(programId) → {string}

Get the execution identifier that is associated with a program id. This will either be in the 'prov_wasExecutedByExecution' of the package member for the program script, or available by tracing backward in the RDF graph from the program node, through the assocation to the related execution.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

getExecutionNode(executionId) → {object}

Get the RDF node for an execution that is associated with the execution identifier. The execution may have been created in the resource map as a 'bare' urn:uuid (no resolveURI), or as a resolve URL, so check for both until the id is found.
Parameters:
Name Type Description
executionId string The execution identifier
Source:
Returns:
The RDF node for the execution
Type
object

getLatestVersionPid(optionsopt) → {Promise.<(string|null)>}

Find the latest PID for the package's primary object.
Parameters:
Name Type Attributes Description
options object <optional>
Lookup options
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Abort signal
requireComplete boolean <optional>
Require proof that each version walk reached the end of its chain
Source:
Throws:
When the version lookup fails
Type
Error
Returns:
Latest primary PID, or null
Type
Promise.<(string|null)>

getMember(context) → {Backbone.Model}

When a data package member updates, we evaluate it for its formatid, and update it appropriately if it is not a data object only
Parameters:
Name Type Description
context Backbone.Model The model that was updated
Source:
Returns:
The updated model
Type
Backbone.Model

getMissingFileModels() → {Array.<Backbone.Model>}

Returns an array of member models that are missing files
Since:
  • 2.36.2
Source:
Returns:
An array of member models that are missing files
Type
Array.<Backbone.Model>

getNestedResourceMapMembers() → {Array.<DataPackageMember>}

Return ResourceMap members aggregated by the root ResourceMap.
Source:
Returns:
Nested ResourceMap members
Type
Array.<DataPackageMember>

getPrimaryMetadataMember() → {DataPackageMember|null}

Return the primary metadata member for the package.
Source:
Returns:
Primary metadata member, or null when the package aggregates no metadata
Type
DataPackageMember | null

getQueue() → {Array}

Gets objects not yet uploaded to the DataONE server
Source:
Returns:
An array of models that are in the queue or in progress of uploading
Type
Array

getResourceMapModel(resourceMapPidopt) → {ResourceMap|null}

Return the parsed ResourceMap model for a resource map member, when that member's object has been fetched and parsed.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID. Defaults to the root resource map
Source:
Returns:
Parsed ResourceMap model, or null
Type
ResourceMap | null

getRootResourceMapMember() → {DataPackageMember|null}

Return the resource map member for the package. Returns only the root resource map in case there are nested resource maps.
Source:
Returns:
Root resource map member, or null when the package does not aggregate any resource maps
Type
DataPackageMember | null

getTotalSize() → {number}

Sum the known sizes of the package's data members.
Source:
Returns:
Known total bytes
Type
number

getURIFromRDF(id) → {string}

Finds the given identifier in the RDF graph and returns the subject URI of that statement. This is useful when adding additional statements to the RDF graph for an object that already exists in that graph.
Parameters:
Name Type Description
id string The identifier to search for
Source:
Returns:
- The full URI for the given id as it exists in the RDF.
Type
string

getValue(result, name) → {string}

The return values have to be extracted from the result.
Parameters:
Name Type Description
result object The result of the SPARQL query
name string The name of the field to extract
Source:
Returns:
- The value of the result
Type
string

handleAdd(dataONEObject)

Actions ot perform when a DataONEObject model is added to this collection
Parameters:
Name Type Description
dataONEObject DataONEObject The DataONEObject model that was added
Source:

handleMemberFetchError(failedModels, errors)

Handle errors that occur when fetching member models
Parameters:
Name Type Description
failedModels Array.<DataONEObject> The models that were being fetched
errors Array.<Error> The errors that occurred
Since:
  • 2.32.1
Source:

hasMetadataContentEdits() → {boolean}

Return whether EML/metadata content has been edited since the last save. Legacy EML editor views/models flag these edits via EMLUtilities.markRootDataPackageChanged().
Source:
Returns:
Whether metadata content has unsaved edits
Type
boolean

hasUnsavedChanges() → {boolean}

Return whether the package has edits newer than its last successful save.
Source:
Returns:
Whether the package has unsaved changes
Type
boolean

initialize()

Source:

initializeLoadedMembersForEditing() → {DataPackage}

Initialize existing package members for editing after a read-only load. Members without editable state are marked as already stored and aggregated under their current PIDs. Existing editable state is preserved.
Source:
Returns:
This package
Type
DataPackage

isEditLocked() → {boolean}

Return whether a full package save is queued, preparing, or executing. Background eager uploads do not lock editing.
Source:
Returns:
Whether package edits are locked
Type
boolean

linkDocumentation(metadataPid, dataPid) → {DataPackage}

Link a metadata member to the data member it documents.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

linkStagedFiles(addedMembers, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Add staged members to the editable package by aggregating them in the ResourceMap. This records the package edit and starts eager object uploads. Membership becomes durable when the ResourceMap is saved.
Parameters:
Name Type Attributes Description
addedMembers Array.<DataPackageMember> Staged members to link
options object <optional>
Edit options
Properties
Name Type Attributes Description
metadataPid string <optional>
Metadata member documenting files
atLocation string <optional>
Folder path to store in the ResourceMap `prov:atLocation` value
inheritAccessPolicy boolean <optional>
Whether new members inherit the documenting metadata member's access policy
Source:
Throws:
When the requested links cannot be applied atomically
Type
Error
Returns:
Locally added package members
Type
Promise.<Array.<DataPackageMember>>

markMemberContentDirty(pid) → {Promise.<DataPackageMember>}

Mark a member's object content dirty, assigning a replacement PID when needed.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When PID reassignment cannot be applied atomically
Type
Error
Returns:
Changed member
Type
Promise.<DataPackageMember>

mergeModels(otherModels, fieldsToMergeopt)

Merge the attributes of other models into the corresponding models in this collection. This should be used when merging models of other types (e.g. SolrResult) that represent the same object that the DataONEObject models in the collection represent.
Parameters:
Name Type Attributes Description
otherModels Array.<Backbone.Model> the other models to merge with the models in this collection
fieldsToMerge Array.<string> <optional>
If specified, only these fields will be extracted from the otherModels
Source:

missingFilesDetected() → {boolean}

Checks whether any member models are missing files
Since:
  • 2.36.2
Source:
Returns:
True if any member models are missing files
Type
boolean

model(attrs, options) → {DataONEObject|ScienceMetadata|EML211|DataPackage}

The DataPackage collection stores DataPackages and DataONEObjects, including Metadata and Data objects. Return the correct model based on the type
Parameters:
Name Type Description
attrs object The attributes of the model
options object Options to pass to the instantiated model
Source:
Returns:
The model
Type
DataONEObject | ScienceMetadata | EML211 | DataPackage

mutateProvenance(method, args) → {DataPackage}

Run a provenance mutation and record the package edit.
Parameters:
Name Type Description
method string Provenance method name
args Array.<*> Arguments passed to the provenance method
Source:
Throws:
When the package cannot be edited or the method is invalid
Type
Error
Returns:
This package
Type
DataPackage

needsUpdate() → {boolean}

Checks if this resource map has had any changes that requires an update
Source:
Returns:
- True if the resource map needs to be updated
Type
boolean

onDone()

This callback is called when all queries have finished.
Source:

onResult(result)

This callback is called for every query solution of the SPARQL queries. One query may result in multple queries solutions and calls to this function. Each query result returns two pids, i.e. pid: 1234 prov_generated: 5678, which corresponds to the RDF triple '5678 wasGeneratedBy 1234', or the DataONE solr document for pid '1234', with the field prov_generated: 5678.
Parameters:
Name Type Description
result object The result of the SPARQL query
Source:
Example
// The result can look like this:
 [?pid: t, ?prov_wasDerivedFrom: t, ?primary_data: t, ?derived_data: t]
 ?derived_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Adbbb9a2e-af64-452a-b7b9-122861a5dbb2"}
 ?pid : t {termType: "Literal", value: "urn:uuid:dbbb9a2e-af64-452a-b7b9-122861a5dbb2", datatype: t}
 ?primary_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Aaae9d025-a331-4c3a-b399-a8ca0a2826ef"}
 ?prov_wasDerivedFrom : t {termType: "Literal", value: "urn:uuid:aae9d025-a331-4c3a-b399-a8ca0a2826ef", datatype: t}]

parse(response, _options) → {Array.<DataPackage>}

Deserialize a Package from OAI-ORE RDF XML
Parameters:
Name Type Description
response string The RDF/XML string to parse
_options object Options for parsing the RDF/XML
Source:
Returns:
- An array of models that were parsed from the RDF/XML
Type
Array.<DataPackage>

parseProv()

Parse the provenance relationships from the RDF graph, after all DataPackage members have been fetched, as the prov info will be stored in them.
Source:

parseSysMeta(sysMeta) → {object}

Use the DataONEObject parseSysMeta() function
Parameters:
Name Type Description
sysMeta object The system metadata object to parse
Source:
Returns:
The parsed system metadata object
Type
object

provEditsPending() → {boolean}

Check if there are any provenance edits pending
Source:
Returns:
Returns true if the prov edits list is not empty, otherwise false.
Type
boolean

publish() → {Promise.<{pid: string, resourceMapPending: boolean}>}

Publish the package and verify ambiguous publication responses.
Source:
Throws:
When publication fails or cannot be verified
Type
Error
Returns:
Publication result
Type
Promise.<{pid: string, resourceMapPending: boolean}>

recordProvEdit(operation, subject, predicate, object)

Accumulate edits that are made to the provenance relationships via the ProvChartView. these edits are accumulated here so that they are available to any package member or view.
Parameters:
Name Type Description
operation string The operation performed on the relationship (add or delete)
subject string The subject of the relationship
predicate string The predicate of the relationship
object string The object of the relationship
Source:

recordUserEdit(event, details) → {DataPackage}

Advance the draft revision and publish a package edit event.
Parameters:
Name Type Description
event string Edit event name
details object Event details
Source:
Throws:
When the package is locked for editing
Type
Error
Returns:
This package
Type
DataPackage

refreshMemberGraphFields(resourceMapopt) → {DataPackage}

Copy relationships and locations from the ResourceMap graph to each active package member. Call this after changing the ResourceMap to keep those member fields in sync.
Parameters:
Name Type Attributes Description
resourceMap ResourceMap <optional>
ResourceMap to read; defaults to the package's root ResourceMap
Source:
Returns:
This package
Type
DataPackage

removeFromAggregation(id)

Removes an object from the aggregation in the RDF graph
Parameters:
Name Type Description
id string The identifier of the object to remove
Source:

removeGeneratedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeIfLastProvRef(subjectNode, predicateNode, objectNode)

Remove the statement fromn the RDF graph only if the subject of this relationship is not referenced by any other provenance relationship, i.e. for example, the prov relationship "id rdf:type provone:data" is only needed if the subject ('id') is referenced in another relationship. Also don't remove it if the subject is in any other prov statement, meaning it still references another prov object.
Parameters:
Name Type Description
subjectNode object The subject of the statement to remove
predicateNode object The predicate of the statement to remove
objectNode object The object of the statement to remove
Source:

removeMembers(pids) → {Array.<DataPackageMember>}

Mark members removed from the desired package.
Parameters:
Name Type Description
pids string | Array.<string> Member PIDs
Source:
Throws:
When removal would invalidate the package or graph
Type
Error
Returns:
Removed members
Type
Array.<DataPackageMember>

removeOrphanedBlankNodes()

Remove orphaned blank nodes from the model's current graph This was put in to support replacing package members who are referenced by provenance statements, specifically members typed as Programs. rdflib.js will throw an error when serializing if any statements in the graph have objects that are blank nodes when no other statements in the graph have subjects for the same blank node. i.e., blank nodes references that aren't defined. Should be called during a call to serialize() and mutates this.dataPackageGraph directly as a side-effect.
Source:

removeProgramFromGraph(programId) → {boolean}

Remove a program identifier from the RDF graph and remove associated linkage between the program id and the exection, if the execution is not being used by any other statements.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
Returns true if the program was removed, otherwise false.
Type
boolean

removeUsedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeWasDerivedFrom(…args) → {DataPackage}

Remove a derivation relationship between two data objects.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

renameMemberFile(pid, fileName) → {Promise.<DataPackageMember>}

Rename a member's display file name and matching ResourceMap locations.
Parameters:
Name Type Description
pid string Member PID
fileName string New file name
Source:
Throws:
When the requested file name is empty
Type
Error
Returns:
Updated member
Type
Promise.<DataPackageMember>

replaceFile(pid, file, optionsopt) → {Promise.<DataPackageMember>}

Replace a member's content and desired PID as one transaction.
Parameters:
Name Type Attributes Description
pid string Current member PID
file Blob | File Replacement content
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPid string <optional>
Optional custom replacement PID
replacementSourcePid string <optional>
Remote PID to obsolete
Source:
Throws:
When the replacement is invalid or cannot be applied atomically
Type
Error
Returns:
Replaced member
Type
Promise.<DataPackageMember>

requireMember(pid) → {DataPackageMember}

Return a package member or throw when it is missing.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When no package member has the PID
Type
Error
Returns:
Matching member
Type
DataPackageMember

requireResourceMapModel(resourceMapPidopt) → {ResourceMap}

Return a loaded resource map model or throw when it is unavailable.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID
Source:
Throws:
When the resource map is not loaded
Type
Error
Returns:
Loaded resource map
Type
ResourceMap

save(optionsopt)

Overwrite the Backbone.Collection.sync() function to set custom options
Parameters:
Name Type Attributes Description
options object <optional>
Options for this DataPackage save
Properties
Name Type Attributes Description
sysMetaOnly boolean <optional>
If true, only the system metadata of this Package will be saved.
resourceMapOnly boolean <optional>
If true, only the Resource Map/Package object will be saved. Metadata and Data objects aggregated by the package will be skipped.
Source:

saveProv()

If provenance relationships have been modified by the provenance editor (in ProvChartView), then update the ORE Resource Map and save it to the server.
Source:

saveReference(model)

Save a reference to this collection in the model
Parameters:
Name Type Description
model DataONEObject The model to save a reference to
Source:

serialize() → {string}

Serialize the DataPackage to OAI-ORE RDF XML
Source:
Returns:
The serialized RDF/XML
Type
string
Replace the package's documentation links.
Parameters:
Name Type Description
links Array.<ResMapDocLink> Desired documentation links
Source:
Throws:
When the package cannot be edited
Type
Error
Returns:
This package
Type
DataPackage

setLoadingFiles(dataONEObjectopt)

Tracks the upload status of DataONEObject models in this collection. If they are `loading` into the DOM or `in progress` of an upload to the server, they will be considered as "loading" files.
Parameters:
Name Type Attributes Description
dataONEObject DataONEObject <optional>
A model to begin tracking. Optional. If no DataONEObject is given, then only the number of loading files will be calcualted and set on the packageModel.
Since:
  • 2.17.1
Source:

setMemberAccessPolicy(pid, accessPolicy, optionsopt) → {Promise.<DataPackageMember>}

Set one member's desired access policy.
Parameters:
Name Type Attributes Description
pid string Member PID
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated member
Type
Promise.<DataPackageMember>

setMemberLocation(pid, path) → {DataPackageMember}

Replace the ResourceMap location for a package member.
Parameters:
Name Type Description
pid string Member PID
path string Raw location path
Source:
Returns:
Updated member
Type
DataPackageMember

setPackageAccessPolicy(accessPolicy, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage a package access policy change.
Parameters:
Name Type Attributes Description
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
propagate boolean <optional>
Whether to target every active package member. Otherwise target the root ResourceMap and primary metadata only
maxConcurrent number <optional>
Fetch concurrency
onProgress function <optional>
SysMeta fetch progress callback
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated members
Type
Promise.<Array.<DataPackageMember>>

stageLocalFiles(files, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage local files in the in-memory member collection and assign their PIDs. Staged members can be rendered by the editor, but are not yet aggregated by the ResourceMap, recorded as `members:add`, or uploaded.
Parameters:
Name Type Attributes Description
files Array.<File> | Array.<Blob> Files to add
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPids Array.<string> <optional>
Optional custom PIDs by index
Source:
Returns:
In-memory members awaiting ResourceMap linking
Type
Promise.<Array.<DataPackageMember>>

triggerComplete(model)

Trigger the complete event if all models have been fetched
Parameters:
Name Type Description
model Backbone.Model The model that was fetched
Source:

unlinkDocumentation(metadataPid, dataPid) → {DataPackage}

Remove a documentation link between two package members.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

updateLoadingCount(num)

Sets the numLoadingFileMetadata attribute on the package model
Parameters:
Name Type Description
num number The number of models that are currently being fetched
Since:
  • 2.32.1
Source:

updateMemberModelType(memberModel, maxRetries, timeout) → {DataONEObject}

After a member model is fetched, determine whether it needs to: 1) be merged into the collection (the type did NOT change) 2) replace the old model (the type changed to DataPackage) 3) be fetched again, waited for, and then replaced in the collection (the type from the server is different from the type in the collection) Then resolve the promise when the model is fully handled.
Parameters:
Name Type Description
memberModel DataONEObject The model to potentially replace
maxRetries number The maximum number of retries for each fetch request
timeout number The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout
Since:
  • 2.32.1
Source:
Returns:
The updated model
Type
DataONEObject

updateRelationships()

Update the relationships in this resource map when its been udpated
Source:

url(optionsopt) → {string}

Build the DataPackage URL based on the MetacatUI.appModel.objectServiceUrl and id or seriesid
Parameters:
Name Type Attributes Description
options object <optional>
Optional options for this URL
Properties
Name Type Attributes Description
update boolean <optional>
If true, this URL will be for updating the package
Source:
Returns:
The URL for this DataPackage
Type
string

DataPackage()

A DataPackage represents a hierarchical collection of packages, metadata, and data objects, modeling an OAI-ORE RDF graph.

Constructor

new DataPackage()

Deprecated:
  • Use models/dataPackage/DataPackage for new package workflows
Source:

Extends

  • Backbone.Collection

Members

comparator :string

Used to keep the collection sorted by model "sortOrder". The three model types are ordered as: Metadata: 1; Data: 2; DataPackage: 3. See getMember(). We do this so that Metadata get rendered first, and Data are rendered as DOM siblings of the Metadata rows of the DataPackage table.
Type:
  • string
Source:

dataPackageGraph :RDFGraph

The RDF graph representing this data package
Type:
Source:

derivations :Array.<DataONEObject>

Package members that are derivations in provenance relationships.
Type:
Source:

editable :boolean

A flag used for the package's edit status. Can be set to false to 'lock' the package
Type:
  • boolean
Source:

filterModel :Filter

A Filter model that should filter the Solr index for only the objects aggregated by this package.
Type:
Source:

id :string

The package identifier
Type:
  • string
Source:

namespaces :object

Namespaces used in the RDF XML. The key is the prefix and the value is the namespace URI.
Type:
  • object
Source:

nodeLevel :number

The nesting level in a data package hierarchy
Type:
  • number
Source:

numSaves :number

The number of models that have been updated during the current save(). This is reset to zero after the current save() is complete.
Type:
  • number
Source:

originalIsDocBy :object

The science data identifiers associated with this data package (from cito:documents), mapped to the science metadata identifier that documents it. Not to be changed after initial fetch - this is to keep track of the relationships in their original state
Type:
  • object
Source:

originalMembers :Array.<string>

An array of ids that are aggregated in the resource map on the server. Taken from the original RDF XML that was fetched from the server. Used for comparing the original aggregation with the aggregation of this collection.
Type:
  • Array.<string>
Source:

packageModel :DataONEObject

A DataONEObject representing the resource map itself
Type:
Source:

provEdits :Array.<Array.<string>>

Contains provenance relationships added or deleted to this DataONEObject. Each entry is [operation ('add' or 'delete'), prov field name, object id], i.e. ['add', 'prov_used', 'urn:uuid:5678']
Type:
  • Array.<Array.<string>>
Source:

provenanceFlag :string|null

Set to "complete" to signal that all prov queries have finished
Type:
  • string | null
Source:

solrResults :SolrResults

The SolrResults collection associated with this DataPackage. This can be used to fetch the package from Solr by passing the 'fromIndex' option to fetch().
Type:
Source:

sources :Array.<DataONEObject>

Package members that are sources in provenance relationships.
Type:
Source:

transferQueue :DataPackage|Metadata|Array.<Data>

The type of the object (DataPackage, Metadata, Data) Simple queue to enqueue file transfers. Use push() and shift() to add and remove items. If this gets to large/slow, possibly switch to http://code.stephenmorley.org/javascript/queues/
Type:
Source:

type :string

The name of this type of collection
Type:
  • string
Source:

Methods

addGeneratedByProgram(dataPid, programPid) → {DataPackage}

Record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addNewModel(model)

Adds a DataONEObject model to this DataPackage collection
Parameters:
Name Type Description
model DataONEObject The DataONEObject model to add
Source:

addProgramToGraph(programId) → {string}

Add a program identifier to the RDF graph and create an execution node
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

addToAggregation(id)

Adds a new object to the resource map RDF graph
Parameters:
Name Type Description
id string The identifier of the object to add
Source:

addToGraph(subject, predicate, object)

Add the specified relationship to the RDF graph only if it has not already been added.
Parameters:
Name Type Description
subject object The subject of the statement to add
predicate object The predicate of the statement to add
object object The object of the statement to add
Source:

addUsedByProgram(dataPid, programPid) → {DataPackage}

Record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addViewServiceEntities(entities) → {void}

Merge entity summaries from a rendered metadata document into matching package members.
Parameters:
Name Type Description
entities Array.<object> Plain entity summaries from ViewServiceDoc
Source:
Returns:
Type
void

addWasDerivedFrom(…args) → {DataPackage}

Record that one data object was derived from another.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

allocatePid(optionsopt) → {Promise.<string>}

Reserve a new PID for a package member, or confirm a requested PID is available.
Parameters:
Name Type Attributes Description
options object <optional>
Allocation options
Properties
Name Type Attributes Description
requestedPid string <optional>
Custom PID to reserve
resourceMap boolean <optional>
Allocate a ResourceMap PID
Source:
Throws:
When allocation fails or the reserved PID does not match
Type
Error
Returns:
Allocated PID
Type
Promise.<string>

assertCanEdit(memberPidopt) → {true}

Reject a package edit while a full save is queued or active, or a member edit while that member is uploading eagerly.
Parameters:
Name Type Attributes Description
memberPid string <optional>
Member being edited
Source:
Throws:
With `code === "upload_in_progress"` while locked
Type
Error
Returns:
True when editing is allowed
Type
true

assertNotNestedResourceMap(member, rootResourceMapopt) → {DataPackageMember}

Reject direct edits to ResourceMaps aggregated by the root package.
Parameters:
Name Type Attributes Description
member DataPackageMember Package member
rootResourceMap DataPackageMember <optional>
Root ResourceMap member
Source:
Throws:
When the member is a nested resource map
Type
Error
Returns:
The accepted member
Type
DataPackageMember

assignNewMemberPid(member, optionsopt) → {Promise.<string>}

Assign a PID to a new member when it does not already have one.
Parameters:
Name Type Attributes Description
member DataPackageMember Member to assign
options object <optional>
Allocation options
Source:
Returns:
Desired PID
Type
Promise.<string>

assignReplacementPid(member, optionsopt) → {Promise.<string>}

Assign one stable replacement PID to an existing member.
Parameters:
Name Type Attributes Description
member DataPackageMember Member being replaced
options object <optional>
Allocation options
Source:
Returns:
Desired replacement PID
Type
Promise.<string>

broadcastAccessPolicy(accessPolicy)

Broadcast an accessPolicy across members of this package Note: Currently just sets the incoming accessPolicy on this object and doesn't broadcast to other members (such as data). How this works is likely to change in the future. Closely tied to the AccessPolicyView.broadcast property.
Parameters:
Name Type Description
accessPolicy AccessPolicy The accessPolicy to broadcast
Source:

checkResourceMapWritePermission(optionsopt) → {Promise.<boolean>}

Check whether the user can write to the root resource map specifically. Provenance editing depends on resource map writability rather than metadata write permission, so this is intentionally separate from DataPackage#checkWritePermissions, which requires write access to every member.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether the root resource map is writable Returns false when no resource map has been resolved
Type
Promise.<boolean>

checkWritePermissions(optionsopt) → {Promise.<boolean>}

Check if the user has write permission on the resource map and metadata if they both exist, or just the one that exists if only one exists. If neither exists, then return false.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether every checked member is writable
Type
Promise.<boolean>

cloneNode(nodeToClone) → {Node}

Clone an rdflib.js Node by creaing a new node based on the original node RDF term type and data type.
Parameters:
Name Type Description
nodeToClone Node The node to clone
Source:
Returns:
- The cloned node
Type
Node

discardFileReplacement(pid) → {DataPackageMember}

Restore the remote file after a failed replacement, retaining independent sharing and ownership edits.
Parameters:
Name Type Description
pid string Replacement PID currently assigned to the member
Source:
Throws:
When the original member state cannot be restored
Type
Error
Returns:
Restored member
Type
DataPackageMember

ensureMetadataUploadPid(member) → {Promise.<string>}

Ensure changed metadata has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember Metadata member
Source:
Throws:
When changed metadata has no replacement PID
Type
Error
Returns:
Desired PID
Type
Promise.<string>

ensureResourceMapUploadPid(member) → {Promise.<string>}

Ensure the ResourceMap has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember ResourceMap member
Source:
Returns:
Desired PID
Type
Promise.<string>

fetch(sourceOptionsopt) → {Promise}

Fetch the resource map RDF XML for this package
Parameters:
Name Type Attributes Description
sourceOptions object <optional>
Optional options for this fetch that get sent with the XHR request
Properties:
Name Type Description
fetchModels boolean If false, this fetch will not fetch each model in the collection. It will only get the resource map object.
fromIndex boolean If true, the collection will be fetched from Solr rather than fetching the system metadata of each model. Useful when you only need to retrieve limited information about each package member. Set query-specific parameters on the `solrResults` SolrResults set on this collection.
Source:
Returns:
A promise that resolves when the fetch is complete
Type
Promise

fetchFromIndex()

Fetches this DataPackage from the Solr index by using a SolrResults collection and merging the models in.
Source:

fetchMemberModels(models, batchSizeopt, timeoutopt, maxRetriesopt) → {Promise}

Fetches member models in batches to avoid fetching all members simultaneously.
Parameters:
Name Type Attributes Description
models Array.<Backbone.Model> The array of member models to fetch.
batchSize number <optional>
The number of models to fetch in each batch.
timeout number <optional>
The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout.
maxRetries number <optional>
The maximum number of retries for each fetch request.
Since:
  • 2.32.0
Source:
Returns:
A promise that resolves when all models have been fetched.
Type
Promise

fetchPromise(model) → {object}

Fetch a model using Backbone's fetch method but return a promise that resolves when the fetch is complete, along with the XHR object
Parameters:
Name Type Description
model DataONEObject The model to fetch
Since:
  • 2.32.1
Source:
Returns:
An object with a promise and an XHR reference
Type
object

fetchSysMeta(memberPids, optionsopt) → {Promise.<Array.<{pid: string, error: Error}>>}

Fetch missing system metadata for selected package members.
Parameters:
Name Type Attributes Description
memberPids Array.<string> | null PIDs to fetch, or null for all members
options object <optional>
Fetch options
Properties
Name Type Attributes Description
maxConcurrent number <optional>
Fetch concurrency
Source:
Returns:
Fetch failures
Type
Promise.<Array.<{pid: string, error: Error}>>

fetchSysMetaForPlaceholders() → {Promise}

Fetches the system metadata for all member models that are marked as placeholder documents (i.e., isPlaceHolder_b === true). This property is retrieved from Solr and indicates that the file ID is referenced in a resource map, but has either not yet been indexed or is missing from the repository.
Since:
  • 2.36.2
Source:
Returns:
A promise that resolves when all placeholder member models have been fetched.
Type
Promise

fetchWithRetryAndTimeout(memberModel, maxRetries, timeout, attemptopt) → {DataONEObject}

Fetch a model with a timeout and a maximum number of retries. Fetch a model with a timeout, aborting the fetch if it takes too long.
Parameters:
Name Type Attributes Description
memberModel DataONEObject The model to fetch
maxRetries number The maximum number of retries
timeout number The timeout in milliseconds. If set to anything other than a positive number greater than 0, the fetch will not have a timeout (i.e., will wait indefinitely)
attempt number <optional>
The current attempt number
Since:
  • 2.32.1
Source:
Returns:
The fetched model
Type
DataONEObject

getAbsolutePath(relativePath) → {string}

Get the absolute path from a relative path, handling '~', '..', and '.'.
Parameters:
Name Type Description
relativePath string The relative path to be converted to an absolute path.
Since:
  • 2.28.0
Source:
Returns:
The absolute path after processing '~', '..', and '.'. If the result is empty, returns '/'.
Type
string

getAtLocation() → {object}

Returns atLocation information found in this resourceMap for all the PIDs in this resourceMap
Since:
  • 2.28.0
Source:
Returns:
- object with PIDs as key and atLocation paths as values
Type
object

getChangedMembers() → {Array.<DataPackageMember>}

Return active members that require an object write or system metadata update. Removed members are deaggregated by the ResourceMap, not uploaded, so they are excluded.
Source:
Returns:
Changed members
Type
Array.<DataPackageMember>

getCnURI() → {string}

Parses out the CN Resolve URL from the existing statements in the RDF or if not found in the RDF, from the app configuration.
Source:
Returns:
- The CN resolve URL
Type
string

getContentMembers() → {Array.<DataPackageMember>}

Return active members excluding the root ResourceMap. Includes metadata, nested ResourceMaps, and staged files not yet linked to the graph.
Source:
Returns:
Active package content
Type
Array.<DataPackageMember>

getExecutionId(programId) → {string}

Get the execution identifier that is associated with a program id. This will either be in the 'prov_wasExecutedByExecution' of the package member for the program script, or available by tracing backward in the RDF graph from the program node, through the assocation to the related execution.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

getExecutionNode(executionId) → {object}

Get the RDF node for an execution that is associated with the execution identifier. The execution may have been created in the resource map as a 'bare' urn:uuid (no resolveURI), or as a resolve URL, so check for both until the id is found.
Parameters:
Name Type Description
executionId string The execution identifier
Source:
Returns:
The RDF node for the execution
Type
object

getLatestVersionPid(optionsopt) → {Promise.<(string|null)>}

Find the latest PID for the package's primary object.
Parameters:
Name Type Attributes Description
options object <optional>
Lookup options
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Abort signal
requireComplete boolean <optional>
Require proof that each version walk reached the end of its chain
Source:
Throws:
When the version lookup fails
Type
Error
Returns:
Latest primary PID, or null
Type
Promise.<(string|null)>

getMember(context) → {Backbone.Model}

When a data package member updates, we evaluate it for its formatid, and update it appropriately if it is not a data object only
Parameters:
Name Type Description
context Backbone.Model The model that was updated
Source:
Returns:
The updated model
Type
Backbone.Model

getMissingFileModels() → {Array.<Backbone.Model>}

Returns an array of member models that are missing files
Since:
  • 2.36.2
Source:
Returns:
An array of member models that are missing files
Type
Array.<Backbone.Model>

getNestedResourceMapMembers() → {Array.<DataPackageMember>}

Return ResourceMap members aggregated by the root ResourceMap.
Source:
Returns:
Nested ResourceMap members
Type
Array.<DataPackageMember>

getPrimaryMetadataMember() → {DataPackageMember|null}

Return the primary metadata member for the package.
Source:
Returns:
Primary metadata member, or null when the package aggregates no metadata
Type
DataPackageMember | null

getQueue() → {Array}

Gets objects not yet uploaded to the DataONE server
Source:
Returns:
An array of models that are in the queue or in progress of uploading
Type
Array

getResourceMapModel(resourceMapPidopt) → {ResourceMap|null}

Return the parsed ResourceMap model for a resource map member, when that member's object has been fetched and parsed.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID. Defaults to the root resource map
Source:
Returns:
Parsed ResourceMap model, or null
Type
ResourceMap | null

getRootResourceMapMember() → {DataPackageMember|null}

Return the resource map member for the package. Returns only the root resource map in case there are nested resource maps.
Source:
Returns:
Root resource map member, or null when the package does not aggregate any resource maps
Type
DataPackageMember | null

getTotalSize() → {number}

Sum the known sizes of the package's data members.
Source:
Returns:
Known total bytes
Type
number

getURIFromRDF(id) → {string}

Finds the given identifier in the RDF graph and returns the subject URI of that statement. This is useful when adding additional statements to the RDF graph for an object that already exists in that graph.
Parameters:
Name Type Description
id string The identifier to search for
Source:
Returns:
- The full URI for the given id as it exists in the RDF.
Type
string

getValue(result, name) → {string}

The return values have to be extracted from the result.
Parameters:
Name Type Description
result object The result of the SPARQL query
name string The name of the field to extract
Source:
Returns:
- The value of the result
Type
string

handleAdd(dataONEObject)

Actions ot perform when a DataONEObject model is added to this collection
Parameters:
Name Type Description
dataONEObject DataONEObject The DataONEObject model that was added
Source:

handleMemberFetchError(failedModels, errors)

Handle errors that occur when fetching member models
Parameters:
Name Type Description
failedModels Array.<DataONEObject> The models that were being fetched
errors Array.<Error> The errors that occurred
Since:
  • 2.32.1
Source:

hasMetadataContentEdits() → {boolean}

Return whether EML/metadata content has been edited since the last save. Legacy EML editor views/models flag these edits via EMLUtilities.markRootDataPackageChanged().
Source:
Returns:
Whether metadata content has unsaved edits
Type
boolean

hasUnsavedChanges() → {boolean}

Return whether the package has edits newer than its last successful save.
Source:
Returns:
Whether the package has unsaved changes
Type
boolean

initialize()

Source:

initializeLoadedMembersForEditing() → {DataPackage}

Initialize existing package members for editing after a read-only load. Members without editable state are marked as already stored and aggregated under their current PIDs. Existing editable state is preserved.
Source:
Returns:
This package
Type
DataPackage

isEditLocked() → {boolean}

Return whether a full package save is queued, preparing, or executing. Background eager uploads do not lock editing.
Source:
Returns:
Whether package edits are locked
Type
boolean

linkDocumentation(metadataPid, dataPid) → {DataPackage}

Link a metadata member to the data member it documents.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

linkStagedFiles(addedMembers, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Add staged members to the editable package by aggregating them in the ResourceMap. This records the package edit and starts eager object uploads. Membership becomes durable when the ResourceMap is saved.
Parameters:
Name Type Attributes Description
addedMembers Array.<DataPackageMember> Staged members to link
options object <optional>
Edit options
Properties
Name Type Attributes Description
metadataPid string <optional>
Metadata member documenting files
atLocation string <optional>
Folder path to store in the ResourceMap `prov:atLocation` value
inheritAccessPolicy boolean <optional>
Whether new members inherit the documenting metadata member's access policy
Source:
Throws:
When the requested links cannot be applied atomically
Type
Error
Returns:
Locally added package members
Type
Promise.<Array.<DataPackageMember>>

markMemberContentDirty(pid) → {Promise.<DataPackageMember>}

Mark a member's object content dirty, assigning a replacement PID when needed.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When PID reassignment cannot be applied atomically
Type
Error
Returns:
Changed member
Type
Promise.<DataPackageMember>

mergeModels(otherModels, fieldsToMergeopt)

Merge the attributes of other models into the corresponding models in this collection. This should be used when merging models of other types (e.g. SolrResult) that represent the same object that the DataONEObject models in the collection represent.
Parameters:
Name Type Attributes Description
otherModels Array.<Backbone.Model> the other models to merge with the models in this collection
fieldsToMerge Array.<string> <optional>
If specified, only these fields will be extracted from the otherModels
Source:

missingFilesDetected() → {boolean}

Checks whether any member models are missing files
Since:
  • 2.36.2
Source:
Returns:
True if any member models are missing files
Type
boolean

model(attrs, options) → {DataONEObject|ScienceMetadata|EML211|DataPackage}

The DataPackage collection stores DataPackages and DataONEObjects, including Metadata and Data objects. Return the correct model based on the type
Parameters:
Name Type Description
attrs object The attributes of the model
options object Options to pass to the instantiated model
Source:
Returns:
The model
Type
DataONEObject | ScienceMetadata | EML211 | DataPackage

mutateProvenance(method, args) → {DataPackage}

Run a provenance mutation and record the package edit.
Parameters:
Name Type Description
method string Provenance method name
args Array.<*> Arguments passed to the provenance method
Source:
Throws:
When the package cannot be edited or the method is invalid
Type
Error
Returns:
This package
Type
DataPackage

needsUpdate() → {boolean}

Checks if this resource map has had any changes that requires an update
Source:
Returns:
- True if the resource map needs to be updated
Type
boolean

onDone()

This callback is called when all queries have finished.
Source:

onResult(result)

This callback is called for every query solution of the SPARQL queries. One query may result in multple queries solutions and calls to this function. Each query result returns two pids, i.e. pid: 1234 prov_generated: 5678, which corresponds to the RDF triple '5678 wasGeneratedBy 1234', or the DataONE solr document for pid '1234', with the field prov_generated: 5678.
Parameters:
Name Type Description
result object The result of the SPARQL query
Source:
Example
// The result can look like this:
 [?pid: t, ?prov_wasDerivedFrom: t, ?primary_data: t, ?derived_data: t]
 ?derived_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Adbbb9a2e-af64-452a-b7b9-122861a5dbb2"}
 ?pid : t {termType: "Literal", value: "urn:uuid:dbbb9a2e-af64-452a-b7b9-122861a5dbb2", datatype: t}
 ?primary_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Aaae9d025-a331-4c3a-b399-a8ca0a2826ef"}
 ?prov_wasDerivedFrom : t {termType: "Literal", value: "urn:uuid:aae9d025-a331-4c3a-b399-a8ca0a2826ef", datatype: t}]

parse(response, _options) → {Array.<DataPackage>}

Deserialize a Package from OAI-ORE RDF XML
Parameters:
Name Type Description
response string The RDF/XML string to parse
_options object Options for parsing the RDF/XML
Source:
Returns:
- An array of models that were parsed from the RDF/XML
Type
Array.<DataPackage>

parseProv()

Parse the provenance relationships from the RDF graph, after all DataPackage members have been fetched, as the prov info will be stored in them.
Source:

parseSysMeta(sysMeta) → {object}

Use the DataONEObject parseSysMeta() function
Parameters:
Name Type Description
sysMeta object The system metadata object to parse
Source:
Returns:
The parsed system metadata object
Type
object

provEditsPending() → {boolean}

Check if there are any provenance edits pending
Source:
Returns:
Returns true if the prov edits list is not empty, otherwise false.
Type
boolean

publish() → {Promise.<{pid: string, resourceMapPending: boolean}>}

Publish the package and verify ambiguous publication responses.
Source:
Throws:
When publication fails or cannot be verified
Type
Error
Returns:
Publication result
Type
Promise.<{pid: string, resourceMapPending: boolean}>

recordProvEdit(operation, subject, predicate, object)

Accumulate edits that are made to the provenance relationships via the ProvChartView. these edits are accumulated here so that they are available to any package member or view.
Parameters:
Name Type Description
operation string The operation performed on the relationship (add or delete)
subject string The subject of the relationship
predicate string The predicate of the relationship
object string The object of the relationship
Source:

recordUserEdit(event, details) → {DataPackage}

Advance the draft revision and publish a package edit event.
Parameters:
Name Type Description
event string Edit event name
details object Event details
Source:
Throws:
When the package is locked for editing
Type
Error
Returns:
This package
Type
DataPackage

refreshMemberGraphFields(resourceMapopt) → {DataPackage}

Copy relationships and locations from the ResourceMap graph to each active package member. Call this after changing the ResourceMap to keep those member fields in sync.
Parameters:
Name Type Attributes Description
resourceMap ResourceMap <optional>
ResourceMap to read; defaults to the package's root ResourceMap
Source:
Returns:
This package
Type
DataPackage

removeFromAggregation(id)

Removes an object from the aggregation in the RDF graph
Parameters:
Name Type Description
id string The identifier of the object to remove
Source:

removeGeneratedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeIfLastProvRef(subjectNode, predicateNode, objectNode)

Remove the statement fromn the RDF graph only if the subject of this relationship is not referenced by any other provenance relationship, i.e. for example, the prov relationship "id rdf:type provone:data" is only needed if the subject ('id') is referenced in another relationship. Also don't remove it if the subject is in any other prov statement, meaning it still references another prov object.
Parameters:
Name Type Description
subjectNode object The subject of the statement to remove
predicateNode object The predicate of the statement to remove
objectNode object The object of the statement to remove
Source:

removeMembers(pids) → {Array.<DataPackageMember>}

Mark members removed from the desired package.
Parameters:
Name Type Description
pids string | Array.<string> Member PIDs
Source:
Throws:
When removal would invalidate the package or graph
Type
Error
Returns:
Removed members
Type
Array.<DataPackageMember>

removeOrphanedBlankNodes()

Remove orphaned blank nodes from the model's current graph This was put in to support replacing package members who are referenced by provenance statements, specifically members typed as Programs. rdflib.js will throw an error when serializing if any statements in the graph have objects that are blank nodes when no other statements in the graph have subjects for the same blank node. i.e., blank nodes references that aren't defined. Should be called during a call to serialize() and mutates this.dataPackageGraph directly as a side-effect.
Source:

removeProgramFromGraph(programId) → {boolean}

Remove a program identifier from the RDF graph and remove associated linkage between the program id and the exection, if the execution is not being used by any other statements.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
Returns true if the program was removed, otherwise false.
Type
boolean

removeUsedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeWasDerivedFrom(…args) → {DataPackage}

Remove a derivation relationship between two data objects.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

renameMemberFile(pid, fileName) → {Promise.<DataPackageMember>}

Rename a member's display file name and matching ResourceMap locations.
Parameters:
Name Type Description
pid string Member PID
fileName string New file name
Source:
Throws:
When the requested file name is empty
Type
Error
Returns:
Updated member
Type
Promise.<DataPackageMember>

replaceFile(pid, file, optionsopt) → {Promise.<DataPackageMember>}

Replace a member's content and desired PID as one transaction.
Parameters:
Name Type Attributes Description
pid string Current member PID
file Blob | File Replacement content
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPid string <optional>
Optional custom replacement PID
replacementSourcePid string <optional>
Remote PID to obsolete
Source:
Throws:
When the replacement is invalid or cannot be applied atomically
Type
Error
Returns:
Replaced member
Type
Promise.<DataPackageMember>

requireMember(pid) → {DataPackageMember}

Return a package member or throw when it is missing.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When no package member has the PID
Type
Error
Returns:
Matching member
Type
DataPackageMember

requireResourceMapModel(resourceMapPidopt) → {ResourceMap}

Return a loaded resource map model or throw when it is unavailable.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID
Source:
Throws:
When the resource map is not loaded
Type
Error
Returns:
Loaded resource map
Type
ResourceMap

save(optionsopt)

Overwrite the Backbone.Collection.sync() function to set custom options
Parameters:
Name Type Attributes Description
options object <optional>
Options for this DataPackage save
Properties
Name Type Attributes Description
sysMetaOnly boolean <optional>
If true, only the system metadata of this Package will be saved.
resourceMapOnly boolean <optional>
If true, only the Resource Map/Package object will be saved. Metadata and Data objects aggregated by the package will be skipped.
Source:

saveProv()

If provenance relationships have been modified by the provenance editor (in ProvChartView), then update the ORE Resource Map and save it to the server.
Source:

saveReference(model)

Save a reference to this collection in the model
Parameters:
Name Type Description
model DataONEObject The model to save a reference to
Source:

serialize() → {string}

Serialize the DataPackage to OAI-ORE RDF XML
Source:
Returns:
The serialized RDF/XML
Type
string
Replace the package's documentation links.
Parameters:
Name Type Description
links Array.<ResMapDocLink> Desired documentation links
Source:
Throws:
When the package cannot be edited
Type
Error
Returns:
This package
Type
DataPackage

setLoadingFiles(dataONEObjectopt)

Tracks the upload status of DataONEObject models in this collection. If they are `loading` into the DOM or `in progress` of an upload to the server, they will be considered as "loading" files.
Parameters:
Name Type Attributes Description
dataONEObject DataONEObject <optional>
A model to begin tracking. Optional. If no DataONEObject is given, then only the number of loading files will be calcualted and set on the packageModel.
Since:
  • 2.17.1
Source:

setMemberAccessPolicy(pid, accessPolicy, optionsopt) → {Promise.<DataPackageMember>}

Set one member's desired access policy.
Parameters:
Name Type Attributes Description
pid string Member PID
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated member
Type
Promise.<DataPackageMember>

setMemberLocation(pid, path) → {DataPackageMember}

Replace the ResourceMap location for a package member.
Parameters:
Name Type Description
pid string Member PID
path string Raw location path
Source:
Returns:
Updated member
Type
DataPackageMember

setPackageAccessPolicy(accessPolicy, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage a package access policy change.
Parameters:
Name Type Attributes Description
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
propagate boolean <optional>
Whether to target every active package member. Otherwise target the root ResourceMap and primary metadata only
maxConcurrent number <optional>
Fetch concurrency
onProgress function <optional>
SysMeta fetch progress callback
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated members
Type
Promise.<Array.<DataPackageMember>>

stageLocalFiles(files, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage local files in the in-memory member collection and assign their PIDs. Staged members can be rendered by the editor, but are not yet aggregated by the ResourceMap, recorded as `members:add`, or uploaded.
Parameters:
Name Type Attributes Description
files Array.<File> | Array.<Blob> Files to add
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPids Array.<string> <optional>
Optional custom PIDs by index
Source:
Returns:
In-memory members awaiting ResourceMap linking
Type
Promise.<Array.<DataPackageMember>>

triggerComplete(model)

Trigger the complete event if all models have been fetched
Parameters:
Name Type Description
model Backbone.Model The model that was fetched
Source:

unlinkDocumentation(metadataPid, dataPid) → {DataPackage}

Remove a documentation link between two package members.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

updateLoadingCount(num)

Sets the numLoadingFileMetadata attribute on the package model
Parameters:
Name Type Description
num number The number of models that are currently being fetched
Since:
  • 2.32.1
Source:

updateMemberModelType(memberModel, maxRetries, timeout) → {DataONEObject}

After a member model is fetched, determine whether it needs to: 1) be merged into the collection (the type did NOT change) 2) replace the old model (the type changed to DataPackage) 3) be fetched again, waited for, and then replaced in the collection (the type from the server is different from the type in the collection) Then resolve the promise when the model is fully handled.
Parameters:
Name Type Description
memberModel DataONEObject The model to potentially replace
maxRetries number The maximum number of retries for each fetch request
timeout number The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout
Since:
  • 2.32.1
Source:
Returns:
The updated model
Type
DataONEObject

updateRelationships()

Update the relationships in this resource map when its been udpated
Source:

url(optionsopt) → {string}

Build the DataPackage URL based on the MetacatUI.appModel.objectServiceUrl and id or seriesid
Parameters:
Name Type Attributes Description
options object <optional>
Optional options for this URL
Properties
Name Type Attributes Description
update boolean <optional>
If true, this URL will be for updating the package
Source:
Returns:
The URL for this DataPackage
Type
string

DataPackage(optionsopt)

new DataPackage(optionsopt)

Create a data package.
Parameters:
Name Type Attributes Description
options object <optional>
Initial package state and service overrides
Properties
Name Type Attributes Description
objectFormats ObjectFormats <optional>
Loaded object format collection used to classify members
members DataPackageMember | object | Array.<(DataPackageMember|object)> <optional>
Members used to seed the package
sources Array.<string> <optional>
Source tags applied to the initial members
primaryMetadataPid string <optional>
PID of the package's primary metadata member
rootResourceMapPid string <optional>
PID of the package's root ResourceMap
identifierService IdentifierService <optional>
Identifier allocation service
identifierServiceOptions object <optional>
Options used to create the identifier service when one is not provided
objectService ObjectService <optional>
Object read and write service
objectServiceOptions object <optional>
Options used to create the object service when one is not provided
packageService PackageService <optional>
Package download service
packageServiceOptions object <optional>
Options used to create the package service when one is not provided
sysMetaService SysMetaService <optional>
System metadata service
sysMetaServiceOptions object <optional>
Options used to create the system metadata service when one is not provided
versionTracker VersionTracker <optional>
Version tracker used for stale source checks
versionTrackerOptions object <optional>
Options used to create the version tracker when one is not provided
resolverOptions object <optional>
Options used to create the ResourceMap resolver during package loading
authorizationService AuthorizationService <optional>
Service used for write permission checks
authorizationServiceOptions object <optional>
Options used to create the authorization service when one is not provided
uploadRecoveryStore UploadRecoveryStore <optional>
Durable upload recovery record store
uploadDefaults object <optional>
Default System Metadata values for newly uploaded objects
fetchMaxConcurrent number <optional>
Default maximum concurrent read requests
uploadMaxConcurrent number <optional>
Default maximum concurrent upload requests
Source:

Members

comparator :string

Used to keep the collection sorted by model "sortOrder". The three model types are ordered as: Metadata: 1; Data: 2; DataPackage: 3. See getMember(). We do this so that Metadata get rendered first, and Data are rendered as DOM siblings of the Metadata rows of the DataPackage table.
Type:
  • string
Source:

dataPackageGraph :RDFGraph

The RDF graph representing this data package
Type:
Source:

derivations :Array.<DataONEObject>

Package members that are derivations in provenance relationships.
Type:
Source:

editable :boolean

A flag used for the package's edit status. Can be set to false to 'lock' the package
Type:
  • boolean
Source:

filterModel :Filter

A Filter model that should filter the Solr index for only the objects aggregated by this package.
Type:
Source:

id :string

The package identifier
Type:
  • string
Source:

namespaces :object

Namespaces used in the RDF XML. The key is the prefix and the value is the namespace URI.
Type:
  • object
Source:

nodeLevel :number

The nesting level in a data package hierarchy
Type:
  • number
Source:

numSaves :number

The number of models that have been updated during the current save(). This is reset to zero after the current save() is complete.
Type:
  • number
Source:

originalIsDocBy :object

The science data identifiers associated with this data package (from cito:documents), mapped to the science metadata identifier that documents it. Not to be changed after initial fetch - this is to keep track of the relationships in their original state
Type:
  • object
Source:

originalMembers :Array.<string>

An array of ids that are aggregated in the resource map on the server. Taken from the original RDF XML that was fetched from the server. Used for comparing the original aggregation with the aggregation of this collection.
Type:
  • Array.<string>
Source:

packageModel :DataONEObject

A DataONEObject representing the resource map itself
Type:
Source:

provEdits :Array.<Array.<string>>

Contains provenance relationships added or deleted to this DataONEObject. Each entry is [operation ('add' or 'delete'), prov field name, object id], i.e. ['add', 'prov_used', 'urn:uuid:5678']
Type:
  • Array.<Array.<string>>
Source:

provenanceFlag :string|null

Set to "complete" to signal that all prov queries have finished
Type:
  • string | null
Source:

solrResults :SolrResults

The SolrResults collection associated with this DataPackage. This can be used to fetch the package from Solr by passing the 'fromIndex' option to fetch().
Type:
Source:

sources :Array.<DataONEObject>

Package members that are sources in provenance relationships.
Type:
Source:

transferQueue :DataPackage|Metadata|Array.<Data>

The type of the object (DataPackage, Metadata, Data) Simple queue to enqueue file transfers. Use push() and shift() to add and remove items. If this gets to large/slow, possibly switch to http://code.stephenmorley.org/javascript/queues/
Type:
Source:

type :string

The name of this type of collection
Type:
  • string
Source:

Methods

addGeneratedByProgram(dataPid, programPid) → {DataPackage}

Record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addNewModel(model)

Adds a DataONEObject model to this DataPackage collection
Parameters:
Name Type Description
model DataONEObject The DataONEObject model to add
Source:

addProgramToGraph(programId) → {string}

Add a program identifier to the RDF graph and create an execution node
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

addToAggregation(id)

Adds a new object to the resource map RDF graph
Parameters:
Name Type Description
id string The identifier of the object to add
Source:

addToGraph(subject, predicate, object)

Add the specified relationship to the RDF graph only if it has not already been added.
Parameters:
Name Type Description
subject object The subject of the statement to add
predicate object The predicate of the statement to add
object object The object of the statement to add
Source:

addUsedByProgram(dataPid, programPid) → {DataPackage}

Record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

addViewServiceEntities(entities) → {void}

Merge entity summaries from a rendered metadata document into matching package members.
Parameters:
Name Type Description
entities Array.<object> Plain entity summaries from ViewServiceDoc
Source:
Returns:
Type
void

addWasDerivedFrom(…args) → {DataPackage}

Record that one data object was derived from another.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

allocatePid(optionsopt) → {Promise.<string>}

Reserve a new PID for a package member, or confirm a requested PID is available.
Parameters:
Name Type Attributes Description
options object <optional>
Allocation options
Properties
Name Type Attributes Description
requestedPid string <optional>
Custom PID to reserve
resourceMap boolean <optional>
Allocate a ResourceMap PID
Source:
Throws:
When allocation fails or the reserved PID does not match
Type
Error
Returns:
Allocated PID
Type
Promise.<string>

assertCanEdit(memberPidopt) → {true}

Reject a package edit while a full save is queued or active, or a member edit while that member is uploading eagerly.
Parameters:
Name Type Attributes Description
memberPid string <optional>
Member being edited
Source:
Throws:
With `code === "upload_in_progress"` while locked
Type
Error
Returns:
True when editing is allowed
Type
true

assertNotNestedResourceMap(member, rootResourceMapopt) → {DataPackageMember}

Reject direct edits to ResourceMaps aggregated by the root package.
Parameters:
Name Type Attributes Description
member DataPackageMember Package member
rootResourceMap DataPackageMember <optional>
Root ResourceMap member
Source:
Throws:
When the member is a nested resource map
Type
Error
Returns:
The accepted member
Type
DataPackageMember

assignNewMemberPid(member, optionsopt) → {Promise.<string>}

Assign a PID to a new member when it does not already have one.
Parameters:
Name Type Attributes Description
member DataPackageMember Member to assign
options object <optional>
Allocation options
Source:
Returns:
Desired PID
Type
Promise.<string>

assignReplacementPid(member, optionsopt) → {Promise.<string>}

Assign one stable replacement PID to an existing member.
Parameters:
Name Type Attributes Description
member DataPackageMember Member being replaced
options object <optional>
Allocation options
Source:
Returns:
Desired replacement PID
Type
Promise.<string>

broadcastAccessPolicy(accessPolicy)

Broadcast an accessPolicy across members of this package Note: Currently just sets the incoming accessPolicy on this object and doesn't broadcast to other members (such as data). How this works is likely to change in the future. Closely tied to the AccessPolicyView.broadcast property.
Parameters:
Name Type Description
accessPolicy AccessPolicy The accessPolicy to broadcast
Source:

checkResourceMapWritePermission(optionsopt) → {Promise.<boolean>}

Check whether the user can write to the root resource map specifically. Provenance editing depends on resource map writability rather than metadata write permission, so this is intentionally separate from DataPackage#checkWritePermissions, which requires write access to every member.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether the root resource map is writable Returns false when no resource map has been resolved
Type
Promise.<boolean>

checkWritePermissions(optionsopt) → {Promise.<boolean>}

Check if the user has write permission on the resource map and metadata if they both exist, or just the one that exists if only one exists. If neither exists, then return false.
Parameters:
Name Type Attributes Default Description
options object | boolean <optional>
false Options or refresh boolean
Source:
Returns:
Whether every checked member is writable
Type
Promise.<boolean>

cloneNode(nodeToClone) → {Node}

Clone an rdflib.js Node by creaing a new node based on the original node RDF term type and data type.
Parameters:
Name Type Description
nodeToClone Node The node to clone
Source:
Returns:
- The cloned node
Type
Node

discardFileReplacement(pid) → {DataPackageMember}

Restore the remote file after a failed replacement, retaining independent sharing and ownership edits.
Parameters:
Name Type Description
pid string Replacement PID currently assigned to the member
Source:
Throws:
When the original member state cannot be restored
Type
Error
Returns:
Restored member
Type
DataPackageMember

ensureMetadataUploadPid(member) → {Promise.<string>}

Ensure changed metadata has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember Metadata member
Source:
Throws:
When changed metadata has no replacement PID
Type
Error
Returns:
Desired PID
Type
Promise.<string>

ensureResourceMapUploadPid(member) → {Promise.<string>}

Ensure the ResourceMap has its final desired upload PID.
Parameters:
Name Type Description
member DataPackageMember ResourceMap member
Source:
Returns:
Desired PID
Type
Promise.<string>

fetch(sourceOptionsopt) → {Promise}

Fetch the resource map RDF XML for this package
Parameters:
Name Type Attributes Description
sourceOptions object <optional>
Optional options for this fetch that get sent with the XHR request
Properties:
Name Type Description
fetchModels boolean If false, this fetch will not fetch each model in the collection. It will only get the resource map object.
fromIndex boolean If true, the collection will be fetched from Solr rather than fetching the system metadata of each model. Useful when you only need to retrieve limited information about each package member. Set query-specific parameters on the `solrResults` SolrResults set on this collection.
Source:
Returns:
A promise that resolves when the fetch is complete
Type
Promise

fetchFromIndex()

Fetches this DataPackage from the Solr index by using a SolrResults collection and merging the models in.
Source:

fetchMemberModels(models, batchSizeopt, timeoutopt, maxRetriesopt) → {Promise}

Fetches member models in batches to avoid fetching all members simultaneously.
Parameters:
Name Type Attributes Description
models Array.<Backbone.Model> The array of member models to fetch.
batchSize number <optional>
The number of models to fetch in each batch.
timeout number <optional>
The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout.
maxRetries number <optional>
The maximum number of retries for each fetch request.
Since:
  • 2.32.0
Source:
Returns:
A promise that resolves when all models have been fetched.
Type
Promise

fetchPromise(model) → {object}

Fetch a model using Backbone's fetch method but return a promise that resolves when the fetch is complete, along with the XHR object
Parameters:
Name Type Description
model DataONEObject The model to fetch
Since:
  • 2.32.1
Source:
Returns:
An object with a promise and an XHR reference
Type
object

fetchSysMeta(memberPids, optionsopt) → {Promise.<Array.<{pid: string, error: Error}>>}

Fetch missing system metadata for selected package members.
Parameters:
Name Type Attributes Description
memberPids Array.<string> | null PIDs to fetch, or null for all members
options object <optional>
Fetch options
Properties
Name Type Attributes Description
maxConcurrent number <optional>
Fetch concurrency
Source:
Returns:
Fetch failures
Type
Promise.<Array.<{pid: string, error: Error}>>

fetchSysMetaForPlaceholders() → {Promise}

Fetches the system metadata for all member models that are marked as placeholder documents (i.e., isPlaceHolder_b === true). This property is retrieved from Solr and indicates that the file ID is referenced in a resource map, but has either not yet been indexed or is missing from the repository.
Since:
  • 2.36.2
Source:
Returns:
A promise that resolves when all placeholder member models have been fetched.
Type
Promise

fetchWithRetryAndTimeout(memberModel, maxRetries, timeout, attemptopt) → {DataONEObject}

Fetch a model with a timeout and a maximum number of retries. Fetch a model with a timeout, aborting the fetch if it takes too long.
Parameters:
Name Type Attributes Description
memberModel DataONEObject The model to fetch
maxRetries number The maximum number of retries
timeout number The timeout in milliseconds. If set to anything other than a positive number greater than 0, the fetch will not have a timeout (i.e., will wait indefinitely)
attempt number <optional>
The current attempt number
Since:
  • 2.32.1
Source:
Returns:
The fetched model
Type
DataONEObject

getAbsolutePath(relativePath) → {string}

Get the absolute path from a relative path, handling '~', '..', and '.'.
Parameters:
Name Type Description
relativePath string The relative path to be converted to an absolute path.
Since:
  • 2.28.0
Source:
Returns:
The absolute path after processing '~', '..', and '.'. If the result is empty, returns '/'.
Type
string

getAtLocation() → {object}

Returns atLocation information found in this resourceMap for all the PIDs in this resourceMap
Since:
  • 2.28.0
Source:
Returns:
- object with PIDs as key and atLocation paths as values
Type
object

getChangedMembers() → {Array.<DataPackageMember>}

Return active members that require an object write or system metadata update. Removed members are deaggregated by the ResourceMap, not uploaded, so they are excluded.
Source:
Returns:
Changed members
Type
Array.<DataPackageMember>

getCnURI() → {string}

Parses out the CN Resolve URL from the existing statements in the RDF or if not found in the RDF, from the app configuration.
Source:
Returns:
- The CN resolve URL
Type
string

getContentMembers() → {Array.<DataPackageMember>}

Return active members excluding the root ResourceMap. Includes metadata, nested ResourceMaps, and staged files not yet linked to the graph.
Source:
Returns:
Active package content
Type
Array.<DataPackageMember>

getExecutionId(programId) → {string}

Get the execution identifier that is associated with a program id. This will either be in the 'prov_wasExecutedByExecution' of the package member for the program script, or available by tracing backward in the RDF graph from the program node, through the assocation to the related execution.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
The execution identifier
Type
string

getExecutionNode(executionId) → {object}

Get the RDF node for an execution that is associated with the execution identifier. The execution may have been created in the resource map as a 'bare' urn:uuid (no resolveURI), or as a resolve URL, so check for both until the id is found.
Parameters:
Name Type Description
executionId string The execution identifier
Source:
Returns:
The RDF node for the execution
Type
object

getLatestVersionPid(optionsopt) → {Promise.<(string|null)>}

Find the latest PID for the package's primary object.
Parameters:
Name Type Attributes Description
options object <optional>
Lookup options
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Abort signal
requireComplete boolean <optional>
Require proof that each version walk reached the end of its chain
Source:
Throws:
When the version lookup fails
Type
Error
Returns:
Latest primary PID, or null
Type
Promise.<(string|null)>

getMember(context) → {Backbone.Model}

When a data package member updates, we evaluate it for its formatid, and update it appropriately if it is not a data object only
Parameters:
Name Type Description
context Backbone.Model The model that was updated
Source:
Returns:
The updated model
Type
Backbone.Model

getMissingFileModels() → {Array.<Backbone.Model>}

Returns an array of member models that are missing files
Since:
  • 2.36.2
Source:
Returns:
An array of member models that are missing files
Type
Array.<Backbone.Model>

getNestedResourceMapMembers() → {Array.<DataPackageMember>}

Return ResourceMap members aggregated by the root ResourceMap.
Source:
Returns:
Nested ResourceMap members
Type
Array.<DataPackageMember>

getPrimaryMetadataMember() → {DataPackageMember|null}

Return the primary metadata member for the package.
Source:
Returns:
Primary metadata member, or null when the package aggregates no metadata
Type
DataPackageMember | null

getQueue() → {Array}

Gets objects not yet uploaded to the DataONE server
Source:
Returns:
An array of models that are in the queue or in progress of uploading
Type
Array

getResourceMapModel(resourceMapPidopt) → {ResourceMap|null}

Return the parsed ResourceMap model for a resource map member, when that member's object has been fetched and parsed.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID. Defaults to the root resource map
Source:
Returns:
Parsed ResourceMap model, or null
Type
ResourceMap | null

getRootResourceMapMember() → {DataPackageMember|null}

Return the resource map member for the package. Returns only the root resource map in case there are nested resource maps.
Source:
Returns:
Root resource map member, or null when the package does not aggregate any resource maps
Type
DataPackageMember | null

getTotalSize() → {number}

Sum the known sizes of the package's data members.
Source:
Returns:
Known total bytes
Type
number

getURIFromRDF(id) → {string}

Finds the given identifier in the RDF graph and returns the subject URI of that statement. This is useful when adding additional statements to the RDF graph for an object that already exists in that graph.
Parameters:
Name Type Description
id string The identifier to search for
Source:
Returns:
- The full URI for the given id as it exists in the RDF.
Type
string

getValue(result, name) → {string}

The return values have to be extracted from the result.
Parameters:
Name Type Description
result object The result of the SPARQL query
name string The name of the field to extract
Source:
Returns:
- The value of the result
Type
string

handleAdd(dataONEObject)

Actions ot perform when a DataONEObject model is added to this collection
Parameters:
Name Type Description
dataONEObject DataONEObject The DataONEObject model that was added
Source:

handleMemberFetchError(failedModels, errors)

Handle errors that occur when fetching member models
Parameters:
Name Type Description
failedModels Array.<DataONEObject> The models that were being fetched
errors Array.<Error> The errors that occurred
Since:
  • 2.32.1
Source:

hasMetadataContentEdits() → {boolean}

Return whether EML/metadata content has been edited since the last save. Legacy EML editor views/models flag these edits via EMLUtilities.markRootDataPackageChanged().
Source:
Returns:
Whether metadata content has unsaved edits
Type
boolean

hasUnsavedChanges() → {boolean}

Return whether the package has edits newer than its last successful save.
Source:
Returns:
Whether the package has unsaved changes
Type
boolean

initialize()

Source:

initializeLoadedMembersForEditing() → {DataPackage}

Initialize existing package members for editing after a read-only load. Members without editable state are marked as already stored and aggregated under their current PIDs. Existing editable state is preserved.
Source:
Returns:
This package
Type
DataPackage

isEditLocked() → {boolean}

Return whether a full package save is queued, preparing, or executing. Background eager uploads do not lock editing.
Source:
Returns:
Whether package edits are locked
Type
boolean

linkDocumentation(metadataPid, dataPid) → {DataPackage}

Link a metadata member to the data member it documents.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

linkStagedFiles(addedMembers, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Add staged members to the editable package by aggregating them in the ResourceMap. This records the package edit and starts eager object uploads. Membership becomes durable when the ResourceMap is saved.
Parameters:
Name Type Attributes Description
addedMembers Array.<DataPackageMember> Staged members to link
options object <optional>
Edit options
Properties
Name Type Attributes Description
metadataPid string <optional>
Metadata member documenting files
atLocation string <optional>
Folder path to store in the ResourceMap `prov:atLocation` value
inheritAccessPolicy boolean <optional>
Whether new members inherit the documenting metadata member's access policy
Source:
Throws:
When the requested links cannot be applied atomically
Type
Error
Returns:
Locally added package members
Type
Promise.<Array.<DataPackageMember>>

markMemberContentDirty(pid) → {Promise.<DataPackageMember>}

Mark a member's object content dirty, assigning a replacement PID when needed.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When PID reassignment cannot be applied atomically
Type
Error
Returns:
Changed member
Type
Promise.<DataPackageMember>

mergeModels(otherModels, fieldsToMergeopt)

Merge the attributes of other models into the corresponding models in this collection. This should be used when merging models of other types (e.g. SolrResult) that represent the same object that the DataONEObject models in the collection represent.
Parameters:
Name Type Attributes Description
otherModels Array.<Backbone.Model> the other models to merge with the models in this collection
fieldsToMerge Array.<string> <optional>
If specified, only these fields will be extracted from the otherModels
Source:

missingFilesDetected() → {boolean}

Checks whether any member models are missing files
Since:
  • 2.36.2
Source:
Returns:
True if any member models are missing files
Type
boolean

model(attrs, options) → {DataONEObject|ScienceMetadata|EML211|DataPackage}

The DataPackage collection stores DataPackages and DataONEObjects, including Metadata and Data objects. Return the correct model based on the type
Parameters:
Name Type Description
attrs object The attributes of the model
options object Options to pass to the instantiated model
Source:
Returns:
The model
Type
DataONEObject | ScienceMetadata | EML211 | DataPackage

mutateProvenance(method, args) → {DataPackage}

Run a provenance mutation and record the package edit.
Parameters:
Name Type Description
method string Provenance method name
args Array.<*> Arguments passed to the provenance method
Source:
Throws:
When the package cannot be edited or the method is invalid
Type
Error
Returns:
This package
Type
DataPackage

needsUpdate() → {boolean}

Checks if this resource map has had any changes that requires an update
Source:
Returns:
- True if the resource map needs to be updated
Type
boolean

onDone()

This callback is called when all queries have finished.
Source:

onResult(result)

This callback is called for every query solution of the SPARQL queries. One query may result in multple queries solutions and calls to this function. Each query result returns two pids, i.e. pid: 1234 prov_generated: 5678, which corresponds to the RDF triple '5678 wasGeneratedBy 1234', or the DataONE solr document for pid '1234', with the field prov_generated: 5678.
Parameters:
Name Type Description
result object The result of the SPARQL query
Source:
Example
// The result can look like this:
 [?pid: t, ?prov_wasDerivedFrom: t, ?primary_data: t, ?derived_data: t]
 ?derived_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Adbbb9a2e-af64-452a-b7b9-122861a5dbb2"}
 ?pid : t {termType: "Literal", value: "urn:uuid:dbbb9a2e-af64-452a-b7b9-122861a5dbb2", datatype: t}
 ?primary_data : t {termType: "NamedNode", value: "https://cn-stage.test.dataone.org/cn/v2/resolve/urn%3Auuid%3Aaae9d025-a331-4c3a-b399-a8ca0a2826ef"}
 ?prov_wasDerivedFrom : t {termType: "Literal", value: "urn:uuid:aae9d025-a331-4c3a-b399-a8ca0a2826ef", datatype: t}]

parse(response, _options) → {Array.<DataPackage>}

Deserialize a Package from OAI-ORE RDF XML
Parameters:
Name Type Description
response string The RDF/XML string to parse
_options object Options for parsing the RDF/XML
Source:
Returns:
- An array of models that were parsed from the RDF/XML
Type
Array.<DataPackage>

parseProv()

Parse the provenance relationships from the RDF graph, after all DataPackage members have been fetched, as the prov info will be stored in them.
Source:

parseSysMeta(sysMeta) → {object}

Use the DataONEObject parseSysMeta() function
Parameters:
Name Type Description
sysMeta object The system metadata object to parse
Source:
Returns:
The parsed system metadata object
Type
object

provEditsPending() → {boolean}

Check if there are any provenance edits pending
Source:
Returns:
Returns true if the prov edits list is not empty, otherwise false.
Type
boolean

publish() → {Promise.<{pid: string, resourceMapPending: boolean}>}

Publish the package and verify ambiguous publication responses.
Source:
Throws:
When publication fails or cannot be verified
Type
Error
Returns:
Publication result
Type
Promise.<{pid: string, resourceMapPending: boolean}>

recordProvEdit(operation, subject, predicate, object)

Accumulate edits that are made to the provenance relationships via the ProvChartView. these edits are accumulated here so that they are available to any package member or view.
Parameters:
Name Type Description
operation string The operation performed on the relationship (add or delete)
subject string The subject of the relationship
predicate string The predicate of the relationship
object string The object of the relationship
Source:

recordUserEdit(event, details) → {DataPackage}

Advance the draft revision and publish a package edit event.
Parameters:
Name Type Description
event string Edit event name
details object Event details
Source:
Throws:
When the package is locked for editing
Type
Error
Returns:
This package
Type
DataPackage

refreshMemberGraphFields(resourceMapopt) → {DataPackage}

Copy relationships and locations from the ResourceMap graph to each active package member. Call this after changing the ResourceMap to keep those member fields in sync.
Parameters:
Name Type Attributes Description
resourceMap ResourceMap <optional>
ResourceMap to read; defaults to the package's root ResourceMap
Source:
Returns:
This package
Type
DataPackage

removeFromAggregation(id)

Removes an object from the aggregation in the RDF graph
Parameters:
Name Type Description
id string The identifier of the object to remove
Source:

removeGeneratedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program produced a data object.
Parameters:
Name Type Description
dataPid string Generated data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeIfLastProvRef(subjectNode, predicateNode, objectNode)

Remove the statement fromn the RDF graph only if the subject of this relationship is not referenced by any other provenance relationship, i.e. for example, the prov relationship "id rdf:type provone:data" is only needed if the subject ('id') is referenced in another relationship. Also don't remove it if the subject is in any other prov statement, meaning it still references another prov object.
Parameters:
Name Type Description
subjectNode object The subject of the statement to remove
predicateNode object The predicate of the statement to remove
objectNode object The object of the statement to remove
Source:

removeMembers(pids) → {Array.<DataPackageMember>}

Mark members removed from the desired package.
Parameters:
Name Type Description
pids string | Array.<string> Member PIDs
Source:
Throws:
When removal would invalidate the package or graph
Type
Error
Returns:
Removed members
Type
Array.<DataPackageMember>

removeOrphanedBlankNodes()

Remove orphaned blank nodes from the model's current graph This was put in to support replacing package members who are referenced by provenance statements, specifically members typed as Programs. rdflib.js will throw an error when serializing if any statements in the graph have objects that are blank nodes when no other statements in the graph have subjects for the same blank node. i.e., blank nodes references that aren't defined. Should be called during a call to serialize() and mutates this.dataPackageGraph directly as a side-effect.
Source:

removeProgramFromGraph(programId) → {boolean}

Remove a program identifier from the RDF graph and remove associated linkage between the program id and the exection, if the execution is not being used by any other statements.
Parameters:
Name Type Description
programId string The program identifier
Source:
Returns:
Returns true if the program was removed, otherwise false.
Type
boolean

removeUsedByProgram(dataPid, programPid) → {DataPackage}

Remove the record that a program used a data object.
Parameters:
Name Type Description
dataPid string Used data PID
programPid string Program PID
Source:
Returns:
This package
Type
DataPackage

removeWasDerivedFrom(…args) → {DataPackage}

Remove a derivation relationship between two data objects.
Parameters:
Name Type Attributes Description
args string <repeatable>
Derived PID followed by source PID
Source:
Returns:
This package
Type
DataPackage

renameMemberFile(pid, fileName) → {Promise.<DataPackageMember>}

Rename a member's display file name and matching ResourceMap locations.
Parameters:
Name Type Description
pid string Member PID
fileName string New file name
Source:
Throws:
When the requested file name is empty
Type
Error
Returns:
Updated member
Type
Promise.<DataPackageMember>

replaceFile(pid, file, optionsopt) → {Promise.<DataPackageMember>}

Replace a member's content and desired PID as one transaction.
Parameters:
Name Type Attributes Description
pid string Current member PID
file Blob | File Replacement content
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPid string <optional>
Optional custom replacement PID
replacementSourcePid string <optional>
Remote PID to obsolete
Source:
Throws:
When the replacement is invalid or cannot be applied atomically
Type
Error
Returns:
Replaced member
Type
Promise.<DataPackageMember>

requireMember(pid) → {DataPackageMember}

Return a package member or throw when it is missing.
Parameters:
Name Type Description
pid string Member PID
Source:
Throws:
When no package member has the PID
Type
Error
Returns:
Matching member
Type
DataPackageMember

requireResourceMapModel(resourceMapPidopt) → {ResourceMap}

Return a loaded resource map model or throw when it is unavailable.
Parameters:
Name Type Attributes Description
resourceMapPid string <optional>
Resource map PID
Source:
Throws:
When the resource map is not loaded
Type
Error
Returns:
Loaded resource map
Type
ResourceMap

save(optionsopt)

Overwrite the Backbone.Collection.sync() function to set custom options
Parameters:
Name Type Attributes Description
options object <optional>
Options for this DataPackage save
Properties
Name Type Attributes Description
sysMetaOnly boolean <optional>
If true, only the system metadata of this Package will be saved.
resourceMapOnly boolean <optional>
If true, only the Resource Map/Package object will be saved. Metadata and Data objects aggregated by the package will be skipped.
Source:

saveProv()

If provenance relationships have been modified by the provenance editor (in ProvChartView), then update the ORE Resource Map and save it to the server.
Source:

saveReference(model)

Save a reference to this collection in the model
Parameters:
Name Type Description
model DataONEObject The model to save a reference to
Source:

serialize() → {string}

Serialize the DataPackage to OAI-ORE RDF XML
Source:
Returns:
The serialized RDF/XML
Type
string
Replace the package's documentation links.
Parameters:
Name Type Description
links Array.<ResMapDocLink> Desired documentation links
Source:
Throws:
When the package cannot be edited
Type
Error
Returns:
This package
Type
DataPackage

setLoadingFiles(dataONEObjectopt)

Tracks the upload status of DataONEObject models in this collection. If they are `loading` into the DOM or `in progress` of an upload to the server, they will be considered as "loading" files.
Parameters:
Name Type Attributes Description
dataONEObject DataONEObject <optional>
A model to begin tracking. Optional. If no DataONEObject is given, then only the number of loading files will be calcualted and set on the packageModel.
Since:
  • 2.17.1
Source:

setMemberAccessPolicy(pid, accessPolicy, optionsopt) → {Promise.<DataPackageMember>}

Set one member's desired access policy.
Parameters:
Name Type Attributes Description
pid string Member PID
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated member
Type
Promise.<DataPackageMember>

setMemberLocation(pid, path) → {DataPackageMember}

Replace the ResourceMap location for a package member.
Parameters:
Name Type Description
pid string Member PID
path string Raw location path
Source:
Returns:
Updated member
Type
DataPackageMember

setPackageAccessPolicy(accessPolicy, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage a package access policy change.
Parameters:
Name Type Attributes Description
accessPolicy AccessPolicy | Array.<object> | object | null Desired policy
options object <optional>
Options
Properties
Name Type Attributes Description
propagate boolean <optional>
Whether to target every active package member. Otherwise target the root ResourceMap and primary metadata only
maxConcurrent number <optional>
Fetch concurrency
onProgress function <optional>
SysMeta fetch progress callback
rightsHolder string <optional>
Desired rights holder
Source:
Returns:
Updated members
Type
Promise.<Array.<DataPackageMember>>

stageLocalFiles(files, optionsopt) → {Promise.<Array.<DataPackageMember>>}

Stage local files in the in-memory member collection and assign their PIDs. Staged members can be rendered by the editor, but are not yet aggregated by the ResourceMap, recorded as `members:add`, or uploaded.
Parameters:
Name Type Attributes Description
files Array.<File> | Array.<Blob> Files to add
options object <optional>
Edit options
Properties
Name Type Attributes Description
requestedPids Array.<string> <optional>
Optional custom PIDs by index
Source:
Returns:
In-memory members awaiting ResourceMap linking
Type
Promise.<Array.<DataPackageMember>>

triggerComplete(model)

Trigger the complete event if all models have been fetched
Parameters:
Name Type Description
model Backbone.Model The model that was fetched
Source:

unlinkDocumentation(metadataPid, dataPid) → {DataPackage}

Remove a documentation link between two package members.
Parameters:
Name Type Description
metadataPid string Documenting metadata PID
dataPid string Documented data PID
Source:
Throws:
When the package cannot be edited or either member is missing
Type
Error
Returns:
This package
Type
DataPackage

updateLoadingCount(num)

Sets the numLoadingFileMetadata attribute on the package model
Parameters:
Name Type Description
num number The number of models that are currently being fetched
Since:
  • 2.32.1
Source:

updateMemberModelType(memberModel, maxRetries, timeout) → {DataONEObject}

After a member model is fetched, determine whether it needs to: 1) be merged into the collection (the type did NOT change) 2) replace the old model (the type changed to DataPackage) 3) be fetched again, waited for, and then replaced in the collection (the type from the server is different from the type in the collection) Then resolve the promise when the model is fully handled.
Parameters:
Name Type Description
memberModel DataONEObject The model to potentially replace
maxRetries number The maximum number of retries for each fetch request
timeout number The timeout for each fetch request in milliseconds. If set to anything other than a positive number greater than 0, the fetch will never timeout
Since:
  • 2.32.1
Source:
Returns:
The updated model
Type
DataONEObject

updateRelationships()

Update the relationships in this resource map when its been udpated
Source:

url(optionsopt) → {string}

Build the DataPackage URL based on the MetacatUI.appModel.objectServiceUrl and id or seriesid
Parameters:
Name Type Attributes Description
options object <optional>
Optional options for this URL
Properties
Name Type Attributes Description
update boolean <optional>
If true, this URL will be for updating the package
Source:
Returns:
The URL for this DataPackage
Type
string