HydraCG / Specifications

Specifications created by the Hydra W3C Community Group
Other
138 stars 26 forks source link

Adding already existing resources as collection members #134

Open elf-pavlik opened 6 years ago

elf-pavlik commented 6 years ago

Currently in our Use Cases we only have situation where we 5. Create a new event using operation advertised by the collection of events, which automatically adds it to that collection.

I would like to add use case of adding already existing resources to collections. For example if we have People in this API, each person could reference a 'personal collection of events' using hydra:collection. But we wouldn't want to create new events in that collection but instead just add already existing events. Possibly using schema:AddAction rather than schema:CreateAction.

What would such action reference with hydra:expects? It pretty much just needs an @id which should get added to hydra:member of that collection.

Once we roughly agree on approach to that I will make PR with this additional use case!

This issue somehow reminds me of https://tools.ietf.org/id/draft-snell-link-method-01.html

@RubenVerborgh do you know how currently Solid handles that? Probably it wouldn't use ldp:Container but just ldp:Resource to represent such collection and add statements with hydra:member using HTTP PATCH

alien-mcl commented 6 years ago

I'm trying to implement #141 and I've ended up with targetUrl for now.

asbjornu commented 6 years ago

@elf-pavlik: I agree, let's discuss this in #3. If we agree on target, I think it can look like this:

{
  "@context": { ... },
  "@id": "/videos/144522067",
  "operation": [
    {
      "@type": ["hydra:Operation", "foo:Like"],
      "method": "PUT",
      "target": "/users/elfpavlik/likes/144522067"
    }
  ]
}

I'd like something more align with manages block, which in turn works very much like rel and rev in link relations or ldp:hasMemberRelation & ldp:isMemberOfRelation https://www.w3.org/ns/ldp

I'm sorry, but I don't really understand what this means. Can you please elaborate?

elf-pavlik commented 6 years ago

I'm sorry, but I don't really understand what this means. Can you please elaborate?

To put it the simples: 1) given existing instance of rdf:Property, for example sor:likes 2) i want to relate two resources using that property, for example </users/elfpavlik> sor:likes </videos/144522067> 3) I do NOT want to define any action (an instance ofrdf:Class)foo:Likeand just rely on that already existing instance ofrdf:Property-sor:likes`

If we have collections with hydra:manages block as describes in Hydra Collection Design. The hydra:manages block relies on an instance of rdf:Propery. Possibly if such collection with hydra:manages advertises schema:AddAction we could define it as adding a triple based on that hydra:manages block and wouldn't need to repeat such triple pattern it in the operation.

asbjornu commented 6 years ago

I see. I think I've been overly confused every time manages has been mentioned because I haven't registered the discussion about it on the Collection Design page. Thanks for that reference! Just to input my opinion on that matter, I think manages is a bad name and that contains much more clearly and intuitively convey its function and semantics.

Now that I understand what this manages aka contains concept actually is, I can move on to attempt to understand what it is you want from this feature. Please excuse my RDF illiteracy. Is what you're asking for both a way to convey a rel-like action to the client as well as the RDF concept </users/elfpavlik> sor:likes </videos/144522067>?