w3c/wot-profile

Are all TD 1.1 assertions valid in all profiles?

egekorkan opened this issue · 6 comments

This is a question for the profiling mechanism in general. Since profile-compliant Things generate TDs, this should mean that they have to comply with all the assertions in the TD spec. For example, the following assertion is in the TD spec:

When title and titles or description and descriptions are present in a TD document, each title and description member SHOULD have a corresponding titles and descriptions member, respectively.

My answer to my question is simply yes but I think that an assertion is needed in the profile spec. In the arch spec, the section https://w3c.github.io/wot-architecture/#profile-description-methodology says

These constraints define a subset of valid WoT Thing Descriptions by defining additional rules on various aspects of the WoT Thing Description

However, that is not an assertion neither and a valid TD is not a definition that is strictly defined, see:

Formally, a valid TD satisfies all the assertions in this specification, but not all assertions can be validated given only the JSON serialization, for instance, the assertions listed under 8. Behavioral Assertions that relate a TD to the behavior of a Thing that it describes. Extensions are also problematic, in that even if formal metadata is given for validating an extension, dynamically fetching this metadata in a deployment might pose a privacy risk. In this section, therefore, we name and define various levels of validation appropriate for different contexts.

These constraints define a subset of valid WoT Thing Descriptions by defining additional rules on various aspects of the WoT Thing Description

The word "subset" here is misleading, see #243. The definition of profiles in the WoT Profile specification was refined in #278 to remove that language:

A technical specification which provides a set of assertions such that any Consumer which conforms with the those assertions is out-of-the-box interoperable with any Thing which also conforms with those assertions.

Are all TD 1.1 assertions valid in all profiles?

There's technically nothing to prevent someone from defining a profile with assertions which contradict/overrule assertions in the TD 1.1 specification, but I don't think we as a working group would intentionally do that unless it was unavoidable due to a technical limitation of the Thing Description specification.

In general the Thing Descriptions of Web Things conforming to a profile should be valid against the Thing Description 1.1 specification (to the extent that "valid" is defined), but Consumers which implement a given profile may make additional assumptions about behaviour of the Web Thing in addition to what is described in its Thing Description.

There's technically nothing to prevent someone from defining a profile with assertions which contradict/overrule assertions in the TD 1.1 specification, [...]

My take on that is different. It SHOULD not be possible to contradict/overrule TD assertions a profile is based on. I think doing so (or allowing it to happen) does not make sense and most likely causes issues.

[...] but I don't think we as a working group would intentionally do that unless it was unavoidable due to a technical limitation of the Thing Description specification.

I think we are agreeing here.

@egekorkan @benfrancis @danielpeintner - Is there any change required from text that's currently in the profile? If yes, please propose concrete text in a PR.

It is more of a question. If we agree on this, I can create a PR.

I think the fact that Thing Descriptions conforming to Profiles should be valid against the TD 1.1 specification is implied by the assertion:

In order to use a profile member in a Thing Description, the @context member MUST contain the anyURI https://www.w3.org/2022/wot/td/v1.1 in order to denote that the document is using version 1.1 of the Thing Description specification.

However it could be made more explicit, e.g.

"In order to conform with a profile, a Thing MUST have a valid Thing Description which complies with all mandatory assertions from the WoT Thing Description 1.1 specification [[wot-thing-description11]]."

I agree that the proposal from @benfrancis is needed if we really want this. Having the @context value only tells a parser about the meaning of the keywords and not about many other assertions in the TD spec. IF all assertions must be implemented, we need assertions like the following to be satisfied by Things and Consumers:

  • All identifiers used in a TD SHOULD be mutable, and in particular there SHOULD be a mechanism to update the id of a Thing when necessary.
  • When metadata such as @direction is not present, TD Consumers SHOULD use first-strong detection as a fallback.

These kind of assertions make a fully compliant TD implementation quite difficult to achieve so I would not be surprised if a profile says that assertion x, y and z of the TD spec are not considered normative but we need a mechanism to allow this.