- From: Dietrich Schulten <ds@escalon.de>
- Date: Tue, 03 Feb 2015 14:38:25 +0100
- To: public-hydra@w3.org
Hi, Am 25.01.2015 um 23:31 schrieb Markus Lanthaler: > On 25 Jan 2015 at 22:08, Dietrich Schulten wrote: >>>> But is there a way to express that the above also entails >>>> >>>> </alice> foaf:knows </bob> >>>> </alice> foaf:knows </zelda> >>>> >>>> ? >>> >>> Sure, just add those triples :-) >> >> Yay, I'll gladly duplicate all members :o) > > You don't duplicate anything here. Depending on how you look at it, you add > new statements (triples) or you draw new connections into the graph. > I am still unsure how to implement the new collection design in hydra-java. I have three questions, I hope you can help to clarify my doubts. 1. On the Alice resource, how do I express that she has friends assuming that I want to have an Alice resource and a separate resource containing a list of her friends represented as a hydra:Collection? I think the answer is to say that Alice has collections, and each collection states that it manages a property for a subject or an object: { "@id": "/alice", "collection": [ { "@id": "/alice/friends", "@type": "Collection", "manages": { "property": "foaf:knows", "subject": "/alice" } } ] } However, it breaks the :knows relationship if I would say the following, given that /alice/friends points to a hydra:Collection rather than a plain set of foaf:Person. { "@id": "/alice", "foaf:knows": { "@id": "/alice/friends" } } Correct? 2. What I could do is to embed the friends using the :knows property. What I gain by this is that I can express information about the :knows collection such as a search property or supported operations on /alice/friends. At the same time, we also state that Alice :knows someone. { "@id": "/alice", "foaf:name": "Alice", "collection": [ { "@id": "/alice/friends", "@type": "Collection", "manages": { "property": "foaf:knows", "subject": "/alice" }, "search" : ... an iritemplate, "operation" : ... supportedOperations ], "foaf:knows": [ {"@id":"/bob", "foaf:name": "Robert Rumbaugh"}, {"@id":"/zelda", "foaf:name": "Zelda Zackney"} ] } As an alternative, I could also use hydra:member on the :Collection to embed the friends, but in that case I do not assert that Alice :knows someone - unless I use an additional construct which makes that connection. Correct? 3. On to the other side of the picture, the separate collection of friends. The Alice resource points to it using the construct from 1. above. { "@id": "/alice/friends", "@type": "Collection", "manages": { "property": "foaf:knows", "subject": "/alice" }, "member": [ {"@id":"/bob", "foaf:name": "Robert Rumbaugh"}, {"@id":"/zelda", "foaf:name": "Zelda Zackney"} ] } Question: How to materialize the :knows relationship? When pointing to a separate resource which looks like the one above, I understood that I can leave the value of Alice :knows undefined "because it is trivial for the server to materialize those triples". Or, as an alternative: "We *could* also define "manages" in a way that would allow a reasoner to infer these triples automatically". Did you in fact mean that as an alternative a) server materializes the :knows triples - or b) we define :manages so that the reasoner can infer the :knows triples ? ad a) Exactly how would that work? Example: Client has /alice without a :knows attribute and it wants to find out if :knows has any value. How does the client learn which request it should send to the server? What is the server response which materializes the :knows triples for the client? It would have the advantage that clients do not need a reasoner to work with hydra responses. ad b) If we do not define :manages in that way, we leave it as an exercise to server implementers to add these assertions in their ApiDocumentation. OTOH, even if we do define it that way, clients would have to fire up a reasoner to work with collection properties, so it won't always help. To me, a) appears preferable, although I have no idea what you mean by "materialize triples". Outside the world of Linked Data, and based on the Web Linking RFC alone, it would mean the server offers an extension rel such as ex:knows on the Alice resource which has a href that returns a list of people. But that is exactly what I cannot do, hence my confusion. Best regards, Dietrich
Received on Tuesday, 3 February 2015 13:39:09 UTC