@@ -210,27 +210,35 @@ private function handle(string $method, string $path, $contents, $request): Resp
210210 } else {
211211 $ filename = $ this ->guid ();
212212 }
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 );
226218 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 );
230240 break ;
231241 }
232-
233- $ response = $ this ->handleCreateRequest ($ response , $ path . $ filename , $ contents );
234242 } else {
235243 $ response = $ this ->handleUpdateRequest ($ response , $ path , $ contents );
236244 }
@@ -275,9 +283,7 @@ private function handleSparqlUpdate(Response $response, string $path, $contents)
275283
276284 try {
277285 // 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 );
281287 // FIXME: Use enums from namespace Pdsinterop\Rdf\Enum\Format instead of 'turtle'?
282288
283289 // parse query in contents
0 commit comments