- From: Peter Krauss <ppkrauss@gmail.com>
- Date: Sun, 31 Oct 2021 21:24:58 -0300
- To: public-json-ld@w3.org
- Message-ID: <CAHEREts-J_4uk2ip-9_YAQzmp67=Fv-SfvHkmH0M0ix1B8iziA@mail.gmail.com>
I am suggesting a small feature, for a future version of JSON-LD, but it's not clear whether it's a matter of Syntax, API or in some other document that depends on the component specifications. *ABSTRACT*: it is intended to make *content-reuse* as easy as Microdata or RDFa+HTML make. The Embedding JSON-LD in HTML Documents <https://www.w3.org/TR/json-ld11/#embedding-json-ld-in-html-documents> is a good replacement for Microdata or RDFa+HTML, but to be complete need to reuse *HTML content* *instead to duplicate it*. As in the Microdata interpretation <https://html.spec.whatwg.org/multipage/microdata.html#the-basic-syntax>, the string to be translated, from cited (by *id*) HTHM element to plain text must use a method defined by DOM standard <https://en.wikipedia.org/wiki/Document_Object_Model>, the *HTMLElement.innerText* <https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/innerText>. *EXAMPLE*: supposing an ID in the Example 164 <https://www.w3.org/TR/json-ld/#example-164-html-that-describes-a-book-using-microdata> HTML fragment, something as .... <dt>Title</dt> <dd><cite id="tit01" itemprop="http://purl.org/dc/elements/1.1/title">Just a Geek</cite></dd> .... the Example 165 <https://www.w3.org/TR/json-ld/#example-165-same-book-description-in-json-ld-avoiding-contexts> JSON-LD fragment will be something as [ { "@id": "http://purl.oreilly.com/works/45U8QJGZSQKDH8N", "@type": "http://purl.org/vocab/frbr/core#Work", "http://purl.org/dc/elements/1.1/title": {"@id":"#tit01"}, "http://purl.org/dc/elements/1.1/creator": "Wil Wheaton", "http://purl.org/vocab/frbr/core#realization": [...] }, ... ] So, by the *innerText* rule, the *title *line will be equivalent to "http://purl.org/dc/elements/1.1/title": "Just a Geek" Note: is a simple get-and-convert algorithm. In a Javascript parser the string can be obtained by document.getElementById("tit01").innerText. *RATIONALE*: reuse content, avoiding waste, errors or malicious changes... And it is not only reuse, many legal applications (for Internet or digital preservation scope), in Science and Justice, need document transparency and* integrity guarantee*. Examples: JATS <https://en.wikipedia.org/wiki/Journal_Article_Tag_Suite>, SchemaOrg/Legislation <https://schema.org/Legislation>, SchemaOrg/ScholarlyArticle <https://schema.org/ScholarlyArticle>, and other official documents.
Received on Monday, 1 November 2021 01:03:57 UTC