Monday 26 January 2009

Thank you VideoLectures

I have been reading specifications and searching for tutorials trying to understand OWL-S, WSMO and IRS II. However I wasn't confident about what I've learned. Recently, I found these lectures on OWL-S,WSMO and IRS II.

What is really good is that the lectures are from the people who wrote these specifications so you can trust it.
Because it is a presentation they focused on how their work fits in the big picture and explained things assuming an audience with little prior knowledge.

The videos are from lectures accompanying ISWC 2007.

Thursday 22 January 2009

Presto!

So how similar are you Presto?

Let's see:

Similarities
-They have the same URI structure.
-They use GET to query, POST to add assertions
-They have suggested content negotiation
-They discussed calculated resources. As “Identifiable Query Results” but I am not sure if they are added to the original ontology.

Differences
-They designed it from knowledge management perspective, not a Web Services perspective. So they didn’t discuss transactions.
-I think it is an alternative approach to something called Openlink Virtuoso which deploys linked date, but I am not sure.
-Presto is a server you send the ontology to it. I imagined our proposed idea more like a plug-in to the server. Usually a Web Service is provides an interface to an existing strong infrastructure: like a server to deal with high throughput and a back-end database that deals with high load.
-They don’t discuss using PUT and DELETE.
-Redirection issues are not discussed.

Wednesday 21 January 2009

A detour, or a dead end :)

The idea of the deployment of OWL to provide a RESTful API is so straightforward and graceful that somebody should have thought of before. I was kind of surprised yet glad that I didn’t find something similar to it :)

I discussed the matter with my supervisor Dr. Dave Millard, and he suggested that I should check the Linked Data research.

So I started by searching the Web of Knowledge, didn’t find anything. When I used Google Scholar I found this :(

Publishing OWL ontologies with Presto

Which is very similar maybe too similar to what I’ve been thinking of.

I’ve read some papers about Linked Data before. The papers I read didn’t mention REST. I searched for a connection between the two topics; however I don’t think I searched carefully.

The funny thing is we are supposed to submit a December report on our progress, so I was going through the meetings’ minutes today and I found in one of them:
“Look into the Linked Data efforts understand what it is, and focus on answering the following questions:” one of them was:
“- Have they been working with REST?”

No comment ! :)

Lessons learnt from this story are:
-Listen carefully to your supervisor.
-Use Google Scholar :)
-Never stop searching for related work.
-It is better to know of this now than afterward.
-Keep minutes of meetings with your supervisor

Tuesday 20 January 2009

Reasoning about the Book Recommendation example

First: Recommended list generation

It is a server side service -business logic is on the server-. I used the following SPARQL query

PREFIX recserv:

SELECT ?Books

WHERE {recserv:Deema recserv:hasCopy ?DeemaBooks.

?anyone recserv:hasCopy ?DeemaBooks.

FILTER ( ?anyone != recserv:Deema)

?anyone recserv:hasCopy ?Books.

FILTER ( ?Books != ?DeemaBooks)

}

Where recserv:Deema is the person we are recommending books for.

There are some points here maybe worth noting:

1- What if we wanted it to be on the client side?

The extreme case will be getting all the persons’ books, and executing a similar query on the client.


2- Instead of explicitly writing the query, is there a way of it being dynamically generated?

The client in some way specifies what it wants -> that is translated to SPARQL.

The issue here is will it be easier -for the client- than saying it in SPARQL? By easier, meaning it Agent-wise? This will take us back to the work of these guys Battle and Benson “Bridging the semantic Web and Web 2.0 with Representational State Transfer (REST)”

Should the service as they argue offer SPARQL endpoints?

Second: Evolving Services

Extending point two from the last section, we can imagine that when a service requested and cannot be satisfied, the client can provide the logic, it will then be added as a resource to the ontology.

Third: Properties (Relationships) become resources

Examples

/BookOntology/{Book_Id}/Authors

/PersonOntology/{Person_Id}/ BookCopies/

Fourth: Issues of redirection

When properties become a resource they provide a new path to other resources. Should the GET and PUT methods be redirected to the original resource? And restrict DELETE to deleting the association.

Fifth: Changes to the ontology

Assuming that we will have RESTful Ontology deployment engine:

How to distinguish calculated vs. asserted resources?

Is it something that should be added to the ontology
When the ontology is sent through this system should it be annotated with
-Inputs / Outputs (usually with transaction ontologies)
-Calculated resources

Sixth: A minor issue: how do we determine the API URIs from the ontology?

Example:

/BookOntology/{Book_Id}/Authors

We used this to model the hasAuthor property.

Should it be

/BookOntology/{Book_Id}/hasAuthors

Or maybe it doesn’t matter because it should not involve humans.

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.