W3C home > Mailing lists > Public > public-credentials@w3.org > April 2021

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

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Mon, 26 Apr 2021 10:00:24 -0400
To: public-credentials@w3.org
Message-ID: <da9ccbba-03bd-253e-9852-f0466ba31916@digitalbazaar.com>
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 https://w3c-ccg.github.io/vaccination-vocab/context/v1/index.json

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": "http://schema.org/description",
>         "identifier": "http://schema.org/identifier",
>         "name": "http://schema.org/name",
>         "image": "http://schema.org/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": "http://www.w3.org/2001/XMLSchema#dateTime"
> 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, http://www.w3.org/2001/XMLSchema#dateTime 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 
> https://www.w3.org/TR/xmlschema11-2/#dateTime
> 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 `https://w3id.org/vaccination#dateOfVaccination`, 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
`https://w3id.org/vaccination#dateOfVaccination`, 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 - https://www.linkedin.com/in/manusporny/
Founder/CEO - Digital Bazaar, Inc.
blog: Veres One Decentralized Identifier Blockchain Launches
Received on Monday, 26 April 2021 14:00:41 UTC

This archive was generated by hypermail 2.4.0 : Thursday, 24 March 2022 20:25:13 UTC