Tuesday 20 January 2009

Making a Book Recommendation System RESTful

The objective is to take simple ontologies, a service using them and then try to see how to make them RESTful. And try to answer the question: Is there a systematic way to make any ontology RESTful?

My supervisor suggested a Book recommendation service. Like in Amazon books are recommended to users. In our example the recommended books list is generated for a user, by recommending books bought by other people, who already bought the same books that the user has.

Designing the Service

-This service can be complicated or simple, it can be either on the server side or on the client side.

I chose it to be on the server.

A question that arises is: are we solving the right kind of problem here?

Ontology Design

Person :hasName

Book :hasTitle

Relationships

Property

Subject

Object

Notes

hasAuthored

Person

Book

Inverse

hasAuthor

Book

Person

hasCopy

Person

Book



Resource Design

URI

Method

Description

Client Sent Payload

/BookOntology/

GET

Gets the ontology

-

POST

Creates a book instance

-

PUT

N/A

-

DELETE

N/A

-

/BookOntology/All/

GET

Gets all the book instances URIs

-

POST

N/A

-

PUT

N/A

-

DELETE

N/A

-

/BookOntology/{Book_Id}

GET

Returns the book’s info.

-

POST

N/A

-

PUT

To update or insert the book’s info

Title, etc

DELETE

Deletes the book instance

-

/BookOntology/{Book_Id}/Authors

GET

Returns the book’s authors URIs

-

POST

N/A

-

PUT

To add an author

Person’s URI

DELETE

Deletes all authors: removes the association between the book and persons

-

/BookOntology/{Book_Id}/Authors/

{Author_ID}

GET

Redirects to the author (as a person instance and gets the info)

-

POST

N/A

-

PUT

Redirects to the author

Depends

DELETE

Deletes the author: removes the association between the book and person

-

/PersonOntology/

GET

Gets the ontology

-

POST

Creates a person instance

-

PUT

N/A

-

DELETE

N/A

-

/PersonOntology/{Person_Id}

GET

Returns the person’s info.

-

POST

N/A

-

PUT

To update or insert the person’s info

Name, etc

DELETE

Deletes the person’s instance

-

/PersonOntology/{Person_Id}/ AuthoredBooks/

GET

Gets books authored by the person

-

POST

N/A

-

PUT

Adds a book

Book’s URI

DELETE

Deletes the relationships between the person and the

-

/PersonOntology/{Person_Id}/ AuthoredBooks/{Book_Id}

GET

Redirects to the book and gets the info

-

POST

N/A

-

PUT

Redirects to the book

Depends

DELETE

Deletes the book: removes the association between the book and person

-

/PersonOntology/{Person_Id}/ BookCopies/

GET

Similar to:

/PersonOntology/{Person_Id}/ AuthoredBooks/

/PersonOntology/{Person_Id}/ AuthoredBooks/{Book_Id}

POST

PUT

DELETE

/PersonOntology/{Person_Id}/ BookCopies/{Book_Id}

GET

POST

PUT

DELETE

/PersonOntology/{Person_Id}/{Recommended_Books}

GET

Gets the list of recommended books

-

POST

N/A

-

PUT

N/A

-

DELETE

N/A

-

In the next post I will discuss some issues.

No comments:

Post a Comment