Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define TD Fragment #579

Closed
wants to merge 1 commit into from
Closed

Define TD Fragment #579

wants to merge 1 commit into from

Conversation

mlagally
Copy link
Contributor

@mlagally mlagally commented Jan 28, 2021

Adding TD Fragment definition as proposed in arch call 2 weeks ago.
May need some minor editorial changes.

resolves #574


Preview | Diff

@mmccool mmccool changed the title Update index.html Define TD Fragment Jan 28, 2021
@mmccool mmccool self-requested a review January 28, 2021 15:49
Copy link
Contributor

@mmccool mmccool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: "JSON Fragment" has been defined as a JSON element that is not an object or array, e.g. a basic value like a string or number. A TD Fragment could be a JSON Fragment (i.e. just a string) but it MIGHT also be an object or array (eg a DataSchema) (at least in the Discovery use case).

We have to decide if the name will be confusing because of this. If we feel it would be, we might want to pick another name. Options might include "TD Component", "TD Element", or "TD Node". "Component" may conflict with names we might want to use later for modularity, though. "Node" may conflict with use of this term in RDF. So if we DO have to change the name, I'd vote for "TD Element". We might also want to see if there is a definition in JSON for the concept we want and use that to align better with JSON.

Update: I looked at various JSON docs and it seems "Element" is used with the meaning we want (superclass of Arrays, Objects, and (JSON) Fragments).

<dd>
A <a>TD Fragment</a> is a substructure of the data model of a TD.
It is a valid object structure that can be validated syntactically against a part of the TD datamodel
defined in chapter 5 of the TD spec, however the fragment may omit some context that allows full validation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should replace reference to "chapter 5" with a link that uses the section name (eg "Information Model"). Also, the link should probably not be an actual link, but a reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmccool Please provide an appropriate link

omitting outer elements, curly braces etc. present in a full TD.

As a use case the <a>TD Fragment</a> is useful for Discovery results returned by a JSON-Path query.
See the <a href="https://www.w3.org/TR/wot-discovery/</a> for more details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct link should be a reference. It might also be helpful to mention a particular section or link to an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mmccool Please provide an appropriate link

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question. Is the following a valid TD fragment? It is not valid JSON...

"status": {
    "type": "string"
}

<dd>
A <a>TD Fragment</a> is a substructure of the data model of a TD.
It is a valid object structure that can be validated syntactically against a part of the TD datamodel
defined in chapter 5 of the TD spec, however the fragment may omit some context that allows full validation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the fragment" perhaps should be "the TD Fragment" to be consistent with other usages

@mmccool
Copy link
Contributor

mmccool commented Feb 4, 2021

BTW, some refs for JSON, although I can't find definitions of "JSON fragment" or "JSON element" in there. I will do a bit more research; these do seem to be common terms, but may not be in the official standards:

@mlagally
Copy link
Contributor Author

mlagally commented Feb 5, 2021

BTW, some refs for JSON, although I can't find definitions of "JSON fragment" or "JSON element" in there. I will do a bit more research; these do seem to be common terms, but may not be in the official standards:

ECMA-404 defines the "JSON Value" grammar, which I think is what we want to call "JSON Element"

I came across the following "JSON fragment" definition (https://medium.com/grand-parade/creating-type-safe-json-in-swift-74a612991893), which may be useful:

A JSON fragment is a JSON that does not have an Object or an Array as the root.

@danielpeintner
Copy link
Contributor

I came across the following "JSON fragment" definition (https://medium.com/grand-parade/creating-type-safe-json-in-swift-74a612991893), which may be useful:

A JSON fragment is a JSON that does not have an Object or an Array as the root.

I think there are different interpretations what a fragment is.

  • part of a TD (not complete according to JSON schema)
  • sub-part of a a TD (a inner element like just a given property)
  • a JSON that per se is not valid (e.g., multiple objects on root level OR "status": {"type": "string"} )
  • combinations of the aforementioned

@mlagally
Copy link
Contributor Author

mlagally commented Feb 11, 2021

Arch call on 11.2.
We merged the definition from the later MR #580 , this MR is obsolete but the branch will be kept for documentation purposes.

@mlagally mlagally closed this Feb 11, 2021
@mlagally mlagally deleted the mlagally-patch-3-1 branch November 10, 2021 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terminology: thing description fragments
3 participants