International-Data-Spaces-Association / Java-Representation-of-IDS-Information-Model

Apache License 2.0
2 stars 7 forks source link

Issues with adding mediaType to ids:representation (v4.2.5) #13

Open juliapampus opened 2 years ago

juliapampus commented 2 years ago

Using Infomodel library v4.2.5.

According to the Infomodel, it should be possible to add official IANAMediaTyoes and custom media types to the representation:

ids:MediaType. Removed instances for ids:IANAMediaType.

Media types via ids:mediaType with range ids:IANAMediaType should be used with the corresponding IANA URLs, as these have complete coverage. E.g., for JSON-LD:
"ids:mediaType": {
  "@id":   "https://www.iana.org/assignments/media-types/application/ld+json",
  "@type": "ids:IANAMediaType"
}
For custom media types (ids:CustomMediaType), it is advised to use a recognizable unique identifier.

With the newest library version, the IANAMediaTypeBuilder has been removed. Since the MediaType and CustomMediaType do not inherit from each other and both classes are enums, it is not possible to add other types than the provided json or other. Can you give a hint on how to implement? Perhaps I have missed something.

tmberthold commented 2 years ago

https://github.com/International-Data-Spaces-Association/InformationModel/pull/516#issuecomment-947592810

SebastianOpriel commented 2 years ago

@JohannesLipp We see, that this is still an open issue. Currently data offerings of DSC contain the media type in following structure:

 "ids:mediaType" : {
      "@type" : "ids:IANAMediaType",
      "@id" : "https://w3id.org/idsa/autogen/iANAMediaType/971f7e84-f697-4783-9683-0c6a5a2d45fb",
      "ids:filenameExtension" : "application/json"
    }

See full example here: https://international-data-spaces-association.github.io/DataspaceConnector/Documentation/v6/Messages#resourceupdatemessage

A proper structure is described by Julia above. As far as I seem this shall be possible to archive by simple calling constructor and setting the id as parameter https://github.com/International-Data-Spaces-Association/Java-Representation-of-IDS-Information-Model/blob/cbff893bf48e8b4c3a7f7a0facd446d69c83eb4b/de/fraunhofer/iais/eis/IANAMediaTypeBuilder.java#L17 Am I right? Are you aware of any problems, which might occur in other components when setting the id correctly? @sebplorenz @timwirtz86

Another related issues: https://github.com/International-Data-Spaces-Association/InformationModel/issues/224

JohannesLipp commented 2 years ago

@SebastianOpriel @juliapampus what is the respective infomodel version for "Infomodel library v4.2.5"?

In short: IMHO @SebastianOpriel suggests a correct solution by passing the IANA URL as id to the respective builder method.

The ids:IANAMediaType hints to the possibility of using pre-defined IANA media types, such as e.g. application/json as listed at IANA at https://www.iana.org/assignments/media-types/.

SebastianOpriel commented 2 years ago

Currently 4.2.7 is used: https://github.com/International-Data-Spaces-Association/IDS-Messaging-Services/blob/1f55002f8063b6af4af2615fbf850c815446f092/pom.xml#L89 Changelog see: https://github.com/International-Data-Spaces-Association/Java-Representation-of-IDS-Information-Model/blob/main/Changelog.md#427---2021-11-03 I am not aware how IAIS is tracking the version. This was also a big confusion in a discussion some time ago. You maybe know responsible contacts for infomodel library better than me.

Thanks for your opinion, we will take that as an request for improvement.