Re: Parsing hydra as RDF graph

On 2016-10-02 11:46, GoutisD wrote:
> Firstly, i'm new to all these, so i may have made some wrong assumptions.
> At github my name is cr3a7ure, so you can find the apidoc here
>  (https://github.com/api-platform/api-platform/issues/142 )
>
> I made the assumption that the apidoc contains most of the information
> about the server. So if i could parse it as an RDF graph, i'd have
> everything to properly query the server.
> I'm wondering, is this true?

This is true down to the expressiveness of the hypermedia descriptions. 
In other words, you can hit limitation of Hydra. Otherwise, yes, the 
server should give you enough information.

>
> so what we have is BlankNode_23 ---> '@type' ---> "hydra:SupportedProperty"
> etc, meaning that it would be difficult to check the hydra properties
> [title,required,readable,writable].
>

This is right. In turtle you would have

_:blank rdf:type hydra:SupportedProperty .

See for example how the JSON-LD you pasted is converted to NQuads in the 
JSON-LD playground [1].

What makes it difficult to check the properties? I don't see how the 
blank node in you snippet should be a problem.

>
> As far as blank nodes, @rdflib.js i got this:
>
> Sarven Capadisli @csarven 15:19
> @cr3a7ure *You should not merge bnodes with the same name, and you can't
> refer to them*. bnodes are local names in a uniquely resolved graph
> (that's the scope they are in) and named at the discretion of a
> serialiser. They are different than global identifiers which can be
> referenced (e.g., URI) and resolved (e.g., HTTP URI). bnodes can be
> explicitly named but they are not guaranteed to stick around i.e., once
> the document is reserialised, they may be renamed. Lastly, because they
> are just local names and ephemeral, bnodes with the same name in two
> different resources are not necessarily the same and should not be
> treated equal.
>
> What do you think about all that?
> I'd like to query the rdf graph for those properties instead of parsing
> the apidoc as a js object.
> I think i made my point clear.
>

Having loaded the JSON-LD into rdflib.js it shouldn't really matter if 
you get blank nodes or URIs. What Sarven writes is true. The names of 
you blank nodes are local to a single document. But when referenced 
multiple times in that document, a given name will represent the very 
same node.

Hope this helps a little.

Tom

PS
Please send emails in plain text

[1]: http://tinyurl.com/j7hwxks

Received on Sunday, 2 October 2016 10:59:01 UTC