Hi Nandana, Sergio,

I found out what the problem was: I didn't specify the right content-type:

Adding:

-H "Content-Type: text/turtle"

makes it work!

Adding the Link header to enforce the interaction model doesn't seem to be
necessary.

Cheers,
Reto


On Mon, Jul 7, 2014 at 7:52 AM, Sergio Fernández <[email protected]> wrote:

> In addition, LDPCs are also create when adding the first member. So you
> can post to http://localhost:8080/ldp/example and that container will be
> created.
>
> For the moment we're only supporting basic containers. The implementation
> of other types is planned for summer, one we get stable the W3C test suite.
> Further details at the latest implementation report (soon we'll publish a
> new one based on the new code at the ldp branch): http://wiki.apache.org/
> marmotta/LDPImplementationReport/2014-03-11
>
> Cheers,
>
>
>
> On 05/07/14 01:00, Nandana Mihindukulasooriya wrote:
>
>> Hi Reto,
>>
>> Few things apart from the Marmotta behavior. If you want to create a
>> Container, you should specify the interaction model you want using a Link
>> header. That is what the server has to honour not the type mentioned in
>> the
>> POSTed content [1].
>>
>> So the request should be
>>
>> curl -D -X POST -H "Link: <http://www.w3.org/ns/ldp/BasicContainer>;
>> rel='type'" --data @simpleldpc.ttlhttp://localhost:8080/ldp
>>
>> In addition, the DirectContainer that you post is invalid. According to
>> 5.4.1.3 ~ 5.4.1.5 [2] , a Direct Container MUST define
>> ldp:membershipResource and (ldp:hasMemberRelation/ldp:
>> isMemberOfRelation).
>> However, IMO the implementations have the freedom to add those triples on
>> creation time of the container, so it might be valid to POST a partial
>> representation of a container if the servers adds the necessary triples on
>> creation.
>>
>> Best Regards,
>> Nandana
>>
>> [1] http://www.w3.org/TR/ldp/#ldpc-post-createrdf
>> [2] http://www.w3.org/TR/ldp/#ldpdc-containres
>>
>>
>>
>>
>> On Fri, Jul 4, 2014 at 10:37 PM, Reto Gmür <[email protected]> wrote:
>>
>>  Hi,
>>>
>>> Playing around with marmotta I tried to create a new LDPC.
>>>
>>> I describe my  container in a file
>>>
>>> $ cat simpleldpc.ttl
>>> @prefix dct: <http://purl.org/dc/terms/> .
>>> @prefix ldp: <http://www.w3.org/ns/ldp#>.
>>>
>>> <.> a ldp:DirectContainer ;
>>>      sct:title "My first LDPC" .
>>>
>>>
>>> Post this to the container which is there by default at
>>> http://localhost:8080/ldp
>>>
>>> $ curl -D - -X POST --data @simpleldpc.ttl http://localhost:8080/ldp
>>> HTTP/1.1 201 Created
>>> Server: Apache Marmotta/3.3.0-SNAPSHOT (build 2+)
>>> Last-Modified: Fri, 04 Jul 2014 20:25:07 GMT
>>> ETag: W/"1404505507000"
>>> Location: http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3
>>> Link: <https://wiki.apache.org/marmotta/LDPImplementationReport/2014-
>>> 03-11
>>>
>>>> ;
>>>>
>>> rel="describedby"
>>> Link: <http://www.w3.org/ns/ldp#Container>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#BasicContainer>; rel="type"
>>> Content-Length: 0
>>> Date: Fri, 04 Jul 2014 20:25:07 GMT
>>>
>>>
>>> looks good to me, let's access the newly created resource:
>>>
>>> $ curl -D - http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-
>>> 48ad445d86d3
>>> HTTP/1.1 200 OK
>>> Server: Apache Marmotta/3.3.0-SNAPSHOT (build 2+)
>>> Last-Modified: Fri, 04 Jul 2014 20:25:07 GMT
>>> ETag: "e7fbd1bca63f04ca23b8f0092b5c2f3"
>>> Link: <https://wiki.apache.org/marmotta/LDPImplementationReport/2014-
>>> 03-11
>>>
>>>> ;
>>>>
>>> rel="describedby"
>>> Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#NonRDFSource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="meta"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="describedby"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="content"
>>> Content-Type: text/turtle
>>> Transfer-Encoding: chunked
>>> Date: Fri, 04 Jul 2014 20:26:19 GMT
>>>
>>> @prefix ldp: <http://www.w3.org/ns/ldp#> .
>>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>>> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>>> @prefix dcterms: <http://purl.org/dc/terms/> .
>>> @prefix : <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-
>>> 48ad445d86d3>
>>> .
>>>
>>> <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>
>>> ldp:interactionModel ldp:Container ;
>>>      a ldp:Resource , ldp:NonRDFSource , ldp:RDFSource ;
>>>      dcterms:modified "2014-07-04T20:25:07.000Z"^^xsd:dateTime ;
>>>      dcterms:created "2014-07-04T20:25:07.000Z"^^xsd:dateTime ;
>>>      dcterms:isFormatOf <
>>> http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3> ;
>>>      dcterms:hasFormat <
>>> http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3> ;
>>>      dcterms:format "application/x-www-form-urlencoded" .
>>>
>>>
>>> The new resource has none of the two properties in the posted file. But
>>> it
>>> is both an ldp:RDFSource and an ldp:NonRDFSource!
>>>
>>> Let's see if it can nonetheless be used as a container, posting something
>>> against it:
>>>
>>> $ curl -D - -X POST --data @simplecontainer.ttl
>>> http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3
>>> HTTP/1.1 405 Method Not Allowed
>>> Server: Apache Marmotta/3.3.0-SNAPSHOT (build 2+)
>>> Last-Modified: Fri, 04 Jul 2014 20:25:07 GMT
>>> ETag: "e7fbd1bca63f04ca23b8f0092b5c2f3"
>>> Link: <https://wiki.apache.org/marmotta/LDPImplementationReport/2014-
>>> 03-11
>>>
>>>> ;
>>>>
>>> rel="describedby"
>>> Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#NonRDFSource>; rel="type"
>>> Link: <http://www.w3.org/ns/ldp#RDFSource>; rel="type"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="meta"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="describedby"
>>> Link: <http://localhost:8080/ldp/f1f7816b-c90f-4b6e-aa76-48ad445d86d3>;
>>> rel="content"
>>> Content-Type: application/octet-stream
>>> Content-Length: 36
>>> Date: Fri, 04 Jul 2014 20:31:39 GMT
>>>
>>> POST to NonRdfSource is not allowed
>>>
>>>
>>> So creating an LDPC this way doesn't seem to work, instead I'm having
>>> quite
>>> a weird resource lacking all the originally posted triples.
>>>
>>> Why this behavior? What is the recommended way to create new LDPC in
>>> marmotta?
>>>
>>> Cheers,
>>> Reto
>>>
>>>
>>
> --
> Sergio Fernández
> Partner Technology Manager
> Redlink GmbH
> m: +43 660 2747 925
> e: [email protected]
> w: http://redlink.co
>

Reply via email to