Today we have prepared the initial version of semap RESTful API. It was very interesting work for us, because we didn’t see any similar approaches how to work with RDF via REST-style way.
But, first of all, some words about semap project. It’s the attempt to realize our “semantic bus” vision, then we can create, modify, delete and search RDF information without deeper knowledges about RDF storages, OW-DL reasoners, named-graphs implementations and so on, as simple as we usually work with ordinary files. Even any user should simply write easy scripts in any programming languages to work with semantic information about its friends, music, photos, video, books. On the other hand advanced users can expand semap to support additional data formats, databases, features through semap’s eclipse-based plugin architecture.
Semap is a middleware solution and it doesn’t have any constraints on the stored RDF data, all work is done by various semantic services above it via RESTful API. We have ideas about several useful semantic services, but with semap we are developing only one – address book service. This is the console-based reference implementation of a semantic service for semap. We have developed the console interface specification for it and are going to create the Firefox plugin to quickly find required contacts directly from the browser. For example, you will be able to import any contact from the Internet via URI dereferencing via console tool and after that immediately find this information in the browser via plugin. Or, may be, we will configure the Zotero to store it’s data in semap too. As you can see, semap is like the “semantic bus” – any semantic service can store RDF information into it and any other semantic service can read them after that at once.
At the given state it’s very important for us to develop useful and easy to use semap API for any potential semantic service developer. We will demonstrate you some examples on basis of some real contacts semantic data, other details you can find in the specification.
1. How to find first ten contacts of people who know Timothy Berners-Lee:
Request:
GET /sparql=SELECT%20*%20WHERE%7B?uri%20%3Chttp://www.w3.org/1999/02/22-rdf-syntax-ns#type%3E%20%3Chttp://xmlns.com/foaf/0.1/Person%3E.?uri%20%3Chttp://xmlns.com/foaf/0.1/knows%3E%20%3Chttp://localhost/contacts/timbl%3E.%7DLIMIT%2010 HTTP/1.1
Host: localhost
Accept: text/plain
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000
It corresponds to the following SPARQL query:
{{{
SELECT *
WHERE
{
?uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
?uri <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/timbl> .
}
LIMIT 10
}}}
Semap response:
{{{
HTTP/1.1 200 OK
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Last-Modified: Thu, 17 Nov 2007 08:22:38 GMT
ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f"
Content-Type: text/plain;charset=UTF-8
Content-Length: ...
X-SPARQL-Records-Number: 3
?uri
http://localhost/contacts/ivan_herman
http://localhost/contacts/chrisb
http://localhost/contacts/dave_beckett
}}}
2. How add a first name and surname in Russian to the Timothy Berners-Lee contact resource:
Request:
{{{
POST /contacts/timbl HTTP/1.1
Host: localhost
User-Agent: contactserv/1.0
Date: Fri, 25 Feb 2007 23:21:59 +0000
Content-Type: text/plain;charset=UTF-8
Content-Language: ru
Content-Length: ...
<http://localhost/contacts/timbl> <http://www.w3.org/2000/01/rdf-schema#label> "Тимоти Бернерс Ли" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> "Тимоти Бернерс Ли" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/givenname> "Тимоти" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/surname> "Бернерс Ли" .
}}}
In case the http://localhost/contacts/timbl resource is present and the request is successfully processed semap response with the following message:
{{{
HTTP/1.1 200 OK
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Content-Length: 0
}}}
If http://localhost/contacts/timbl resource wasn’t be presented and the request was successfully processed semap response would be the following message:
{{{
HTTP/1.1 201 Created
Location: /contacts/timbl
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Content-Length: 0
}}}
Represented RESTful API is the primary API to access semap programmatically, but if you don’t want to control these primary HTTP(S)-level details, you can use already adapted to your favorite programming language library instead.
P.S. You are welcome to write about critic ideas or any suggestion.
very interesting, but I don’t agree with you
Idetrorce