documentation: UUID to Fedora Path does not work inside transactions

The idea of using a UUID matched via the triplestore to a fedora path assumes that it is indexed. In the case of a transaction, nothing is done until the transaction is committed.

So…

> curl -i -XPOST http://localhost:8282/islandora/transaction
HTTP/1.1 201 Created
Date: Tue, 12 Apr 2016 15:48:44 GMT
Server: Apache/2.4.18 (Ubuntu)
Location: http://localhost:8080/fcrepo/rest/tx:9065bb33-803a-4b1c-8bb8-8238f83560c5
Expires: Tue, 12 Apr 2016 15:51:44 GMT
Cache-Control: private, must-revalidate
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

> curl -i -XPOST "http://localhost:8282/islandora/collection?tx=tx:9065bb33-803a-4b1c-8bb8-8238f83560c5"
HTTP/1.1 201 Created
Date: Tue, 12 Apr 2016 15:49:48 GMT
Server: Apache/2.4.18 (Ubuntu)
Cache-Control: must-revalidate, private
Location: http://localhost:8282/islandora/resource/05c0224b-4ace-4092-a8f6-603c94260d08
Content-Length: 77
Connection: close
Link: <http://localhost:8282/islandora/resource/05c0224b-4ace-4092-a8f6-603c94260d08/members>; rel="hub"
Content-Type: text/plain; charset=UTF-8

http://localhost:8282/islandora/resource/05c0224b-4ace-4092-a8f6-603c94260d08

> curl -i -XPOST "http://localhost:8282/islandora/collection/05c0224b-4ace-4092-a8f6-603c94260d08/member/5fa71ed6-f5f3-4831-8662-b1b132815a52?tx=tx:9065bb33-803a-4b1c-8bb8-8238f83560c5"
HTTP/1.1 404 Not Found
Date: Tue, 12 Apr 2016 15:51:27 GMT
Server: Apache/2.4.18 (Ubuntu)
Cache-Control: no-cache
Content-Length: 89
Content-Type: text/html; charset=UTF-8

Failed getting resource Path for "05c0224b-4ace-4092-a8f6-603c94260d08" from triple store

@Islandora-CLAW/7-x-2-x-committers : Ideas?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (18 by maintainers)

Most upvoted comments

FINALLY!!!

I feel like dancing...

We might want to refactor the cache, and namespace the different caches then. Like have my UuidCache class prepend “uuidcache:” to the keys. To allow for multiple separate caches.

Found also an extra use for you cache Jared… in the future we could even block a resource to be touched by another TX or direct call if it’s in the cache. Good work!

Okay, so I played around with this for a bit and I have two problems. I have solutions but I’m sure there are better ways. So let me know if I am crazy or if you have a suggestion.

  1. I need to link all the UUID -> Fedora URI pairs together with the transaction ID. Because any action on a transaction ID should update the expiry time on ALL the UUID -> F4 URI pairs acted on within that transaction.

So I think it is probably easiest to generate a JSON list of values ala:

{
   [
      { "UUID-1234" : "http://localhost:8080/fcrepo/rest/obj1" },
      {"UUID-5678" : "http://localhost:8080/fcrepo/rest/obj2" }
   ]
}

Then store that in Redis with the transaction ID as the key

> SET "tx:86dd0891-d975-42d8-8837-a24ad6041b59" "$json-array"

This would mean we would pull the entire object for each action on a transaction, but I think it is the easiest as we set a single expiry in Redis and update it if the transaction is acted upon.

  1. When you PUT/POST to Fedora, we don’t have the Fedora URI and UUID at the same time. After the PUT/POST action we need to use the Location: header and get the UUID from the object.

So I am thinking about a super simple transform like:

@prefix nfo : <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo/v1.2/>
id      = . :: xsd:string ;
uuid  = nfo:uuid :: xsd:string ;

So after an object is created in Fedora we can get the transform

curl -i -H"Accept: application/ld+json" "http://localhost:8080/fcrepo/path/from/location/fcr:transform/uuidTransform"

This gives us the path and UUID in a simple JSON-LD object.

Which we add using the data structure in 1.

Thoughts?