Re: convert rdf or owl into yaml

> On Dec 9, 2022, at 9:13 AM, Pierre-Antoine Champin <pierre-antoine@w3.org> wrote:
> 
> On 09/12/2022 17:01, Chris Mungall wrote:
>> Perhaps another way of phrasing this: YAML is a superset of JSON, allowing for among other things anchors and references. Independent of RDF, this can be useful for representing non-tree like structures directly (including cyclic graphs).
>> 
>> Given anchors and references are outside of JSON syntax, thus outside of JSON-LD syntax, is this a practical limitation? From one perspective, no, URIs do the same job as anchors and references *at the RDF graph level*. But it may still be convenient to have a direct mapping from a proposed YAML-LD to RDF that maps anchors and references directly.
> Ok, that makes a lot of sense. Thanks for the clarification.
>> I believe the YAML-LD group looked at this and the consensus was it was more practical to look at the JSON-expressible subset of YAML, i.e. treat YAML-LD as syntactic sugar.
> 
> more precisely, the group has decided to consider two different application profiles [1]
> * the JSON profile does indeed restrict YAML to its JSON-compatible subset
> * the Extended profile takes advantage of some YAML-specific features. In particular, it states :
> 
> > YAML-LD docucments MAY use alias nodes, as long as dereferencing these aliases does not result in a loop. 
> So acyclyc graphs can be "natively" represented in YAML-LD. Cyclic graphs will still need some indirection through @id.
> Maybe we could relax this constraint, if we find a criterion that is clear enough and practical to implement. Intuitively: whenever you traverse an alias to a node that you have already visited, then
> - if this node has an "@id" key, replace this alias with { "@id": "the id of the target" }
> - otherwise, raise an error

The constraint actually comes from YAML, itself, which requires that the alias nodes must reference already established anchors.

From https://yaml.org/spec/1.2.2/#71-alias-nodes:

> Subsequent occurrences of a previously serialized node are presented as alias nodes. The first occurrence of the node must be marked by an anchor to allow subsequent occurrences to be presented as alias nodes.

This does allow for an anchor node to include an alias node which references it, but there are YAML tests for such runaway recursion. Also interesting is that anchors do not need to be unique, and an alias is to the most recently defined anchor node.

Feedback on the CG spec (https://json-ld.github.io/yaml-ld/spec/) is welcome, as is participation in the group. The work is not done, but there hasn’t been much recent activity. I consider the spec pretty stable at this point, but there are some issue markers for where more work is required.

Gregg

> ??
> [1] https://json-ld.github.io/yaml-ld/spec/#profiles
>> 
>> On Fri, Dec 9, 2022 at 4:29 AM Pierre-Antoine Champin <pierre-antoine@w3.org> wrote:
>> Hi Simon,
>> On 30/11/2022 01:33, Cox, Simon (L&W, Clayton) wrote:
>>> Does tying YAML-LD to the JSON-LD model mean that it inherits limitations from JSON concerning the scope of the graph structures that can be represented? 
>> what limitation are you referring to?
>> Any RDF graph (or dataset, for that matter), can be representedin JSON-LD -- and YAML-LD.
>> Some RDF graphs/datasets may not have a very idiomatic representation, but they *can* be represented.
>>> 
>>> Is this more limited than RDF? 
>> So... no.
>>> 
>>>  
>>> Is there a more general ‘YAML-RDF’, of which YAML-LD is a profile? 
>> No, nor is there, IMO, a need for it.
>>   pa
>>> 
>>>  
>>> From: Gregg Kellogg <gregg@greggkellogg.com> 
>>> Sent: Wednesday, 30 November, 2022 02:46
>>> To: Miel Vander Sande <miel.vandersande@meemoo.be>
>>> Cc: Joy lix <joylix4112@outlook.com>; public-rdf-dev@w3.org; www-rdf-interest@w3.org
>>> Subject: Re: convert rdf or owl into yaml
>>>  
>>> The draft YAML-LD spec can be found here: https://json-ld.github.io/yaml-ld/spec/
>>>  
>>> There are outstanding items, but the CG has reached a pretty stable place with this.
>>>  
>>> It’s intended to closely align with JSON-LD, so the same algorithms are available, and you can mix and match JSON and YAML formats.
>>>  
>>> So far, I think mine is the only implementation https://github.com/ruby-rdf/yaml-ld.
>>> Gregg Kellogg
>>>  
>>> Sent from my iPad
>>>  
>>> On Nov 29, 2022, at 2:20 AM, Miel Vander Sande <miel.vandersande@meemoo.be> wrote:
>>> Hi Joy Lix,
>>>  
>>> There's something brewing in the JSON-LD group: https://github.com/json-ld/json-ld.org/issues?q=label%3Ayaml-ld+  
>>> Best,
>>>  
>>> Miel
>>>  
>>> Op di 29 nov. 2022 om 05:29 schreef Joy lix <joylix4112@outlook.com>:
>>> Folks, Are  there any tools or methods to convert rdf into yaml format files?
> <OpenPGP_0x9D1EDAEEEF98D438.asc>

Received on Friday, 9 December 2022 18:07:12 UTC