Skip to content

Support both @view sugar AND explicit ui:view predicate #4

@melvincarvalho

Description

@melvincarvalho

Summary

Support @view as built-in JSON-LD syntax in solid-shim, expanding to the jsonld:view predicate.

Live Implementation

🚀 See it working: https://jsonos.com/examples/

Background

@view should work like @type - zero context required:

{
  "@context": {"schema": "http://schema.org/"},
  "@type": "schema:Person",
  "@view": "https://example.com/panes/person.js",
  "schema:name": "Alice"
}

Just like @type expands to rdf:type, @view should expand to jsonld:view.

Implementation

When parsing JSON-LD, solid-shim should:

  1. Recognize @view as a reserved keyword
  2. Expand it to http://www.w3.org/ns/json-ld#view
  3. Store the triple: <subject> jsonld:view <viewUrl>
// In parseJsonLdToStore or similar
if (data['@view']) {
  const VIEW = $rdf.Namespace('http://www.w3.org/ns/json-ld#')
  store.add(subject, VIEW('view'), $rdf.sym(data['@view']))
}

Semantic Equivalence

For interop with Solid's ui vocabulary:

jsonld:view owl:equivalentProperty ui:view .

This means queries for either predicate should match.

Why jsonld:view?

  • JSON-LD native namespace
  • W3C controlled
  • Clear path to standardization
  • Bridges to ui:view via equivalentProperty

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions