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

Explain JSON-LD further. #1270

Closed
wants to merge 10 commits into from
150 changes: 142 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3950,42 +3950,176 @@ <h2>Syntaxes</h2>
<section>
<h3>JSON-LD</h3>

<p>
<section class="informative">
<h4>Data Model Foundations</h4>
<p>
The world of credentials is vast and varied. A physical wallet places a few
constraints on the shape and size of those credentials, and no restriction on
their contents. Likewise, the Verifiable Credential Data Model's use of
[[!JSON-LD]] provides a consistent way to interpret all compliant Verifiable
Credentials using a syntax that can be enforced using complementary
technologies such as JSON Schema. This means issuers can add claim terminology
unique to their communities without the high costs of centralized terminology
registration or format churn. In turn, digital wallets can store and index
credentials with widely varying content, providing value to a plethora of
communities, and enabling many diverse use cases.
</p>
<p>
[[!JSON-LD]] provides the Verifiable Credential Data Model (VCDM) with
consistent object-oriented modeling constraints that are familiar to
developers and enable better reuse and composition of data. That modeling is
built from clean expressions of <em>subjects, properties, and values</em>
(<em>S-P-V</em>, also referred to as <em>entities, attributes, and values</em>,
<em>E-A-V</em>, as well as <em>subjects, predicates, and objects</em>,
<em>S-P-O</em>) which comprise the shape of each atomic claim within a VCDM
credential. This approach empowers Wallets to store any credential shaped in
this way and to index the contained claims across all the holder's
credentials, such that credentials may be quickly and easily found and
presented when needed.
</p>

<p>
This foundational data modeling and grammatical structure is provided through
the addition of a single `@context` key which identifies context files that map
otherwise idiosyncratic and often ephemeral terms into universally shareable,
collision resistant vocabularies. [[!JSON-LD]] provides the VCDM's
underlying subject, property, and value graph-based data model which enables
aggregation, collation, and even separation of the individual statements held
within the [[!JSON-LD]] graph. It expresses this model using a developer-friendly
object-oriented structure enabling consistent interpretation of previously
freeform JSON documents.
</p>
</section>

<section class="informative">
<h3>Extending JSON</h3>

<p>
[[!JSON-LD]] brings context, meaning, and object-oriented modeling to previously
idiosyncratic JSON formats. It provides that contextualization by mapping
colloquial terms used within a JSON object to term and type definitions with
universal identifiers in the form of URLs. This prevents term collisions and
need for yet-more-JSON-formats by providing a common extensible JSON structure
with minimal requirements for extensibility. The additional grammatical
constraints at this foundational layer prevent the need for endless invention
and support of use case specific JSON models with idiosyncratic terms and
unique to the implementation approaches to data modeling, value usage, and
parsing approaches.
</p>

<p>
A JSON document becomes a [[!JSON-LD]] document when it includes an `@context`
property with a URL associated with a context file and is interpreted in an
object-oriented style. The context file provides
the mapping between the idiosyncratic in-document terminology and universally
shareable identifiers and value definitions. This provides not only
contextualization and meaning, but also reusability through universally
shareable terms and object-oriented structuring. This enables aggregation and
collation of data without the need for additional upfront integration
development time for each newly discovered JSON format. Future community
credential definitions will focus on the use of their terminology rather than
force implementers to parse another unique JSON format specific to that
community or use case.
</p>

<p>
Consequently, without any additional processing a JSON document gains the value
of an in-message association with its terminology definitions. Details on
processing VCDM documents consistently with the context file, but without
[[!JSON-LD]] tooling, can be found in the "JSON Processing" section below.
</p>

<p>
The referenced context file provides the foundation for a consistent
grammatical layer on top of object-oriented modeling and community-driven
terminology selection which enables coexistence of various JSON tree shapes and
colloquial terms while preventing likely terminology collisions or creating a
need to write new tree traversal code for every new media type or JSON shape or
parsing approach.
</p>

