During experimentation with PUT operation, I broke the internal workings ...
Given the size of the mess I have created, it seems like we need some mechanism to prevent "accidents" happening ... options:
(A) make sure that important properties required for the successful operation of the registry are persisted and/or protected from external change,
(B) don't allow the PUT operation.
Also, I am not sure if this sorry tale indicates some bugs to resolve.
Here's the history of events:
- Initial creation of sub-register "codes"
file: codes-post.ttl
@Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
@Prefix reg: http://purl.org/linked-data/registry# .
@Prefix ldp: http://www.w3.org/ns/ldp# .
a reg:Register , ldp:Container ;
rdfs:label "codes"
@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
.
Action:
curl -i -H "Content-Type:text/turtle" -H "Accept:text/plain" -X POST --data "@codes-post.ttl" http://ukgovld-registry.dnsalias.net/
I notice that I forgot to add the description ... so
- Amend /codes sub-register with additional description ...
file: codes-patch.ttl
@Prefix dct: http://purl.org/dc/terms/ .
http://ukgovld-registry.dnsalias.net/codes
dct:description "Root (sub-)register for WMO code-tables"@en .
Action:
curl -i -H "Content-Type:text/turtle" -H "Accept:text/plain" -X PATCH --data "@codes-patch.ttl" http://ukgovld-registry.dnsalias.net/codes?non-member-properties
So far, everything is still fine :-) ...
/codes is as follows:
http://ukgovld-registry.dnsalias.net/codes
a reg:Register , ldp:Container ;
rdfs:label "codes"@en ;
dct:description "Root (sub-)register for WMO code-tables"@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
owl:versionInfo 2 .
but then I experimented to see what would happen with a PUT where the payload was missing triples; I wanted to see if properties like owl:versionInfo, rdf:type and reg:containedItemClass were "persistent" properties that couldn't be changed.
- Update /codes sub-register with partial payload ...
file: codes-put.ttl
@Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
@Prefix dct: http://purl.org/dc/terms/ .
http://ukgovld-registry.dnsalias.net/codes
rdfs:label "CODES"@en ;
dct:description "Root (sub-)register for WMO code-tables"@en ;
.
Action:
curl -i -H "Content-Type:text/turtle" -H "Accept:text/plain" -X PUT --data "@codes-put.ttl" http://ukgovld-registry.dnsalias.net/codes?non-member-properties
Response:
HTTP/1.1 204 No Content
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 17:00:19 GMT
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/_codes:3
... which didn't throw me any surprises; I thought that things had worked. However the Action:
curl -i -H "Accept:text/turtle" http://ukgovld-registry.dnsalias.net/codes
... yielded the following triples:
http://ukgovld-registry.dnsalias.net/codes
a reg:Register , ldp:Container ;
rdfs:label "codes"@en ;
dct:description "Root (sub-)register for WMO code-tables"@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
owl:versionInfo 2 .
As you can see, the label has not been updated to "CODES" so I wondered if PATCH was working, so I tried to apply the change to the label property again ...
- Amend /codes with new label (PATCH)
file: codes-patch2.ttl
@Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
http://ukgovld-registry.dnsalias.net/codes
rdfs:label "CODES"@en .
Action:
curl -i -H "Content-Type:text/turtle" -H "Accept:text/plain" -X PATCH --data "@codes-patch2.ttl" http://ukgovld-registry.dnsalias.net/codes?non-member-properties
Response:
HTTP/1.1 204 No Content
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 17:04:19 GMT
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/_codes:4
Again, we see the version number of the register item increment ... this time I checked the result in the browser; not looking good ...
Oops: Internal error (500)
Sorry but an internal error has occurred.
$response.entity
So I tried to fix the problem by updating /codes once more with all the properties that were included in version 2 ... with the exception of owl:versionInfo because I was not sure what this should be set at ...
- Update /codes with complete payload - except owl:versionInfo (PUT) ... note that I appended a "+" character to the label and description to help spot any changes ...
file: codes-put2.ttl
@Prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .
@Prefix dct: http://purl.org/dc/terms/ .
@Prefix reg: http://purl.org/linked-data/registry# .
@Prefix ldp: http://www.w3.org/ns/ldp# .
http://ukgovld-registry.dnsalias.net/codes
a reg:Register , ldp:Container ;
rdfs:label "CODES+"@en ;
dct:description "Root (sub-)register for WMO code-tables+"@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
.
Action:
curl -i -H "Content-Type:text/turtle" -H "Accept:text/plain" -X PUT --data "@codes-put2.ttl" http://ukgovld-registry.dnsalias.net/codes?non-member-properties
Response:
HTTP/1.1 204 No Content
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 17:13:59 GMT
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/_codes:5
The browser still shows an internal server error (500) as before.
.../_codes?_view=version_list shows 5 register item versions as expected. However, the /codes register is described only with the following triples:
http://ukgovld-registry.dnsalias.net/codes
rdfs:label "CODES"@en ;
dct:description "Root (sub-)register for WMO code-tables"@en .
... this is the set I provided in step 3 (above).
Checking explicit versions of /codes ...
Action:
curl -i -H "Accept:text/turtle" http://ukgovld-registry.dnsalias.net/codes:1
Response (selected triples):
HTTP/1.1 200 OK
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 18:00:11 GMT
Content-Type: text/turtle
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/codes
@Prefix ...
http://ukgovld-registry.dnsalias.net/codes
a reg:Register , ldp:Container ;
rdfs:label "codes"@en , "CODES+"@en , "CODES"@en ;
dct:description "Root (sub-)register for WMO code-tables+"@en , "Root (sub-)register for WMO code-tables"@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
owl:versionInfo 1 .
... and ...
Action:
curl -i -H "Accept:text/turtle" http://ukgovld-registry.dnsalias.net/codes:2
Response:
HTTP/1.1 200 OK
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 18:01:50 GMT
Content-Type: text/turtle
Transfer-Encoding: chunked
Connection: keep-alive
Location: http://ukgovld-registry.dnsalias.net/codes
@Prefix ...
http://ukgovld-registry.dnsalias.net/codes
a reg:Register , ldp:Container ;
rdfs:label "codes"@en , "CODES"@en ;
dct:description "Root (sub-)register for WMO code-tables"@en ;
reg:containedItemClass
reg:Register ;
reg:owner http://example.com/department ;
owl:versionInfo 2 .
... and (to make sure there are no more versions!) ...
Action:
curl -i -H "Accept:text/turtle" http://ukgovld-registry.dnsalias.net/codes:3
Response:
HTTP/1.1 500 Internal Server Error
Server: nginx/1.2.6
Date: Sat, 02 Mar 2013 18:02:48 GMT
Content-Type: text/turtle
Transfer-Encoding: chunked
Connection: keep-alive
Version requested on resource with no isVersionOf root
So by this stage, I can see that something quite odd has happened; all my extra properties have ended up in /codes:1 !!!
For info, the results of some SPARQL queries are:
SELECT ?g ?s ?p ?o
FROM NAMED http://ukgovld-registry.dnsalias.net/_codes:4#graph
WHERE {
GRAPH ?g { ?s ?p ?o . }
}
| g | s | p | o |
| http://ukgovld-registry.dnsalias.net/_codes:4#graph | ukreg:codes | dct:description | "Root (sub-)register for WMO code-tables"@en |
| http://ukgovld-registry.dnsalias.net/_codes:4#graph | ukreg:codes | rdfs:label | "CODES"@en |
/_codes:4#graph is cited in the response to /_codes?_view=version_list.
A query on /_codes:3#graph gives the same result whilst /_codes:1#graph and /_codes:2#graph return zero results.