Skip to content

Commit 89edbba

Browse files
committed
Add remaining Use Case Issues.
Addresses #7, #8, #11, #12, #13, #17, #19, #31, and #35.
1 parent 13ff5f8 commit 89edbba

1 file changed

Lines changed: 230 additions & 6 deletions

File tree

UCR/index.html

Lines changed: 230 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
group: "cg/json-ld",
1717
doJsonLd: true,
1818
wgPublicList: "public-linked-json",
19+
maxTocLevel: 2,
1920
};
2021
</script>
2122
<style>
@@ -35,7 +36,7 @@
3536
This document is a community working draft.
3637
</p>
3738
</section>
38-
39+
<section id="conformance"></section>
3940
<section>
4041
<h2>Introduction</h2>
4142
<p>
@@ -67,9 +68,7 @@ <h2>Contributing Use Cases and Requirements</h2>
6768
<h2>Submitted Use Cases</h2>
6869

6970
<section data-format="markdown" id="uc-5">
70-
#### Compatibility with existing libraries
71-
72-
[Submitted Use Case](https://github.com/json-ld/yaml-ld/issues/5)
71+
#### Compatibility with existing libraries ([#5](https://github.com/json-ld/yaml-ld/issues/5))
7372

7473
As a developer of YAML-LD processors.
7574
I want to be able to use off-the-shelf libraries for converting between JSON-LD and YAML-LD serialization formats.
@@ -81,8 +80,9 @@ <h2>Submitted Use Cases</h2>
8180
</section>
8281

8382
<section id="uc-6">
84-
<h4>Distinguish "plain" YAML-LD from "ideomatic" YAML-LD</h4>
85-
<p><a href="https://github.com/json-ld/yaml-ld/issues/6">Submitted Use Case</a></p>
83+
<h4>Distinguish "plain" YAML-LD from "ideomatic" YAML-LD
84+
(<a href="https://github.com/json-ld/yaml-ld/issues/6">#6</a>)</h4>
85+
8686
<p>As a processor. I want to easily distinguish between "plain" YAML-LD and "ideomatic" YAML-LD based on the use of local tags (or similar) which may require post-parsing processing to be interpreted using the JSON-LD processig algorithms. So that more complicated processing steps can be avoided.</p>
8787
<pre class="example">
8888
!yaml-ld
@@ -98,6 +98,230 @@ <h4>Distinguish "plain" YAML-LD from "ideomatic" YAML-LD</h4>
9898
</ul>
9999
</div>
100100
</section>
101+
102+
<section data-format="markdown" id="uc-7">
103+
#### File signature ([#7](https://github.com/json-ld/yaml-ld/issues/7))
104+
105+
As a data consumer.
106+
I want an indicator to tell me that a file is probably YAML-LD.
107+
So that I know when to expect YAML-LD.
108+
109+
<pre class="example">
110+
!&lt;tag:json-ld.org,2022&gt;
111+
$context: http://schema.org/
112+
$type: Person
113+
name: Pierre-Antoine Champin
114+
</pre>
115+
116+
<p class="note">
117+
This may be part of an <em>extended profile</em>,
118+
as the <em>basic profile</em> may not use anything more than basic YAML structures.
119+
Also, this is contrary to JSON-LD principles that are intended to process arbitrary JSON.
120+
</p>
121+
</section>
122+
123+
<section data-format="markdown" id="uc-8">
124+
#### Round-trip safe json-ld -&gt; yaml-ld -&gt; json-ld ([#8](https://github.com/json-ld/yaml-ld/issues/8))
125+
126+
As a user with json-ld files.
127+
I want to convert them to yaml-ld.
128+
So that they are round-trip safe.
129+
130+
<p class="note">
131+
There seems to be a general concensus against using any special YAML
132+
encoding considerations in the <em>basic profile</em>.
133+
</p>
134+
</section>
135+
136+
<section data-format="markdown" id="uc-11">
137+
#### Replace $-keywords with @-keywords ([#11](https://github.com/json-ld/yaml-ld/issues/11))
138+
139+
As an author of YAML-LD files.
140+
I want an ability to type keywords without quotes.
141+
So that my authoring experience is better.
142+
143+
JSON-LD keywords such as `@id` and `@type` must be quoted when used as keys in YAML. Using an alternative representation such as `$id` and `$type` allows these keywords to be used without quoting.
144+
145+
<p class="note">
146+
This can largely be achieved using aliases in a context, perhaps
147+
a standardized context.
148+
This does not handle `@context` itself, nor keywords used within
149+
a YAML defined context.
150+
Alternatively, this may be handled by the <i>documentLoader</i>
151+
</p>
152+
</section>
153+
154+
<section data-format="markdown" id="uc-12">
155+
#### Convert JSON-LD to YAML-LD using standard YAML libraries ([#12](https://github.com/json-ld/yaml-ld/issues/12))
156+
157+
As a developer.
158+
I want to be able to convert JSON-LD documents to YAML-LD by simply serializing the document using any standard YAML library.
159+
So that the resulting YAML is valid YAML-LD, resolving to the same graph as the original JSON-LD.
160+
161+
Conversely, I would be very surprised (and annoyed) if such a simple conversion did not work.
162+
163+
This is why, although I do not oppose $-keywords ([#11](#uc-11)) for authoring YAML-LD from scratch, I want @-keywords to be also supported.
164+
</section>
165+
166+
<section data-format="markdown" id="uc-13">
167+
#### Define anchor usage in yaml-ld ([#13](https://github.com/json-ld/yaml-ld/issues/13))
168+
169+
As a json-ld editor.
170+
I want to use yaml anchors.
171+
So that I can easily reuse content.
172+
173+
<div class="note" data-format="markdown">
174+
The specification should define:
175+
176+
* when it is legitimate to use anchors
177+
* which are the expectation on anchor usage (e.g. do they represent a specific JSON-LD node or they can just be used to represent content?)
178+
* are there any constraint on anchor usage? (e.g. the representation graph MAY / MUST NOT be a cyclic graph...)
179+
</div>
180+
181+
<pre class="example">
182+
---
183+
- "@id": &homer http://example.org/#homer # Anchor the homer url
184+
http://example.com/vocab#name:
185+
- "@value": Homer
186+
- "@id": http://example.org/#bart
187+
http://example.com/vocab#name:
188+
- "@value": Bart
189+
http://example.com/vocab#parent:
190+
- "@id": *homer # reuse the anchor instead of re-typing the homer url
191+
- "@id": http://example.org/#lisa
192+
http://example.com/vocab#name:
193+
- "@value": Lisa
194+
http://example.com/vocab#parent:
195+
- "@id": *homer
196+
</pre>
197+
</section>
198+
199+
<section data-format="markdown" id="uc-17">
200+
#### YAML-LD datatypes (and tags for datatypes) ([#17](https://github.com/json-ld/yaml-ld/issues/17))
201+
202+
- RDF uses explicitly tagged literals, in particular lang strings and XSD datatypes, including infinite precision integers and decimals.
203+
- JSON carries faithfully strings and small numbers, everything else must be represented as a string with a separate field to indicate the datatype (`@type` in JSON-LD). Eg see https://github.com/w3c/json-ld-syntax/issues/387 for the pitfalls of using large integers or decimals
204+
- YAML can use tags to carry literals faithfully (including infinite precision, "markers" like `-.inf` and `.nan`, datetimes), and even more complex structures. One could declare "YAML schemas" with additional tags, eg to represent all XSD datatypes
205+
206+
Why might we want more than "string plus `@type`"?
207+
- convenience (eg see `dc:date` below and many other examples)
208+
- normalization (reduce/eliminate lexical vs value space differences): it seems to me easier for a processor to normalize `02022-05-18` to `2022-05-18` if tagged as `!xsd!date` rather than looking at a parallel `@type` field.
209+
210+
Let's collect below examples of what we could want.
211+
212+
---
213+
214+
@gkellogg in https://github.com/ietf-wg-httpapi/mediatypes/issues/8#issuecomment-1034040169
215+
> If I were to revisit anything in the JSON-LD data model, it would be the interpretation of JSON numbers to allow for decimal values. As it is now, JSON numbers are either interpreted as integers (long) or doubles based on the range of the number. But, in JSON-LD 1.1, we use The JSON Canonicalization Scheme ([RFC8785](https://www.w3.org/TR/json-ld11/#bib-rfc8785)) as a way to represent numbers in the rdf:JSON datatype serialization, which allows for a serialization form of either integer, decimal, or double. This really only comes into play in JSON-LD when creating RDF literals from native JSON numbers (something which is generally a bad design point, but is there to allow a reasonable interpretation of native JSON forms), but could also come into play when representing those numbers in the data model, and thus in serializations to forms such as YAML.
216+
217+
---
218+
219+
@VladimirAlexiev from #2:
220+
- [Tags](https://yaml.org/spec/1.2.2/#3212-tags) are comparable to datatypes.
221+
- the YAML [json schema](https://yaml.org/spec/1.2.2/#102-json-schema) and [core schema](https://yaml.org/spec/1.2.2/#103-core-schema) handle string, boolean, integer, float (the latter allows things like `-.inf` and `.nan`).
222+
- https://yaml.org/type/ handles a wider set, in particular dates and datetimes. But please note these are considered deprecated in 1.2 and are being removed in 1.3 https://github.com/yaml/yaml-spec/issues/268#issuecomment-1039000203
223+
- Maybe we should define a YAML schema to handle more xsd datatypes?
224+
- It should aim to eliminate problems related to the limited and non-standardized set of JSON literals. Eg the JSON number `12345678901234567890.12345` is converted to RDF literal `"12345678901234567168"^^xsd:integer` (see [jsonld playground](https://tinyurl.com/yy6xh52v))
225+
- And could even work as a replacement of `@type`, eg
226+
```
227+
# short form using tags
228+
dc:date: !xsd!date 2022-05-18
229+
230+
# instead of long form
231+
dc:date: {"@type": xsd:date, "@value": 2022-05-18}
232+
```
233+
234+
---
235+
236+
New ones:
237+
238+
- is it at all feasible to write `"foo"@en` in YAML rather than a separate `@language` field?
239+
- JSON-LD cannot capture GeoJSON because that uses nested arrays. Can this be worked around somehow with a YAML tag for "2D array"?
240+
</section>
241+
242+
<section data-format="markdown" id="uc-19">
243+
#### Polyglot Modeling ([#19](https://github.com/json-ld/yaml-ld/issues/19))
244+
245+
As an information architect
246+
I want data modeling language(s) independent of technical artefacts
247+
So that:
248+
- the language is understandable to domain experts
249+
- it can generate a variety of required technical artefacts
250+
- all these artefacts are kept in sync, thus lowering maintenance effort
251+
252+
For efficient RDF modeling, you need to define multiple related artefacts:
253+
- ontology
254+
- shapes (SHACL (@holgerknublauch) or SHEX (@ericprud))
255+
- diagrams and other documentation
256+
- JSON-LD context,
257+
- maybe JSON-LD frames,
258+
- JSON schema or Avro schema
259+
- API bindings and hypertext controls (HATEOAS)
260+
- etc
261+
262+
Thus, many people have expressed the desire to define a unified or "technology independent" modeling language.
263+
- See eg https://github.com/w3c-ccg/traceability-vocab/issues/296 for a brief list of modeling framework requirements
264+
265+
Many communities like to have a LD expression of their data, but mostly care about defining the data with JSON schema. Efforts to marry JSON Schema with JSON-LD contexts have been undertaken in:
266+
- `w3c-ccg` @OR13 @nissimsan @msporny
267+
- WoT: https://www.w3.org/2019/wot/json-schema, http://www.w3.org/2019/wot/hypermedia @vcharpenay, @maximelefrancois86, María Poveda Villalón
268+
- OAS: [OpenAPI-Specification/](https://github.com/OAI/OpenAPI-Specification/), [OAS Semantic Context](https://docs.google.com/document/d/1fBRH2wtg1p_g4voNSTlHiSJmKgvfNaIsUXwPBO36RuM/edit) in particular for eGovernment APIs @ioggstream @pchampin @giorgialodi
269+
270+
Many polyglot frameworks are YAML-based. Examples include:
271+
- [LinkML](https://linkml.io/) ([github](https://github.com/linkml)) (@cmungall)
272+
- [FHIR](https://www.hl7.org/fhir/) (@ericprud): note, this is not YAML-based
273+
- [Schema Salad](https://www.commonwl.org/v1.2/SchemaSalad.html) (@mr-c @tetron)
274+
- [A.ML](https://a.ml/) and [cloudinformationmodel](https://github.com/cloudinformationmodel/cloudinformationmodel) @danmoralesatx
275+
- [RAML](http://raml.org/) (RESTful API Modeling Language), https://github.com/raml-org/raml-spec @sichvoge @krishahn
276+
- Dragon at Uber (Joshua Shinavier and others).
277+
Eg see [Dragon: Schema Integration at Uber Scale](https://eng.uber.com/dragon-schema-integration-at-uber-scale/), US Semantic Technologies Symposium, March 2020, [cached PDF](https://1fykyq3mdn5r21tpna3wkdyi-wpengine.netdna-ssl.com/wp-content/uploads/2020/03/Schema-Integration-at-Uber-Scale-US2TS-2020-1.pdf). YAML schema examples start slide 42
278+
- [SOML](https://platform.ontotext.com/3.0/soml/index.html) (@VladimirAlexiev)
279+
- [smart-data-models](https://smartdatamodels.org/) (FIWARE, IUDX, SmartCities, TM forum). Example: [Aircraft](https://github.com/smart-data-models/dataModel.Aeronautics/tree/master/Aircraft). [contribution manual gslides](https://docs.google.com/presentation/d/e/2PACX-1vTs-Ng5dIAwkg91oTTUdt8ua7woBXhPnwavZ0FxgR8BsAI_Ek3C5q97Nd94HS8KhP-r_quD4H0fgyt3/pub?start=false&loop=false&delayms=3000&slide=id.p1)
280+
---
281+
282+
YAML-LD should not take over these modeling-framework efforts, but should show how they can be used together, show archetypical examples, and maybe make a comparison.
283+
284+
Even if no Modeling requirements make it into any YAML-LD spec, this git repo could serve as a "meeting place" for people working on these topics, potentially resulting in some unification.
285+
</section>
286+
287+
<section data-format="markdown" id="uc-31">
288+
#### Fragment identifier ([#31](https://github.com/json-ld/yaml-ld/issues/31))
289+
290+
As a user.
291+
I want a **fragment identifier specification**.
292+
So that **I can reference specific elements of a yaml-ld**.
293+
294+
295+
#### Notes
296+
YAML fragid processing is described [here](https://www.ietf.org/archive/id/draft-ietf-httpapi-yaml-mediatypes-02.html#section-2.1-2.20.1)
297+
298+
Q0. Do you think that yaml processing is enough?<br/>
299+
Q1. Do .jsonld support JSON Pointer or other referencing method?<br/>
300+
Q2. Do we need a way to reference a specific resource via id, eg. `#id=&lt;URI&gt;` ? In case, this will be specific yaml-ld extension that generic yaml parsers might not support.<br/>
301+
</section>
302+
303+
<section data-format="markdown" id="uc-35">
304+
#### Defining various interoperability profiles ([#35](https://github.com/json-ld/yaml-ld/issues/35))
305+
306+
As an Editor
307+
I want a set of different interoperability profiles
308+
So that I can select the YAML features that are supported by a YAML-LD implementation
309+
310+
## Note
311+
312+
For example I could define
313+
314+
* a BASE profile that is just JSON with YAML syntax: no anchors / alias nodes, only string keywords, only JSON datatype values, comments
315+
* an EXTENDED profile: with anchors / alias nodes but only with a rooted directed acyclic graph
316+
317+
## Elements to be discussed in profiling
318+
319+
- [ ] data types https://github.com/json-ld/yaml-ld/pull/34/files#r912093915
320+
- [ ] usage of anchors / alias nodes
321+
- [ ] multiple documents separated by ---
322+
- [ ] non-string keywords
323+
- [ ] TODO
324+
</section>
101325
</section>
102326
</body>
103327
</html>

0 commit comments

Comments
 (0)