Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit 8d0ee13

Browse files
committed
Restrict globbing to /*
Closes #147.
1 parent fbec741 commit 8d0ee13

File tree

1 file changed

+39
-52
lines changed

1 file changed

+39
-52
lines changed

api-rest.md

+39-52
Original file line numberDiff line numberDiff line change
@@ -58,85 +58,72 @@ HTTP/1.1 200 OK
5858
<http://www.w3.org/ns/posix/stat#size> "780" .
5959
```
6060

61-
#### Globbing (inlining on GET)
62-
63-
We have found that in some cases, using the existing LDP features was not
64-
enough. For instance, to optimize certain applications we needed to aggregate
65-
all RDF resources from a container and retrieve them with a single GET
66-
operation. We implemented this feature on the servers and decided to call it
67-
"globbing". Similar to [UNIX shell
68-
glob](https://en.wikipedia.org/wiki/Glob_(programming)), doing a GET on any URI
69-
which ends with a `*` will return an aggregate view of all the resources that
70-
match the indicated pattern.
71-
72-
For example, let's assume that `/data/res1` and `/data/res2` are two resources
73-
containing one triple each, which defines their type as follows:
74-
75-
For *res1*:
61+
#### Globbing (`GET` the merged RDF graph of a container)
62+
63+
To optimize certain applications,
64+
this specification defines a single `GET` operation
65+
that provides access to an aggregation of the RDF resources in a container.
66+
We refer to this feature as _globbing_,
67+
since it provides a subset of the functionality
68+
offered by the [UNIX shell glob](https://en.wikipedia.org/wiki/Glob_(programming)).
69+
Consider a container to which the user has _Read_ access,
70+
which will have a URL ending in `/`.
71+
If we append a `*` to that URL (so it ends in `/*`),
72+
we obtain the URL of a resource that,
73+
in response to a `GET` request,
74+
returns the [RDF graph merge](https://www.w3.org/TR/rdf-mt/#graphdefs)
75+
of all of the container's direct child resources
76+
that are available in an RDF format
77+
and for which the user has _Read_ access.
78+
Resources with syntax errors can be ignored or be partially included,
79+
but they do not cause a failure.
80+
The response can contain additional metadata about the container,
81+
such as the list of resources.
82+
83+
For example, consider a container `/data` that contains the following resources:
84+
- `resource1.ttl`
85+
- `resource2.ttl`
86+
- `hidden3.ttl`
87+
- `resource4.txt`
88+
89+
The user performing the request had read access to `/data`,
90+
`resource1.ttl` and `resource2.ttl`,
91+
but not to `hidden3.ttl`.
92+
Let's assume that `/data/resource1.ttl` and `/data/resource2.ttl`
93+
contain one triple each:
7694

7795
```ttl
7896
<> a <https://example.org/ns/type#One> .
7997
```
8098

81-
For *res2*:
82-
8399
```ttl
84100
<> a <https://example.org/ns/type#Two> .
85101
```
86102

87-
If one would like to fetch all resources of a container beginning with `res`
88-
(e.g. `/data/res1`, `/data/res2`) in one request, they could do a GET on
89-
`/data/res*` as follows.
90-
91-
REQUEST:
92-
93-
```http
94-
GET /data/res* HTTP/1.1
95-
Host: example.org
96-
```
97-
98-
RESPONSE:
99-
100-
```http
101-
HTTP/1.1 200 OK
102-
```
103-
```ttl
104-
<res1>
105-
a <https://example.org/ns/type#One> .
106-
107-
<res2>
108-
a <https://example.org/ns/type#Two> .
109-
```
110-
111-
Alternatively, one could ask the server to inline *all* resources of a
112-
container, which includes the triples corresponding to the container itself:
113-
114-
REQUEST:
103+
Then a request to `/data/*`
104+
will return a serialization of the [RDF graph merge](https://www.w3.org/TR/rdf-mt/#graphdefs)
105+
of the datasets contained in `resource1.ttl` and `resource2.ttl`:
115106

116107
```http
117108
GET /data/* HTTP/1.1
118109
Host: example.org
119110
```
120111

121-
RESPONSE:
122-
123112
```http
124113
HTTP/1.1 200 OK
125114
```
126115
```ttl
127116
<>
128117
a <http://www.w3.org/ns/ldp#BasicContainer> ;
129-
<http://www.w3.org/ns/ldp#contains> <res1>, <res2> .
118+
<http://www.w3.org/ns/ldp#contains> <resource1.ttl>, <resource2.ttl> .
130119
131-
<res1>
120+
<resource1.ttl>
132121
a <https://example.org/ns/type#One> .
133122
134-
<res2>
123+
<resource2.ttl>
135124
a <https://example.org/ns/type#Two> .
136125
```
137126

138-
Note: the aggregation process is not currently recursive, therefore it will not
139-
apply to children containers.
140127

141128
### Alternative: using SPARQL
142129

0 commit comments

Comments
 (0)