Class: DataPackage

DataPackage()

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

Constructor

new DataPackage()

Source:

Extends

  • Backbone.Collection

Members

comparator :string

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:
  • RDFGraph
Source:

editable :boolean

A flag ued 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

Define the namespaces used in the RDF XML
Type:
  • object
Source:

nodeLevel :number

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

numSaves

The number of models that have been updated during the current save(). This is reset to zero after the current save() is complete.
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

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']
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:

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

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:

fetch(optionsopt)

Overload fetch calls for a DataPackage
Parameters:
Name Type Attributes Description
options 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:

fetchFromIndex()

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

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()

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

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

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

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:

needsUpdate()

Checks if this resource map has had any changes that requires an update
Source:

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:

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:

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:

updateRelationships()

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