uncefact / spec-untp

UN Transparency Protocol
https://uncefact.github.io/spec-untp/
GNU General Public License v3.0
16 stars 17 forks source link

DPP subject type #167

Closed nissimsan closed 1 month ago

nissimsan commented 2 months ago

Impacted sections

https://uncefact.github.io/spec-untp/assets/files/untp-digital-product-passport-v0.3.10-f2c1855610552ab75605e66f752f0dfa.json

Issue Description

https://github.com/uncefact/spec-untp/blob/main/website/samples/untp-digital-product-passport-v0.3.10.json#L40

I think this is a mistake. I'd say the subject of a DPP is a Product.

Being both an Entity and a Product, like, what does that even mean?

nissimsan commented 2 months ago

https://github.com/uncefact/spec-untp/blob/main/website/docs/specification/DigitalProductPassport.md?plain=1#L94

... Hmm, it seems like it's intentional. I still don't understand what it means.

onthebreeze commented 2 months ago

Thanks @nissimsan. It's an unintended consequence of the mapping from logical model to linked data. At a pure logical model level "entity" is an abstract type which is a superclass of product, facility and organisation. It has common things like name, identifier, scheme, etc. So in the logical model product is a type of entity. But, at a JSON-LD level it means the "type" of the product class is both "product" and "entity" which I agree looks confusing. On the other hand the same modelling technique leads to a DPP being a type of VC - and a livestock passport being a type of product passport. Which is an application of exactly the same rule but this time it's something we understand and like.

You see this same collision of semantic graphs and traditional data modelling in schema.org where country is a type of administrative region, which is itself a type of place. Which sounds reasonable when you say it like that. Except schema.org:place carries all the attributes of a Google pin like opening hours and drive through service Boolean. Which means country also has those properties. So schema.org un-intentionally thinks that countries have opening hours and drive through services

Anyhow, in UNTP I'm sure we can fix this product subtype of entity problem by changing the model. I suppose I'm just pointing out that it's going to be challenging to develop and maintain high quality specifications when we get contributions from data modellers that don't think about linked data impacts (this ticket) or linked data designers that don't think about structural data model impacts (schema.org example). The new world is going to need people with a foot in each camp that can consider impacts of design decisions ..

For me personally I can say that this whole JSON-LD experience has actually got me asking my self "yes but what will this mean for the graph?" when I make data models. That a good thing I think

But, yes, I missed this entity / product consequence and will find a way to fix it

nissimsan commented 2 months ago

Oh right, I see that now: Product:Entity.

IMO this problem is the logical data model (not mapping to LD). Product is not a kind of Entity.

Two suggestions on solving this:

  1. Drop the inheritance. It's so few properties inherited, just declare them directly on Product, or
  2. Make the super class more abstract. Something like schema.org's Thing.

From an end user's point of view, I would prefer the first option. I find super-abstractions like "Thing" distracting. And in this case I don't see that we gain a whole lot from absolutely having a common super class.

onthebreeze commented 2 months ago

Whether product is an entity or not depends on your understanding of that term

But yes - agreed. Option 1 is the way to go. just drop the inheritance

Will do an update for review before releasing a new version

onthebreeze commented 1 month ago

in 0.4.0 the entity class has been flattened and now the DPP credentialSubject is simply "Product". https://test.uncefact.org/vocabulary/untp/dpp/untp-dpp-instance-0.4.0.json