gbv / jskos-tools

Tools for working with the JSKOS data format.
https://gbv.github.io/jskos-tools/
MIT License
2 stars 0 forks source link

Identifiers don't take empty target sets into account #4

Closed stefandesu closed 5 years ago

stefandesu commented 5 years ago

I noticed this in Cocoda and created an issue there, but I think this is actually an issue with the mapping identifiers. If the target member set is empty, the target concept scheme is not taken into account when creating a mapping identifier. That means that the following two mappings, from DDC 100 to RVK (empty) and from DDC 100 to BK (empty) have the same identifier, even though they are different mappings:

{
  "from": {
    "memberSet": [
      {
        "uri": "http://dewey.info/class/100/e23/",
        "notation": [
          "100"
        ]
      }
    ]
  },
  "to": {
    "memberSet": []
  },
  "fromScheme": {
    "uri": "http://dewey.info/scheme/edition/e23/",
    "notation": [
      "DDC"
    ]
  },
  "toScheme": {
    "uri": "http://uri.gbv.de/terminology/rvk/",
    "notation": [
      "rvk"
    ]
  },
  "creator": [
    {
      "prefLabel": {
        "de": "Stefan"
      }
    }
  ],
  "type": [
    "http://www.w3.org/2004/02/skos/core#mappingRelation"
  ],
  "identifier": [
    "urn:jskos:mapping:content:3b48a68ba7a8d1998bf8129dabbcf639cda0180a",
    "urn:jskos:mapping:members:0a1d3321f66566331675e1366934c60a208539e1"
  ]
}
{
  "from": {
    "memberSet": [
      {
        "uri": "http://dewey.info/class/100/e23/",
        "notation": [
          "100"
        ]
      }
    ]
  },
  "to": {
    "memberSet": []
  },
  "fromScheme": {
    "uri": "http://dewey.info/scheme/edition/e23/",
    "notation": [
      "DDC"
    ]
  },
  "toScheme": {
    "uri": "http://uri.gbv.de/terminology/bk/",
    "notation": [
      "bk"
    ]
  },
  "creator": [
    {
      "prefLabel": {
        "de": "Stefan"
      }
    }
  ],
  "type": [
    "http://www.w3.org/2004/02/skos/core#mappingRelation"
  ],
  "identifier": [
    "urn:jskos:mapping:content:3b48a68ba7a8d1998bf8129dabbcf639cda0180a",
    "urn:jskos:mapping:members:0a1d3321f66566331675e1366934c60a208539e1"
  ]
}

The solution would be to take the target scheme URI into account when creating the identifiers. In my opinion, this applies to both content and member identifiers.

In practice, this will change all mapping identifiers created thus far. I don't think this is a problem at this point because no one besides us is using these, but theoretically we could use different prefixes for these new identifiers to keep support for the old ones, for example urn:jskos:mapping:content_v2:.

stefandesu commented 5 years ago

A better solution would be to only take the scheme URI into account when a member set is empty. This would only change those identifiers which contain an empty member set. Also, we decided that we won't change the member identifier for now, only the content identifier.