Re: GRDDLing JSON?

> On Feb 9, 2024, at 11:48 AM, Danny Ayers <danny.ayers@gmail.com> wrote:
> 
> Have you tried it Dan? I expected the context to give a lot more.
> What I have seen :
> 
> {
>     "name": "SimplePipe",
>     "pipe": [
>         "StringSource",
>         "AppendProcess",
>         "StringSink"
>     ]
> }
> 
> becomes
> 
> {
>     "@context": {
>         "t": "http://purl.org/stuff/transmission/"
>     },
>     "@id": "https://hyperdata.it/treadmill/simplepipe.json",
>     "t:net": {
>         "@list": [
>             "StringSource",
>             "AppendProcess",
>             "StringSink"
>         ]
>     }
> }

Given a sufficiently detailed context, you can do better, and certainly turn the string values into URIs.

JSON-LD was conceived as a way to be able to interpret a wide array of JSON formats by giving things URIs and datatypes. Of course, there is always something that won’t conform, but the addition of property maps, scoped contexts, and nested properties is there specifically to deal with JSON found in the wild.

Of course, the data model for JSON-LD is RDF, but that doesn’t mean that is the only use case. The main value IMO is to be able to say what each of the properties and values means by relating them to URIs and datatypes.

That said, some things require a more active transformation and there were some early attempts at providing a mapping tool for arbitrary JSON, and the GRRDL experience is useful.

Gregg

> This an early version, those things in the list are actually classes, the instances need IDs/URIs (not sure what I've done with that version...). But you can already see obfuscation 
> 
> It gets less appealing the more you add. 
> 
> Unless someone has "Tim's Summer School Project"* very high on their job description, they will run a mile.
> 
> Why not just have eg. :
> 
> {
>     "transformer" : "http//purl.org/stuff/pipey-json-to-turtle.js <http://purl.org/stuff/pipey-json-to-turtle.js>", 
>     "name": "SimplePipe",
>     "pipe": [
>         "StringSource",
>         "AppendProcess",
>         "StringSink"
>     ]
> }
> 
> An agent can deref the link, make it RDF transparently. The typical JSON being dealt will have some kind of consistent schema that's hypothetically mapped to a global meaning, which can be declared using a name-value pair (plus written convention somewhere).    
> 
> 
> 
> * I forget the exact (awful) quote, something like that was Tim Bray's description of the Semantic Web
> 
> 
>  
> 
> 
> 
> On Fri, 9 Feb 2024 at 19:42, Dan Brickley <danbri@danbri.org <mailto:danbri@danbri.org>> wrote:
>> 
>> You can do quite a lot of mapping vanilla json into json-ld using json-ld contexts. Unlike xml there are only so many ways to say stuff and the content tends towards being objects and properties anyhow.
>> 
>> If you’re going to have a turing complete mapping framework you probably should just use JS. 
>> 
>> Cheers
>> 
>> Dan
>> 
>> On Fri, 9 Feb 2024 at 17:58, Danny Ayers <danny.ayers@gmail.com <mailto:danny.ayers@gmail.com>> wrote:
>>> I'm rather out of the loop, so apologies if something like this has already been discussed, implemented even. But I feel obliged to flag an issue, offer a potential solution (which might already exist).
>>> 
>>> # Use case :
>>> For the past few days I've been working on a bit of code where a processing pipeline will be set up declaratively. I'm still on baby steps, but it's a place where RDF should be ideal. A little graph defines the nodes & arcs of the processing system.
>>> 
>>> To get the code started, I only need a trivial model to work from. A simple list, (input reader)->(process)-> (output writer).
>>> So at this stage, it seemed reasonable just to use a minimal JSON list. Generalise to RDF later.
>>> There's a sequence of nodes, each with an instance ID and a type for the nature of the thing. 
>>> A very simple JSON structure covers it.
>>> 
>>> # Issue :
>>> But looking ahead, I wondered how to migrate from the arbitrary JSON to an RDF model. Obviously, JSON-LD.
>>> In my head I saw a namespace declaration, the rest just lifted & placed there from the keys in the JSON mappings. But in practice, it's not quite like that, it gets ugly fast.
>>> I guess it's basically a syntax issue.
>>> What you see in the (arbitrary) JSON expression is visually/intuitively understandable. Ditto in Turtle. But in JSON-LD, any kind, the immediacy of interpretation by a human (this one at least)  is lost.
>>> 
>>> # Proposed Solution :
>>> I don't know if anyone remembers GRDDL [1]. An elegant approach for bridging between anyXML and RDF.  One added attribute in the doc, to say it has an RDF representation and here's how to get it. It's an easy inclusion in namespaced XML, we* went for XSLT transformers, a very immediate approach. Imagine an org with loads of XML documents of the same shape. A transformation has to be written once, that pointer inserted in all these docs, very low-effort mapping to the RDF world.
>>> As far as I'm aware, to date, absolutely no-one has ever used this.
>>> 
>>> *But* the idea is great. Forget XML, let's do JSON.
>>> Add one (presumably top-level) name value pair in a JSON doc:
>>> 
>>> { "http://www.w3.org/2003/g/data-view#", "http://example.org/this-to-that"
>>> ...
>>> }
>>> 
>>> At http://example.org/this-to-that you have the definition of how to take this arbitrary JSON and make it a citizen of the Web.
>>> 
>>> I'll say again, you might well just want to bin this if such things have been dealt with already.
>>> But it did strike me that in practice, I was facing horrible stuff to look at. Please remember RDF/XML's role in adoption.
>>>   
>>> Cheers,
>>> Danny.
>>> 
>>> [1] https://www.w3.org/TR/grddl/
>>> 
>>> * yeah, I was on the GRDDL Working Group. Memory totally gone over my contributions, but in these things I generally only offer /wrong/ arguments (realise years later), which post-factum I convince myself are useful to get the people with their heads screwed on to look at things more closely. 
>>> I'm still a little irritated I didn't get a credit in the doc, I poked Dan Connolly and he said he's sort it, Didn't. It did mean something to me, one of the very few things I've been involved with which had a very pleasing end product (even if absolutely no-one uses it). 
>>>  
>>> I should also confess I was mouthy in the JSON-LD group at the start, but quietly shuffled away when I realised the other folks had magnitudes better grasp.  
>>> 
>>> --
>>> ----
>>> 
>>> https://hyperdata.it <http://hyperdata.it/danja>
>>> 
> 
> 
> --
> ----
> 
> https://hyperdata.it <http://hyperdata.it/danja>
> 

Received on Friday, 9 February 2024 23:03:50 UTC