adlnet / xapi-profiles

A set of documents addressing the structure of and supporting services for xAPI Profiles.
https://adlnet.gov/projects/xapi/
Apache License 2.0
54 stars 27 forks source link

Fix @context for scopeNote. #240

Open FeLungs opened 7 years ago

FeLungs commented 7 years ago

I was playing around with the expanded and compacted forms of a profile I am developing (via https://json-ld.org/playground/) and noticed something strange about scopeNote

...
"rules":[{"location":"$.result.duration","presence":"recommended","scopeNote":{"en": "the Length of..."}]}

compacts to:
{
          "http://www.w3.org/2004/02/skos/core#scopeNote": {},
          "https://w3id.org/xapi/profiles/ontology#location": "$.result.duration",
          "https://w3id.org/xapi/profiles/ontology#presence": "recommended"
        }

and expands to:

{
            "https://w3id.org/xapi/profiles/ontology#location": [
              {
                "@value": "$.result.duration"
              }
            ],
            "https://w3id.org/xapi/profiles/ontology#presence": [
              {
                "@value": "recommended"
              }
            ],
            "http://www.w3.org/2004/02/skos/core#scopeNote": [
              {}
            ]
          }

Where as for prefLabel

...
"prefLabel":{"en":"some label"}
...

compacts to:
"http://www.w3.org/2004/02/skos/core#prefLabel": {
        "@language": "en",
        "@value": "some label"
      }

and expands to:

"http://www.w3.org/2004/02/skos/core#prefLabel": [
          {
            "@value": "some label",
            "@language": "en"
          }
        ],

I tried setting the value of scopeNote to a string and got:

"rules":[{"location":"$.result.duration","presence":"recommended","scopeNote": "the length of..."]}
{
            "https://w3id.org/xapi/profiles/ontology#location": [
              {
                "@value": "$.result.duration"
              }
            ],
            "https://w3id.org/xapi/profiles/ontology#presence": [
              {
                "@value": "recommended"
              }
            ],
            "http://www.w3.org/2004/02/skos/core#scopeNote": [
              {
                "@value": "the length of..."
              }
            ]
          }

When looking into this difference, I noticed that within the @context for the profile specification (https://adlnet.github.io/xapi-profiles/context/profile-context.jsonld) there are different alias definitions for prefLabel and scopeNote:

"prefLabel": {
            "@id": "skos:prefLabel",
            "@container": "@language"
        },

"scopeNote": {
            "@id": "skos:scopeNote"
        },

Yet in the spec, both prefLabel and scopeNote are defined as objects


prefLabel | Object | A Language Map of the preferred names in each language | Required

scopeNote | Object | A Language Map describing usage details for the parts of Statements addressed by this rule. For example, a Profile with a rule requiring result.duration might provide guidance on how to calculate it. | Optional

I believe the @context for scopeNote needs to be updated to

"scopeNote": {
            "@id": "skos:scopeNote"
            "@container": "@language"
        },

TL;DR

jhaag75 commented 6 years ago

@fugu13 this looks like a valid to me. Thoughts? I can submit a PR and update if you agree.

phtyson commented 3 years ago

Yes, this should be updated, it is a bug that prevents automated translation to other serializations.

jhaag75 commented 3 years ago

Yes, this should be updated, it is a bug that prevents automated translation to other serializations.

Please submit an update and PR if you want this fixed. ADL will review and controls this repo.

phtyson commented 3 years ago

Pull request https://github.com/adlnet/xapi-profiles/pull/253