Skip to content

Commit 5a80d73

Browse files
committed
docs: Update collection documentation
1 parent c0af5be commit 5a80d73

1 file changed

Lines changed: 20 additions & 48 deletions

File tree

documentation/collections.md

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,30 @@ When registering a resource,
6262
the UMA server immediately generates all necessary triples to keep track of all collections a resource is part of.
6363
First it generates the necessary asset collections based on the `resource_defaults` field,
6464
and then generate the relation triples based on the `resource_relations` field.
65-
With the example above, the following triples would be generated:
6665

66+
Assuming a resource `my:parent:resource` is registered with a `http://www.w3.org/ns/ldp#contains` `resource_default`,
67+
the following triples would be generated:
6768
```ttl
6869
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.
6970
@prefix odrl_p: <https://w3id.org/force/odrl3proposal#>.
7071
71-
<urn:1:2:3> a odrl:AssetCollection ;
72-
odrl:source <my:new:resource> ;
72+
<collection:my:parent:resource:http://www.w3.org/ns/ldp#contains> a odrl:AssetCollection ;
73+
odrl:source <my:parent:resource> ;
7374
odrl_p:relation <http://www.w3.org/ns/ldp#contains> .
75+
```
76+
If the relation was reversed, the relation object would be `[ owl:inverseOf <http://www.w3.org/ns/ldp#contains> ]`.
7477

75-
<my:new:resource> odrl:partOf <collection:12345> ;
76-
odrl:partOf <collection:5678:reverse> .
78+
79+
Then, if another resource, `my:new:resource` is registered,
80+
with a reverse `http://www.w3.org/ns/ldp#contains` relation targeting `my:parent:resource`,
81+
the following additional triple would be generated:
82+
```ttl
83+
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.
84+
<my:new:resource> odrl:partOf <collection:my:parent:resource:http://www.w3.org/ns/ldp#contains> .
7785
```
78-
This assumes that the collection IDs used above, `collection:12345` and `collection:5678:reverse`, already exist.
79-
If these collections were not yet generated,
80-
the registration request would fail with an error.
81-
All these triples then get passed to the ODRL evaluator when policies need to be processed.
86+
87+
All these triples get passed to the ODRL evaluator when policies need to be processed.
8288
Any policy that targets a collection ID will apply to all resources that are part of that collection.
83-
If the relation was reversed, the relation object would be `[ owl:inverseOf <http://www.w3.org/ns/ldp#contains> ]`.
8489

8590
### Finding collection identifiers
8691

@@ -131,45 +136,12 @@ The Resource Server informs the UMA server of the identifiers by using the `name
131136

132137
### Asset Collection identifiers
133138

134-
For asset collections, there is a similar problem where the user doesn't know which identifiers to use.
135-
To work around this,
136-
users can create their own asset collections and add them to policies.
137-
Take the following policy for example:
138-
139-
```ttl
140-
@prefix ex: <http://example.org/> .
141-
@prefix ldp: <http://www.w3.org/ns/ldp#>.
142-
@prefix odrl: <http://www.w3.org/ns/odrl/2/>.
143-
@prefix odrl_p: <https://w3id.org/force/odrl3proposal#>.
144-
145-
<urn:uuid:e30bcd34-0d5c-43d1-b229-bf68afcae5ae> a odrl:Set ;
146-
odrl:uid <urn:uuid:e30bcd34-0d5c-43d1-b229-bf68afcae5ae> ;
147-
odrl:permission <urn:uuid:f4cb5007-e834-4a9c-a62a-091891350c04> .
148-
149-
<urn:uuid:f4cb5007-e834-4a9c-a62a-091891350c04> a odrl:Permission ;
150-
odrl:assignee ex:alice ;
151-
odrl:action odrl:read ;
152-
odrl:target ex:assetCollection .
153-
154-
ex:assetCollection a odrl:AssetCollection ;
155-
odrl:source <http://localhost:3000/container/> ;
156-
odrl_p:relation ldp:contains .
157-
```
158-
159-
The above policy gives Alice read permission on all resources in `http://localhost:3000/container/`.
160-
Here the user chose the identifier `ex:assetCollection` for the collection with the given parameters.
161-
When new resources are registered,
162-
the UMA server will detect that this collection already exists,
163-
and use that identifier for the new metadata triples.
164-
It is important that this definition already exists in the policies before any resources get registered to it,
165-
so this solution is better for static policy solutions,
166-
where all policies are already defined on server initialization.
167-
The server will error if there are multiple asset collections with the same parameters,
168-
so make sure to only define identifier per combination.
139+
[As mentioned above](#finding-collection-identifiers), there is no API yet for accessing collections,
140+
so a fixed URI format is used for automatically generated collections.
169141

170142
### Parent containers not yet registered
171143

172-
Resource registration happens asynchronously.
144+
Resource registration happens asynchronously in the CSS RS implementation.
173145
As a consequence, it is possible when registering a resource,
174146
that the registration of its parent container was not yet completed.
175147
This is a problem since the UMA ID of this parent is necessary to link to the correct relation.
@@ -180,7 +152,7 @@ where the registration is updated with the now available parent UMA ID.
180152

181153
### Accessing resources before they are registered
182154

183-
An additional consequence of asynchronous resource registration,
155+
An additional consequence of asynchronous resource registration in the CSS RS,
184156
is that a client might try to access a resource before its registration is finished.
185157
This would cause an error as the Resource Server needs the UMA ID to request a ticket,
186158
but doesn't know it yet.
@@ -190,7 +162,7 @@ A timeout is added to prevent the connection from getting stuck should something
190162

191163
### Policies for resources that do not yet exist
192164

193-
When creating a new resource on the RS, using PUT for example,
165+
When creating a new resource on the CSS RS, using PUT for example,
194166
it is necessary to know if that action is allowed.
195167
It is not possible to generate a ticket with this potentially new resource as a target though,
196168
as it does not have an UMA ID yet.

0 commit comments

Comments
 (0)