Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
104 stars 71 forks source link

Services API Design #120

Closed daniel-dgi closed 8 years ago

daniel-dgi commented 9 years ago

In preparation for the next community sprint, we'll be overhauling the middleware services to utilize PHP. While we're at it, we're reconsidering the API design in general, and are attempting to move away from Drupal specific inputs to standardizing on RDF generated from Drupal.

Please use this issue to discuss what features we really want out of services (Fedora API extensions, PCDM CRUD Operations, etc...), and what we think the interface should look like (e.g. route structure, required and optional arguments, etc...).

ruebot commented 9 years ago

Some what related, do we need to bring porkpie over to this GitHub org?

ruebot commented 9 years ago

w/r/t chullo, are there any more REST methods we need to setup? Or, do we move straight into the tunnel of abstraction? :smile:

daniel-dgi commented 9 years ago

Here's a first pass that should get us up to the point we're at now, but without accepting anything Drupal specific. Comments/critiques welcomed.

Transaction Service

Used to start, commit, and rollback transactions.

Endpoint: http://localhost:8080/islandora/transaction/

Actions:

Resource Service

Exposes basic CRUD operations on repository resources identified by a UUID.

Endpoint: http://localhost:8080/islandora/resource/

Actions:

Collection Service

Convienence operations for pcdm:Collections in Fedora 4.

Endpoint: http://localhost:8080/islandora/collection/

Actions:

Object Service

Convienence operations for pcdm:Objects in Fedora 4.

Endpoint: http://localhost:8080/islandora/object/

Actions:

Membership Service

Operations to add/remove members from pcdm:Objects and pcdm:Collections.

Endpoints:

http://localhost:8080/islandora/object/{uuid}/members

http://localhost:8080/islandora/collection/{uuid}/members

Actions:

For brevity, only one of the two endponits is described in the following section.

File Service

Lists all files for a pcdm:Object.

Endpoint: http://localhost:8080/islandora/object/{uuid}/files

Actions:

Thumbnail Service

CRUD operations for thumbnails

Endpoint: http://localhost:8080/islandora/object/{uuid}/thumbnail

Actions:

Preservation Master Service

CRUD operations for preservation masters

Endpoint: http://localhost:8080/islandora/object/{uuid}/preservationMaster

Actions:

daniel-dgi commented 9 years ago

@ruebot We'll start out by abstracting a Fedora response and having Chullo work at that sort of 'raw' level from Fedora. Then these individual services will provide utility functions that resemble what Chullo does right now. Those utility functions will then be exposed in a micro-framework actually implement the REST service.

We'll be essentially building a new porkpie from the ground up. It may end up being too much for a single library. I'm playing it by ear until we can implement some stuff. Then we'll pull it out into a separate library if there appears to be a lot of commonality.

Let's talk about the API first, though :D

ruebot commented 9 years ago

@daniel-dgi Excellent. Thanks for this! I'm understanding things a lot better now.

...my only critique/feedback for now, would be that we should probably just rename some of the services base on the PCDM use extension:

...might be splitting hairs. But consistency is good, right :smiley:

DiegoPino commented 9 years ago

@daniel-dgi and @ruebot, i think it's great. Will triple store operations be handled also as a service? Also, Membership Service could be convert this to Semantic Service or something similar? This way we could handle other relations, not necessary to fix this to pcdm? But still keep the notion of object to URI (or IRI) relation as input. I know PCDM is THE Ontology, but i wish we could get some extra flexibility on that side.

Thanks!

whikloj commented 9 years ago

@DiegoPino I am assuming that the Membership Service assumes a pcdm:hasMember predicate, perhaps this could implement a more abstract Semantic Service so you could use that service for use with alternate ontologies?

Also, @daniel-dgi I saw you put in return code for the Transaction Service but:

  1. no error codes
  2. no return/error code for any other services

Is that an oversight or perhaps too early to worry about.

daniel-dgi commented 9 years ago

@whikloj I haven't thought them through all the way. Just throwing this out there to get the conversation started. We'll need to work through detailed response scenarios together.

Most of them just mirror what the Fedora 4 API returns, but we are on the hook for the membership, file, and derivative services.

daniel-dgi commented 9 years ago

@ruebot we could also just go back to our old datastream names (OBJ, TN) etc... I wasn't sure what to put. To be honest, i'm not happy with even 'preservationMaster' because I think it's tool long and i don't like camel-case (or capital letters, period) within urls.

daniel-dgi commented 9 years ago

@DiegoPino figured we'd just expose the triplestore endpoint directly in a read only fashion. writes and other things should happen behind the scenes in the service or asynchronously in response to a message.

daniel-dgi commented 9 years ago

FYI, Google doc with all this is here

DiegoPino commented 9 years ago

:+1:

ruebot commented 8 years ago

@DiegoPino @whikloj should we bring that Google Doc into the the Project Plan doc? Make it an appendix?

DiegoPino commented 8 years ago

@ruebot, yeah, that is a good idea. It's somehow lost in the forum right now.

whikloj commented 8 years ago

👍

tpendragon commented 8 years ago

So Hydra's starting to think about what a middleware layer API for PCDM models would look like, so I wanted to ask a couple questions:

1) This looks like it's a proxy over LDP with a couple magic containers for building objects/collections - why the decision to go there and build up HTTP transactions rather than defining an API that can support nested creates which your backend can handle as a transaction to Fedora, if necessary?

2) How often do you intend to fire off these requests? It seems to me that Hydra and CLAW are in two very different places - if you just never did any of this you'd have a repository with all your data and images, yeah? Is the goal to keep Drupal and Fedora constantly in sync, or do you see Fedora as a (maybe with different wording) "preservation store," that contains all your RDF assertions as well as the model and files attached to them?

whikloj commented 8 years ago

Hi @tpendragon, As a developer who never got his CompSci, I sometimes lack the understanding of some terms. So if I am off in left field, feel free to reign me in.

That being said:

  1. The services designed in this Github issue are more comprehensive than the actual implementation seems to be working towards. A lot of our code is simply wrappers around the Fedora API and a more complex service for the unique PCDM structure of things which use the lower level microservices.

    When you say "why ... build up HTTP transactions rather than defining an API that can support nested creates...", I'm not sure I fully understand the distinction.

    But I would say, that we wanted to leave the "how" to build the resource to the front-end. So if we design a new "content model" in Drupal it could simply call these middleware services as it needs to create the new structure. We are trying hard to avoid putting all the structure into the middleware code.

    This allows us a couple of flexible options to create PCDM resources:

    1. You can use the middleware with a different front-end.
    2. You can generate new PCDM structures without altering the CLAW middleware.
  2. Again, I might have missed what you meant by "if you never did any of this you'd have..."

    We are attempting to allow for either a loose sync between Fedora and Drupal (my personal desire) where your masters and their metadata are available in Fedora, but derivatives and anything generated from the masters are not. In this case certain updates on the Drupal side will sync to Fedora, but all updates to the Fedora side need to be synced back to Drupal.

    But there are community members whom have expressed the desire to store all content in both Fedora and Drupal (in fact I believe we have heard suggestion of trying to make Fedora a backend for Drupal). So this means all changes from either side need to be synced.

All of this being said, we are now 10 days from having a tech lead (👏 ). So...he (or @DiegoPino) will probably be much better able to answer your questions.