Re: JSON-LD (Was:Re: Vaccination Certificate Test Suite)

On 4/26/21 8:03 AM, Nikos Fotiou wrote:
> I will begin by apologizing for the dump questions, but I still haven't completely understood JSON-LD. I have two questions regarding

Nikos, no reason to apologize... these are all great questions *and* you found
a few bugs in the experimental Vaccination Vocabulary JSON-LD Context, which
is always of great benefit to the community -- so, thank you! :)

> 1) What is the purpose of lines 7-10, i.e.,
>         "description": "",
>         "identifier": "",
>         "name": "",
>         "image": ""
> and why these attributes are redefined inside VaccinationCertificate attribute (lines 18-21)?

Yes, that's strange that they're defined at the top and then re-defined. We'd
have to ask Tobias, who wrote the context, why he chose to do that. The
Vaccination Certificate Vocabulary uses "JSON-LD Scoped Contexts", which are
an advanced feature of JSON-LD. These are "type-scoped", which basically means
"these definitions ONLY apply when a particular type is used".

So, if you look at this line:

The definitions under VaccinationCertificate, such as "description" and
"image" ONLY apply if the type of the object is "VaccinationCertificate".

More on scoped contexts here:

> 2)  In various places there is the following line
> "@type": ""
> Firstly, I thought that the @type property would lead to something machine readable so that type checks are automated. Even if this is not the case, contains no information about this type. Is there any implicit agreement that this URL corresponds to a "date"? The closest I found by following links was that 
> But even this, it says: "dateTime uses the date/timeSevenPropertyModel, with no properties except timezoneOffset permitted to be absent." Hence **if** this is the correct type, all the examples are not correct since they do not include the time part, in the `birthDate` attribute which is of that type. 

You've found a bug in the JSON-LD Context... those values should be:

which is defined here:

JSON-LD is NOT a schema constraint language. It is not designed to do what
JSON Schema does. Instead, it is a semantics expression language that attempts
to be highly aligned with the way JSON developers use JSON out in the real world.

So, the thing that these lines do:

is basically state "If you see `dateOfVaccination`, the long form of that
identifier is ``, and you should
assume it is a date-time value as defined in XML Schema."

That statement is, of course, wrong. Instead, it should be "If you see
`dateOfVaccination`, the long form of that identifier is
``, and you should assume it is
a `date` value as defined in XML Schema."

The difference being XML Schema dateTime vs. date. All that said, perhaps
Tobias meant to define it as a dateTime (which means all of the tests are
wrong), or we really do want it to be a date (which means the JSON-LD Context
is wrong).

I'll wait for Tobias to chime in to provide his thought process before
suggesting changes.

-- manu

Manu Sporny -
Founder/CEO - Digital Bazaar, Inc.
blog: Veres One Decentralized Identifier Blockchain Launches

Received on Monday, 26 April 2021 14:00:41 UTC