@@ -210,27 +210,35 @@ private function handle(string $method, string $path, $contents, $request): Resp
210
210
} else {
211
211
$ filename = $ this ->guid ();
212
212
}
213
- // FIXME: make this list complete for at least the things we'd expect (turtle, n3, jsonld, ntriples, rdf);
214
- switch ($ contentType ) {
215
- case '' :
216
- // FIXME: if no content type was passed, we should reject the request according to the spec;
217
- break ;
218
- case "text/plain " :
219
- $ filename .= ".txt " ;
220
- break ;
221
- case "text/turtle " :
222
- $ filename .= ".ttl " ;
223
- break ;
224
- case "text/html " :
225
- $ filename .= ".html " ;
213
+
214
+ $ link = $ request ->getHeaderLine ("Link " );
215
+ switch ($ link ) {
216
+ case '<http://www.w3.org/ns/ldp#BasicContainer>; rel="type" ' :
217
+ $ response = $ this ->handleCreateDirectoryRequest ($ response , $ path . $ filename );
226
218
break ;
227
- case "application/json " :
228
- case "application/ld+json " :
229
- $ filename .= ".json " ;
219
+ default :
220
+ // FIXME: make this list complete for at least the things we'd expect (turtle, n3, jsonld, ntriples, rdf);
221
+ switch ($ contentType ) {
222
+ case '' :
223
+ // FIXME: if no content type was passed, we should reject the request according to the spec;
224
+ break ;
225
+ case "text/plain " :
226
+ $ filename .= ".txt " ;
227
+ break ;
228
+ case "text/turtle " :
229
+ $ filename .= ".ttl " ;
230
+ break ;
231
+ case "text/html " :
232
+ $ filename .= ".html " ;
233
+ break ;
234
+ case "application/json " :
235
+ case "application/ld+json " :
236
+ $ filename .= ".json " ;
237
+ break ;
238
+ }
239
+ $ response = $ this ->handleCreateRequest ($ response , $ path . $ filename , $ contents );
230
240
break ;
231
241
}
232
-
233
- $ response = $ this ->handleCreateRequest ($ response , $ path . $ filename , $ contents );
234
242
} else {
235
243
$ response = $ this ->handleUpdateRequest ($ response , $ path , $ contents );
236
244
}
@@ -275,9 +283,7 @@ private function handleSparqlUpdate(Response $response, string $path, $contents)
275
283
276
284
try {
277
285
// Assuming this is in our native format, turtle
278
- // @CHECKME: Does the Graph Parse here also need an URI?
279
- $ graph ->parse ($ data , "turtle " );
280
- // FIXME: Adding this base will allow us to parse <> entries; , $this->baseUrl . $this->basePath . $path), but that breaks the build.
286
+ $ graph ->parse ($ data , "turtle " , $ this ->baseUrl . $ path );
281
287
// FIXME: Use enums from namespace Pdsinterop\Rdf\Enum\Format instead of 'turtle'?
282
288
283
289
// parse query in contents
0 commit comments