RE: framing and @reverse - java implementation proposal

Hi Philippe,

On Monday, July 28, 2014 5:16 PM, Philippe Duchesne wrote:
> I am using jsonld-java in a project to expose content of a triple
> store to a webapp using a legacy JSON object structure. To achieve
> that, i use framing, and I need a context with @reverse properties.

Cool. Would be cool if you could provide a link to that app.


> I have implemented two features for which I would like to get feedback
> from this mailing list : 
> 1. the support for @reverse properties in the framing algorithm
> implementation

Great. I had that on my to do list for quite some time now but haven't found the time to implement it yet. This is definitely something we'll need to support.


>  2. an extension of the compacting algorithm to allow the definition
>  of multiple reverse statements for the same property, but different
>  target types

What exactly do you mean by target?

  (A) <---- reverse of property --- (B)

Is (A) the "target" or (B)? If it is (B) the value of the property in JSON, then there's only one possible type, namely a IRI.


> In particular, the second feature involves an extension of the spec
> that re-uses the @type property of reverse statements. I would need
> confirmation from people with a deeper understanding of the spec that
> this is a correct approach.
> 
> These features are available in the fork
> https://github.com/pduchesne/jsonld-java/tree/FRAMING_REVERSE .
> Tests for both features are in
> https://github.com/pduchesne/jsonld-java/blob/FRAMING_REVERSE/core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java .
> Inputs, frames and outputs for both tests are in
> https://github.com/pduchesne/jsonld-java/tree/FRAMING_REVERSE/core/src/test/resources/custom (framing-reverse-*.jsonld) .

The second feature is covered in

https://github.com/pduchesne/jsonld-java/blob/FRAMING_REVERSE/core/src/test/resources/custom/framing-reverse-0002-frame.jsonld

but I don't see why you need to "change the compaction algorithm" or the context for that matter if you are specifying the type inline anyway:

   articles": {"@reverse":"ex:containedIn", "@container": "@set", "@type": "ex:Article"},

and

    "articles": {
        "@type": "ex:Article"
    }

are both kind of saying the same thing. So why do you include ex:Article in the context as well (the resulting document includes @type: ex:Article as well)? Anyway, using @type this way is incorrect. In the context, @type can just be used to set the type of literals, i.e., strings. You can't use it to type nodes (objects).


Cheers,
Markus


--
Markus Lanthaler
@markuslanthaler

Received on Wednesday, 30 July 2014 01:36:14 UTC