Constructor
new EMLAnnotations()
- Since:
- Source:
Extends
Members
model
- Source:
Methods
addCanonicalDatasetAnnotation(sourceId) → {void}
Adds canonical dataset annotations to this collection. A canonical
dataset is the one that is considered the authoritative version; the
current EML doc being essentially a duplicate version.
Parameters:
Name |
Type |
Description |
sourceId |
string
|
The DOI or URL of the canonical dataset. |
- Since:
- Source:
Returns:
-
Type
-
void
findByProperty(propertyURI) → {Array.<EMLAnnotation>}
Find all annotations with the given propertyURI.
Parameters:
Name |
Type |
Description |
propertyURI |
string
|
The propertyURI to search for. |
- Since:
- Source:
Returns:
An array of EMLAnnotations with the given
propertyURI.
-
Type
-
Array.<EMLAnnotation>
findCanonicalDatasetAnnotation() → {object}
Find the annotations that make up the canonical dataset annotation. A
canonical dataset is identified by having both a "derivedFrom" and a
"sameAs" annotation with the same DOI or URL for the valueURI.
- Since:
- Source:
Returns:
An object with the derivedFrom and sameAs
annotations.
-
Type
-
object
getCanonicalURI() → {string}
Returns the URI of the canonical dataset.
- Since:
- Source:
Returns:
The URI of the canonical dataset.
-
Type
-
string
getDuplicates() → {Array.<EMLAnnotation>}
Find all annotations that have the same property & value URIs & labels.
Only returns the models that are duplicates, not the original. The original
is the first instance found in the collection.
- Since:
- Source:
Returns:
An array of EMLAnnotations that are duplicates.
-
Type
-
Array.<EMLAnnotation>
hasDuplicateOf(annotation) → {boolean}
Checks if this collection already has an annotation for the same
property URI.
Parameters:
Name |
Type |
Description |
annotation |
EMLAnnotation
|
The EMLAnnotation to compare against
the annotations already in this collection. |
- Source:
Returns:
Returns true is this collection already has an
annotation for this property.
-
Type
-
boolean
removeCanonicalDatasetAnnotation() → {Array.<EMLAnnotation>}
Removes the canonical dataset annotations from this collection.
- Since:
- Source:
Returns:
The canonical dataset annotations that were
removed.
-
Type
-
Array.<EMLAnnotation>
replaceDuplicateWith(annotation)
Removes the EMLAnnotation from this collection that has the same
propertyURI as the given annotation. Then adds the given annotation to
the collection. If no duplicate is found, the given annotation is still
added to the collection.
Parameters:
Name |
Type |
Description |
annotation |
EMLAnnotation
|
The EMLAnnotation to replace
duplicates with. |
- Source:
updateCanonicalDataset(newSourceId) → {object}
Updates the canonical dataset annotations to have the given ID. If
there is no canonical dataset annotation, one is added. If the ID is a
falsy value, the canonical dataset annotation is removed.
Parameters:
Name |
Type |
Description |
newSourceId |
string
|
The DOI or URL of the canonical dataset. |
- Since:
- Source:
Returns:
An object with the derivedFrom and sameAs annotations
if the canonical dataset annotations were updated.
-
Type
-
object
validate()
- Source: