schema_salad icon indicating copy to clipboard operation
schema_salad copied to clipboard

It is not clear the relationship between Salad documents and document contexts

Open tom-tan opened this issue 3 years ago • 4 comments

The section 2.3 in the spec describes two kinds of document contexts: implied context and explicit context. It seems that the Salad documents are written in either implied context or explicit context.

However, the metaschema of Salad Schema imports field_name.yml that is not written in implied context nor explicit context. Also, the import section says that the imported URI must be loaded as a Salad document.

Can a document that is not in implicit context nor explicit context be a valid Salad document? If so, where or when can we use document contexts in a Salad document?

tom-tan avatar Dec 09 '21 05:12 tom-tan

There is still an implicit context. There is the URL where the document was loaded from, which is used to resolve relative references, and the vocabulary of the schema of the parent document.

tetron avatar Dec 09 '21 15:12 tetron

Thank you for the clarification!

There is still an implicit context.

The problem is that we can not reason it from the current spec descriptions.

The section 2.3.1 says:

The implicit context consists of the vocabulary defined by the schema

Also, the section 2.1 says:

A vocabulary is the set of symbolic field names and enumerated symbols defined by a document schema

However, field_name.yml that I showed as an example consists of an array of strings rather than the set of field names. It would be nice if the spec description of the implicit context is fixed to include an array of strings.

By the way,

2.3.1 Implied context

Is it implicit context?

tom-tan avatar Dec 09 '21 15:12 tom-tan

The context (including the vocabulary) is something that is applied to the document being loaded in order to correctly interpret it. In the case of the metaschema, this is a little confusing because it is self-describing. Normally the vocabulary comes from the schema (which is separate), not the actual document being loaded/validated.

To clarify, the vocabulary closely related to the JSON-LD context, it is a set of terms which are are equivalent to fully qualified URIs. A field name has equivalence with a full URI representing an RDF predicate, a enum symbol is equivalent to an URI of an RDF entity or concept node, and so forth. The vocabulary is the set of short terms that are meaningful in the document without having to be fully qualified URIs.

In this case, field_name.yml is a list of literal strings and $include blocks. Since there are no symbols, the context is only necessary to determine how to resolve the relative references of $include.

You are right, we need to document the existing usage.

tetron avatar Dec 09 '21 15:12 tetron

Thank you for the explanation.

So how to fix the document? Can we say that a given document is written in the implicit context if it is not in the explicit context?

tom-tan avatar Dec 16 '21 05:12 tom-tan