<p>
The Verifiable Credentials Data Model uses this consistent foundation to provide a
common layer across all credentials, presentations, and transaction formats
within a single, consistently parseable media type definition. This allows for
ecosystem extensibility without requiring a centralized registry to be updated
for every new application or community. The core data model terms are
registered and specified while communities are free to build on that foundation
through their own specification process. The terminology mappings are
referenced from the VCDM document removing the need for an ever changing
landscape of "private claims" or narrowly defined "public claims" housed in a
centralized registry. Instead, contexts function as decentralized registries
that can be shared within or across communities. The common grammar and
object-oriented data modeling
remain the same, and properly contextualized terms can commingle. Applications
and communities can extend what is claimed and signed through the use of
vocabularies.
</p>

<p>
The underlying graph data model enables signing of the document's statements
rather than just an envelope in which it's contained. When using this feature, the
data — while signed — is accessible in the same format it had been prior to signing,
allowing for easier indexing, storage, and in-Wallet selection. The existence of
one or more proofs within the object-oriented graph model, each fit for purpose,
can be used to increase confidence that its actual informational contents are signed.
This enables, for example, selective disclosure of statements within the same JSON format,
avoiding the ever increasing cost of retooling for new disclosure formats or
new envelope types. The proof is consistently placed alongside the claims.
</p>

<p>
[[!JSON-LD]] provides Verifiable Credentials with a consistent grammatical
foundation, object-oriented modeling, and collision-free terminology sharing
which allows for ecosystem growth, document format iteration (rather than
reinvention), and an extensible framework for new cryptographic proof
mechanisms without altering or damaging the underlying data structure. This
creates economies of scale which reduces development time, decreases
retooling cost, decreases time to market, and provides long term stability for
Issuers, Verifiers, and Wallets.
Comment on lines +4076 to +4079
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
mechanisms without altering or damaging the underlying data structure. This
creates economies of scale which reduces development time, decreases
retooling cost, decreases time to market, and provides long term stability for
Issuers, Verifiers, and Wallets.
mechanisms without altering or damaging the underlying data structure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Shared foundational data models and consistent data processing pipelines do quantifiably reduce development time, decrease retooling cost, etc. Could you expand on why you'd like this statement removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Sakurann this paragraph remains unchanged in the most recent revision, so please let me know if there are specific complaints with the above claims. Thanks!

</p>
</section>

<section>
<h3>JSON-LD Syntax</h3>

<p>
[[!JSON-LD]] is a JSON-based format used to serialize
<a href="https://www.w3.org/TR/ld-glossary/#linked-data">Linked Data</a>. The
syntax is designed to easily integrate into deployed systems already using JSON,
and provides a smooth upgrade path from JSON to [[!JSON-LD]]. It is primarily
intended to be a way to use Linked Data in Web-based programming environments,
to build interoperable Web services, and to store Linked Data in JSON-based
storage engines.
</p>
</p>

<p>
<p>
[[!JSON-LD]] is useful when extending the data model described in this
specification. Instances of the data model are encoded in JSON-LD compact
form [[!JSON-LD]] and include the <code>@context</code> <a>property</a>. The
<a href="https://www.w3.org/TR/json-ld/#the-context">JSON-LD context</a>
is described in detail in the [[!JSON-LD]] specification and its use is
elaborated on in Section <a href="#extensibility"></a>.
</p>
</p>

<p>
<p>
Multiple contexts MAY be used or combined to express any arbitrary information
about <a>verifiable credentials</a> in idiomatic JSON. The
<a href="https://www.w3.org/TR/json-ld/#the-context">JSON-LD context</a>,
available at <code>https://www.w3.org/ns/credentials/v2</code>, is a static
document that is never updated and can therefore be downloaded and cached client
side. The associated vocabulary document for the Verifiable Credentials Data
Model is available at <code>https://www.w3.org/2018/credentials</code>.
</p>
</p>

<p>
<p>
This specification restricts the usage of JSON-LD representations of
the data model. JSON-LD <a
href="https://www.w3.org/TR/json-ld/#compacted-document-form">compact document
form</a> MUST be utilized for all representations of the data model in the
base media type, `application/vc+ld+json`.
</p>
</p>
</section>

<section>
<h3>Syntactic Sugar</h3>
Expand Down