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

Commit bb1d331

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

File tree

1 file changed

+22
-49
lines changed

1 file changed

+22
-49
lines changed

api-rest.md

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

61-
#### Globbing (inlining on GET)
61+
#### Globbing (concatenate RDF files in a container on GET)
6262

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.
63+
To optimize certain applications,
64+
you can aggregate all RDF resources within a container
65+
and retrieve them with a single `GET` operation.
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+
Performing a `GET` on a URL ending in `/*`
70+
will return an aggregate view of all RDF resources of the corresponding container.
7171

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:
72+
For example, consider a container `/data` that contains the following files:
73+
- `file1.ttl`
74+
- `file2.ttl`
75+
- `res3.txt`
7476

75-
For *res1*:
77+
Let's assume that `/data/file1.ttl` and `/data/file2.ttl`
78+
contain one triple each:
7679

7780
```ttl
78-
<> a <https://example.org/ns/type#One> .
81+
<file1.ttl> a <https://example.org/ns/type#One> .
7982
```
8083

81-
For *res2*:
82-
8384
```ttl
84-
<> a <https://example.org/ns/type#Two> .
85-
```
86-
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
85+
<file2.ttl> a <https://example.org/ns/type#Two> .
9686
```
9787

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:
88+
Then a request to `/data/*`
89+
will return the union of the datasets in `file1.ttl` and `file2.ttl`:
11590

11691
```http
11792
GET /data/* HTTP/1.1
11893
Host: example.org
11994
```
12095

121-
RESPONSE:
122-
12396
```http
12497
HTTP/1.1 200 OK
12598
```
12699
```ttl
127100
<>
128101
a <http://www.w3.org/ns/ldp#BasicContainer> ;
129-
<http://www.w3.org/ns/ldp#contains> <res1>, <res2> .
102+
<http://www.w3.org/ns/ldp#contains> <file1.ttl>, <file2.ttl> .
130103
131-
<res1>
104+
<file1.ttl>
132105
a <https://example.org/ns/type#One> .
133106
134-
<res2>
107+
<file2.ttl>
135108
a <https://example.org/ns/type#Two> .
136109
```
137110

0 commit comments

Comments
 (0)