cocoda-sdk 3.4.9 → 3.4.11
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/dist/cjs/index.cjs
CHANGED
|
@@ -1948,7 +1948,7 @@ var ConceptApiProvider = class extends BaseProvider {
|
|
|
1948
1948
|
this.has.auth = import_get.default(this._config, "auth.key") != null;
|
|
1949
1949
|
this._defaultParams = {
|
|
1950
1950
|
// Default parameters mostly for DANTE
|
|
1951
|
-
properties: "+created,issued,modified,editorialNote,scopeNote,note,definition,mappings"
|
|
1951
|
+
properties: "+created,issued,modified,editorialNote,scopeNote,note,definition,mappings,location"
|
|
1952
1952
|
};
|
|
1953
1953
|
}
|
|
1954
1954
|
/**
|
|
@@ -3625,6 +3625,87 @@ var broaderProps = [
|
|
|
3625
3625
|
"broaderTermInstantial",
|
|
3626
3626
|
"broaderTermPartitive"
|
|
3627
3627
|
];
|
|
3628
|
+
var mappingsProps = {
|
|
3629
|
+
sameAs: "http://www.w3.org/2004/02/skos/core#exactMatch",
|
|
3630
|
+
exactMatch: "http://www.w3.org/2004/02/skos/core#exactMatch",
|
|
3631
|
+
closeMatch: "http://www.w3.org/2004/02/skos/core#closeMatch",
|
|
3632
|
+
// See also: https://d-nb.info/standards/elementset/gnd#relatedDdcWithDegreeOfDeterminacy1
|
|
3633
|
+
relatedDdcWithDegreeOfDeterminacy1: "http://www.w3.org/2004/02/skos/core#narrowMatch",
|
|
3634
|
+
relatedDdcWithDegreeOfDeterminacy2: "http://www.w3.org/2004/02/skos/core#narrowMatch",
|
|
3635
|
+
relatedDdcWithDegreeOfDeterminacy3: "http://www.w3.org/2004/02/skos/core#closeMatch",
|
|
3636
|
+
relatedDdcWithDegreeOfDeterminacy4: "http://www.w3.org/2004/02/skos/core#exactMatch"
|
|
3637
|
+
};
|
|
3638
|
+
var mappingSchemes = [
|
|
3639
|
+
// DDC
|
|
3640
|
+
{
|
|
3641
|
+
uri: "http://bartoc.org/en/node/241",
|
|
3642
|
+
// Note: In code, we're rewriting DDC notations to include the version number "e23/" at the end.
|
|
3643
|
+
uriPattern: "http://dewey.info/class/(.+)/"
|
|
3644
|
+
},
|
|
3645
|
+
// RAMEAU
|
|
3646
|
+
{
|
|
3647
|
+
uri: "http://bartoc.org/en/node/18",
|
|
3648
|
+
namespace: "https://data.bnf.fr/ark:/12148/"
|
|
3649
|
+
},
|
|
3650
|
+
// EMBNE
|
|
3651
|
+
{
|
|
3652
|
+
uri: "http://bartoc.org/en/node/20450",
|
|
3653
|
+
namespace: "https://datos.bne.es/resource/"
|
|
3654
|
+
},
|
|
3655
|
+
// Wikidata
|
|
3656
|
+
{
|
|
3657
|
+
uri: "http://bartoc.org/en/node/1940",
|
|
3658
|
+
namespace: "http://www.wikidata.org/entity/"
|
|
3659
|
+
},
|
|
3660
|
+
// TheSoz
|
|
3661
|
+
{
|
|
3662
|
+
uri: "http://bartoc.org/en/node/294",
|
|
3663
|
+
namespace: "http://lod.gesis.org/thesoz/"
|
|
3664
|
+
},
|
|
3665
|
+
// T-PRO
|
|
3666
|
+
{
|
|
3667
|
+
uri: "http://bartoc.org/en/node/20425",
|
|
3668
|
+
namespace: "http://uri.gbv.de/terminology/tpro/"
|
|
3669
|
+
},
|
|
3670
|
+
// VIAF
|
|
3671
|
+
{
|
|
3672
|
+
uri: "http://bartoc.org/en/node/2053",
|
|
3673
|
+
namespace: "http://viaf.org/viaf/"
|
|
3674
|
+
},
|
|
3675
|
+
// Note: The following vocabularies use uriPattern to work around http/https URI confusion.
|
|
3676
|
+
// See also: https://github.com/gbv/cocoda-sdk/issues/66#issuecomment-2273422523
|
|
3677
|
+
// TODO: Adjust this after the issue has been fixed in source.
|
|
3678
|
+
// AGROVOC
|
|
3679
|
+
{
|
|
3680
|
+
uri: "http://bartoc.org/en/node/305",
|
|
3681
|
+
uriPattern: "http?://aims.fao.org/aos/agrovoc/(.+)"
|
|
3682
|
+
},
|
|
3683
|
+
// MeSH
|
|
3684
|
+
{
|
|
3685
|
+
uri: "http://bartoc.org/en/node/391",
|
|
3686
|
+
uriPattern: "http?://id.nlm.nih.gov/mesh/(.+)"
|
|
3687
|
+
},
|
|
3688
|
+
// STW
|
|
3689
|
+
{
|
|
3690
|
+
uri: "http://bartoc.org/en/node/313",
|
|
3691
|
+
uriPattern: "http?://zbw.eu/stw/descriptor/(.+)"
|
|
3692
|
+
},
|
|
3693
|
+
// BNCF
|
|
3694
|
+
{
|
|
3695
|
+
uri: "http://bartoc.org/en/node/443",
|
|
3696
|
+
uriPattern: "https?://purl.org/bncf/tid/(.+)"
|
|
3697
|
+
},
|
|
3698
|
+
// LCSH
|
|
3699
|
+
{
|
|
3700
|
+
uri: "http://bartoc.org/en/node/454",
|
|
3701
|
+
uriPattern: "http?://id.loc.gov/authorities/subjects/(.+)"
|
|
3702
|
+
},
|
|
3703
|
+
// LCNAF
|
|
3704
|
+
{
|
|
3705
|
+
uri: "http://bartoc.org/en/node/18536",
|
|
3706
|
+
uriPattern: "http?://id.loc.gov/authorities/names/(.+)"
|
|
3707
|
+
}
|
|
3708
|
+
].map((scheme) => new import_jskos_tools11.default.ConceptScheme(scheme));
|
|
3628
3709
|
function toJSKOS(data3) {
|
|
3629
3710
|
const concept = {
|
|
3630
3711
|
uri: data3.id,
|
|
@@ -3647,14 +3728,31 @@ function toJSKOS(data3) {
|
|
|
3647
3728
|
if (concept.uri) {
|
|
3648
3729
|
concept.identifier = [concept.uri.replace("https://", "http://")];
|
|
3649
3730
|
}
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3731
|
+
let mappings = [];
|
|
3732
|
+
for (const prop of Object.keys(mappingsProps)) {
|
|
3733
|
+
const type = mappingsProps[prop];
|
|
3734
|
+
if (data3[prop]?.length) {
|
|
3735
|
+
mappings = mappings.concat(data3[prop].map((target) => {
|
|
3736
|
+
const scheme = mappingSchemes.find((s) => s.notationFromUri(target.id));
|
|
3737
|
+
const targetConcept = scheme?.conceptFromUri(target.id);
|
|
3738
|
+
if (!scheme || !targetConcept) {
|
|
3739
|
+
return null;
|
|
3740
|
+
}
|
|
3741
|
+
if (scheme.uri === "http://bartoc.org/en/node/241") {
|
|
3742
|
+
targetConcept.uri += "e23/";
|
|
3743
|
+
}
|
|
3744
|
+
return {
|
|
3745
|
+
from: { memberSet: [{ uri: concept.uri, notation: concept.notation }] },
|
|
3746
|
+
fromScheme: { uri: gndJson.uri },
|
|
3747
|
+
to: { memberSet: [targetConcept] },
|
|
3748
|
+
toScheme: { uri: scheme.uri },
|
|
3749
|
+
type: [type]
|
|
3750
|
+
};
|
|
3751
|
+
}).filter(Boolean));
|
|
3752
|
+
}
|
|
3753
|
+
}
|
|
3754
|
+
if (mappings.length) {
|
|
3755
|
+
concept.mappings = mappings;
|
|
3658
3756
|
}
|
|
3659
3757
|
return concept;
|
|
3660
3758
|
}
|
|
@@ -4522,7 +4620,7 @@ var CocodaSDK = class _CocodaSDK {
|
|
|
4522
4620
|
*
|
|
4523
4621
|
* @param {Object} scheme JSKOS concept scheme object
|
|
4524
4622
|
* @param {string} [dataType="concepts"] only use providers that support a certain data type (default is "concepts" for backward compatibility)
|
|
4525
|
-
* @returns
|
|
4623
|
+
* @returns {Object|null} registry object, or `null` if determining the registry was not successful
|
|
4526
4624
|
*/
|
|
4527
4625
|
registryForScheme(scheme, dataType = "concepts") {
|
|
4528
4626
|
let registry = scheme._registry;
|