geonetwork-ui 2.10.0 → 2.11.0-dev.8442dae6e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/geonetwork-ui.mjs +149 -127
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/index.d.ts +6 -4
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +5 -5
- package/src/libs/api/metadata-converter/src/lib/fixtures/metawal.records.ts +5 -5
- package/src/libs/api/metadata-converter/src/lib/iso19115-3/write-parts.ts +2 -2
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +9 -5
- package/src/libs/api/metadata-converter/src/lib/iso19139/utils/association-type.mapper.ts +12 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +2 -2
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +18 -2
|
@@ -587,7 +587,7 @@ export function writeAssociatedRecords(
|
|
|
587
587
|
removeChildrenByName('mri:associatedResource'),
|
|
588
588
|
appendChildren(
|
|
589
589
|
...record.associatedRecords
|
|
590
|
-
.filter((assoc) => assoc.
|
|
590
|
+
.filter((assoc) => assoc.uniqueIdentifier && assoc.associationType)
|
|
591
591
|
.map((assoc) =>
|
|
592
592
|
pipe(
|
|
593
593
|
createNestedElement(
|
|
@@ -608,7 +608,7 @@ export function writeAssociatedRecords(
|
|
|
608
608
|
),
|
|
609
609
|
pipe(
|
|
610
610
|
createElement('mri:metadataReference'),
|
|
611
|
-
writeAttribute('uuidref', assoc.
|
|
611
|
+
writeAttribute('uuidref', assoc.uniqueIdentifier)
|
|
612
612
|
)
|
|
613
613
|
)
|
|
614
614
|
)
|
|
@@ -51,6 +51,7 @@ import {
|
|
|
51
51
|
readText,
|
|
52
52
|
XmlElement,
|
|
53
53
|
} from '../xml-utils'
|
|
54
|
+
import { getAssociationTypeFromCode } from './utils/association-type.mapper'
|
|
54
55
|
import { readGeometry } from './utils/geometry'
|
|
55
56
|
import { fullNameToParts } from './utils/individual-name'
|
|
56
57
|
import { getKeywordTypeFromKeywordTypeCode } from './utils/keyword.mapper'
|
|
@@ -931,19 +932,22 @@ export function readSourceRecords(rootEl: XmlElement): SourceRecord[] {
|
|
|
931
932
|
export function extractAssociatedRecords(
|
|
932
933
|
containerName: string,
|
|
933
934
|
aggregateName: string,
|
|
934
|
-
|
|
935
|
+
readIdentifier: ChainableFunction<XmlElement, string>
|
|
935
936
|
): ChainableFunction<XmlElement, AssociatedRecord[]> {
|
|
936
937
|
return pipe(
|
|
937
938
|
findChildrenElement(containerName, false),
|
|
938
939
|
mapArray((el) => {
|
|
939
940
|
const aggregateEl = findChildElement(aggregateName, false)(el)
|
|
940
|
-
const
|
|
941
|
-
const
|
|
941
|
+
const uniqueIdentifier = readIdentifier(aggregateEl)
|
|
942
|
+
const associationTypeCode = pipe(
|
|
942
943
|
findNestedElement('gmd:associationType', 'gmd:DS_AssociationTypeCode'),
|
|
943
944
|
readAttribute('codeListValue')
|
|
944
945
|
)(aggregateEl)
|
|
945
|
-
if (!
|
|
946
|
-
return {
|
|
946
|
+
if (!uniqueIdentifier || !associationTypeCode) return null
|
|
947
|
+
return {
|
|
948
|
+
uniqueIdentifier,
|
|
949
|
+
associationType: getAssociationTypeFromCode(associationTypeCode),
|
|
950
|
+
}
|
|
947
951
|
}),
|
|
948
952
|
filterArray((r): r is AssociatedRecord => r !== null)
|
|
949
953
|
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AssociationType,
|
|
3
|
+
associationTypeValues,
|
|
4
|
+
} from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
5
|
+
|
|
6
|
+
export function getAssociationTypeFromCode(
|
|
7
|
+
associationTypeCode: string
|
|
8
|
+
): AssociationType {
|
|
9
|
+
return associationTypeValues.includes(associationTypeCode as AssociationType)
|
|
10
|
+
? (associationTypeCode as AssociationType)
|
|
11
|
+
: 'crossReference'
|
|
12
|
+
}
|
|
@@ -1276,7 +1276,7 @@ export function writeAssociatedRecords(
|
|
|
1276
1276
|
removeChildrenByName('gmd:aggregationInfo'),
|
|
1277
1277
|
appendChildren(
|
|
1278
1278
|
...record.associatedRecords
|
|
1279
|
-
.filter((assoc) => assoc.
|
|
1279
|
+
.filter((assoc) => assoc.uniqueIdentifier && assoc.associationType)
|
|
1280
1280
|
.map((assoc) =>
|
|
1281
1281
|
pipe(
|
|
1282
1282
|
createNestedElement(
|
|
@@ -1290,7 +1290,7 @@ export function writeAssociatedRecords(
|
|
|
1290
1290
|
'gmd:MD_Identifier',
|
|
1291
1291
|
'gmd:code'
|
|
1292
1292
|
),
|
|
1293
|
-
writeCharacterString(assoc.
|
|
1293
|
+
writeCharacterString(assoc.uniqueIdentifier)
|
|
1294
1294
|
),
|
|
1295
1295
|
pipe(
|
|
1296
1296
|
createNestedElement(
|
|
@@ -260,12 +260,28 @@ export interface SourceRecord {
|
|
|
260
260
|
href?: string
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
// DS_AssociationTypeCode values of the ISO19115-3 codelist, any unrecognized value
|
|
264
|
+
// being mapped to 'crossReference'
|
|
265
|
+
export const associationTypeValues = [
|
|
266
|
+
'crossReference',
|
|
267
|
+
'largerWorkCitation',
|
|
268
|
+
'partOfSeamlessDatabase',
|
|
269
|
+
'stereoMate',
|
|
270
|
+
'isComposedOf',
|
|
271
|
+
'collectiveTitle',
|
|
272
|
+
'series',
|
|
273
|
+
'dependency',
|
|
274
|
+
'revisionOf',
|
|
275
|
+
] as const
|
|
276
|
+
|
|
277
|
+
export type AssociationType = (typeof associationTypeValues)[number]
|
|
278
|
+
|
|
263
279
|
/**
|
|
264
280
|
* Represents another record associated with this one (e.g. a parent/sibling dataset).
|
|
265
281
|
*/
|
|
266
282
|
export interface AssociatedRecord {
|
|
267
|
-
|
|
268
|
-
associationType:
|
|
283
|
+
uniqueIdentifier: string
|
|
284
|
+
associationType: AssociationType
|
|
269
285
|
}
|
|
270
286
|
|
|
271
287
|
export interface DatasetRecord extends BaseRecord {
|