What's new? | Help | Directory | Sign in
Google
                
Search
for
Updated Feb 13, 2008 by dulanov
Labels: Phase-Requirements, Featured
RESTfulAPISpecification  
Primary RESTful HTTP API for programmatically accessing semap.

The primary API for programmatically accessing semap is a RESTful HTTP API, 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.

There is a set of third-party plugins for semap which add support of various shadow resources and data formats.

AUDIENCE

Semantic services developers.

RESOURCES

Semap's resources types:

  1. http://localhost[:{port}]/[{app}] - the semap instance resource, it's the entry-point to all other resources and it contains their statements too.
  2. http://localhost[:{port}]/[{app}]/{path} - a regular resource, you can create/update/delete statements for it.
  3. http://localhost[:{port}]/[{app}]/[{path}]/{name} - a shadow resource is added through a semap plugin, it represent an additional service on semap's resources and you can't create/update/delete statements for it.

When you create or update resources statements it's possible to use any, not necessary only local URIs, because semap can recognize them automatically by the owl:sameAs relation. Any semap instance resource has the RDF, RDFS and OWL schemes by default already.

Some examples of resources:

Resource Type Description
http://localhost/ Instance resource The entry-point to all other resources
http://localhost/dump/ Shadow resource The dump of the semap data as quads
http://localhost/index/ Shadow resource The special service to perform a keyword-based search in literals
http://localhost/contacts/mnavern/ Regular resource Contains actual statements about Mikhail Navernyuk
http://localhost/contacts/mnavern/dump/ Shadow resource The dump of the Mikhail Navernyuk's contact resource as quads
http://localhost/contacts/mnavern/revisions/20070101 Shadow resource Contains statements about Mikhail Navernyuk which are actual to the 1 Jan 2007
http://localhost/contacts/mnavern/revisions/20070101/owl Shadow resource Contains real and deduced by the OWL statements about Mikhail Navernyuk which are actual to the 1 Jan 2007
http://localhost/uri/http://xmlns.com/foaf/0.1/Person Shadow resource Represents the http://xmlns.com/foaf/0.1/Person resource
http://localhost/sql/<db alias>/<db resource>/<resource mnemocode> Shadow resource Represents some resource from RDBMS in the RDF

HTTP METHODS

Requests from the localhost are accepted only by default, but you can add any other hosts to the semap trust area to use it in Intranet or Internet.

HTTP Method / Resource Type HEAD GET POST PUT DELETE
The semap instance (/) Get the entry-point's metadata Get the entry-point's metadata and statements Add to resources additional statements Create or update the resources statements Remove all resources
A regular resource (/{path}) Get the resource's metadata Get the resource's metadata and statements (1) Equivalent to use 'POST /' Equivalent to use 'PUT /' Remove the resource
A shadow resource (/[{path}]/{name}) Get the shadow resource's metadata Get the shadow resource's metadata and statements It's depends on the current shadow resource implementation

(1) Any regular resource contains statements about itself and about blank nodes and resources not from the http: URI scheme which are used in it's statements as objects.

You can use HTTP OPTIONS command to find available for a required resource HTTP commands also.

HTTP PARAMETERS

Parameters:

or you can use scattered form of the SPARQL parameters instead (they have a lower priority than the sparql parameter):

  • ask (optional) - is the ASK clause from the sparql query only, see the description in the other examples below.
  • where (optional) - is the WHERE clause from the sparql query only, see the description in the other examples below.
  • select (optional) - is used with the where parameter and transform the solution graph into table based subset of the variables.
  • construct (optional) - is used with the where parameter and transform the solution graph into a new required graph, is used instead of the select parameter by default.

additional solution sequence attributes:

  • distinct (optional) - boolean parameter to eliminate duplicate solutions, 'false' by default.
  • offset (optional) - set a start position of solutions.
  • limit (optional) - puts an upper bound on the number of solutions returned.
  • orderby (optional) - establishes the order of a solution sequence.

or you can overwrite some HTTP header useful parameters explicitly:

  • format (optional) - overwrite the Accept HTTP header parameter.
  • lang (optional) - overwrite the Accept-Language HTTP header parameter to filter literal values by it by SPARQL automatically.

HTTP HEADERS

Request scope:

Name Description
Accept Determine what data formats added through semap plugins it would prefer the server use in its representations
Accept-Language Determine what human language it would like the server to use in its representations
Date Represents the time on the client at the time the request was sent
Host Contains the domain name part of the URI
User-Agent Lets the server know what kind of software is making the HTTP request
X-HTTP-Method-Override Use it if your firewall allows only GET and/or POST HTTP methods

Response scope:

Name Description
Connection Header that is aimed at a proxy, and one proxy can insert headers that are aimed at the next proxy in a chain
Content-Type Tells the client what kind of thing the entity-body is
Content-Length Gives the size of the entity-body in bytes
Date Represents the time on the client at the time the request was sent
ETag It's an opaque string designating a specific version of a representation
Last-Modified Tells the client the last time the representation changed
Server Describe the server software is making the HTTP response

Semap's response metadata:

Name Description
X-SPARQL-Solutions-Number Number of RDF statements or rows in the returned solutions (graph statements or tuples variable bindings)

HTTP CONTENT TYPES

There are two different kinds of information representation exists: RDF semantic graph as result of CONSTRUCT/DESCRIBE SPARQL query and tuple rows as result of SELECT/ASK SPARQL query. To add or update resources statements you should use the RDF semantic graph representation data formats only.

MIME Type Is used to represent the graph of solutions? Is used to represent tuples of solutions?
text/plain (by default) Yes (N-Triples format encoded in UTF-8) Yes, but the text/tab-separated-values will be returned instead
text/csv Yes, but the text/plain will be returned instead Yes
text/tab-separated-values Yes, but the text/plain will be returned instead Yes
text/html Yes (with the RDFa support) Yes
text/xml Yes, but the application/rdf+xml will be returned instead Yes (SPARQL Query Results XML Format)
application/xml Yes, but the application/rdf+xml will be returned instead Yes (SPARQL Query Results XML Format)
application/rdf+xml Yes Yes, but the application/xml will be returned instead
application/xhtml+xml Yes (with the RDFa support) Yes
application/rss+xml Yes Yes
application/json Yes Yes

See the semap plugins page to find information about other supported data formats.

HTTP RESPONSE CODES

Code Description
200 OK Successful query and normal response.
201 Created Creation of a resource was successful.
202 Accepted Submission accepted and batched for review or merge.
204 No Content Query was understood but there is no content. As in HTTP/1.1, there must not be a message body following this status code.
304 Not Modified The resource hasn't changed since the time specified in the request's If-Modified-Since header.
400 Bad Request There was an error processing the request. This may also be used for 405 Method Not Allowed since only one method is allowed.
401 Unauthorized The server will respond that if user not properly authenticated.
403 Forbidden The server refuses to process the request. Used for refusal to accept metadata submissions.
404 Not Found Resource (such as a feed or entry) not found.
409 Conflict Specified version number doesn't match resource's latest version number.
500 Internal Server Error This indicates a bug in the server software, otherwise pass a status 503.
503 Service Unavailable The server is temporarily unable to service this request, although it may have been valid.

EXAMPLES

specdata.rdf file is used in the following examples.

1. Get the default representation of the semap instance entry-point resource:

URL: http://localhost/

Service request:

GET / HTTP/1.1
Host: localhost
Accept: text/plain
Accept-Language: en
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

It corresponds to the following SPARQL query:

DESCRIBE <http://localhost/>

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 14

<http://localhost> <http://www.w3.org/2000/01/rdf-schema#label> "Entry-point"@en .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#comment> "The semap instance entry-point resource"@en .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/timbl> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/nwalsh> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/ivan_herman> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/fgiasson> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/chrisb> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/cygri> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/dave_beckett> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/danbri> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/mnaver> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/dulanov> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/backlinks> .
<http://localhost> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/dump> .

2. Find all semap's contact resources:

URL: http://localhost/

Service request:

GET /?sparql=SELECT%20*%20WHERE%7B%3Furi%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E.%7D HTTP/1.1
Host: localhost
Accept: text/plain
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

or using the SPARQL scattered parameters:

GET
/?select=&where=%3Furi%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E. 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> .
}

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 10

uri
http://localhost/contacts/timbl
http://localhost/contacts/nwalsh
http://localhost/contacts/ivan_herman
http://localhost/contacts/fgiasson
http://localhost/contacts/chrisb
http://localhost/contacts/cygri
http://localhost/contacts/dave_beckett
http://localhost/contacts/danbri
http://localhost/contacts/mnaver
http://localhost/contacts/dulanov

3. Find first ten contacts of people who know Timothy Berners-Lee:

URL: http://localhost/

Service request:

GET /sparql=SELECT%20*%20WHERE%7B%3Furi%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E.%3Furi%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fknows%3E%20%3Chttp%3A%2F%2Flocalhost%2Fcontacts%2Ftimbl%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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 3

uri
http://localhost/contacts/ivan_herman
http://localhost/contacts/chrisb
http://localhost/contacts/dave_beckett

4. Find contacts of people who have a Skype account (it encoded in RDF as blank node):

URL: http://localhost/

Service request:

GET /?sparql=SELECT%20*%20WHERE%7B%3Furi%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E.%3Furi%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FholdsAccount%3E%20%5B%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FOnlineAccount%3E%3B%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FaccountServiceHomepage%3E%20%3Chttp%3A%2F%2Fwww.skype.com%2F%3E%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FaccountName%3E%20%3Fskype_name%5D.%7D 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/holdsAccount>
	[<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/OnlineAccount> ;
         <http://xmlns.com/foaf/0.1/accountServiceHomepage> <http://www.skype.com/> ;
	 <http://xmlns.com/foaf/0.1/accountName> ?skype_name] .
}

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 2

uri	skype_name
http://localhost/contacts/fgiasson	fredonsomething
http://localhost/contacts/danbri	danbrickley

5. Find contacts of man by the 'timbl' keyword:

URL: http://localhost/index/timbl

Service request:

GET /index/timbl HTTP/1.1
Host: localhost
Accept: text/plain
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 2

<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/nick> "TimBL"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/nick> "timbl"@en .

And after that we try to check the received resource:

GET /contacts/timbl?sparql=ASK%7B%3Chttp%3A%2F%2Flocalhost%2Fcontacts%2Ftimbl%3E%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fgender%3E%20%22male%22.%7D HTTP/1.1
Host: localhost
Accept: text/plain
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

or using the SPARQL scattered parameters:

GET
/contacts/timbl?ask=%3Chttp%3A%2F%2Flocalhost%2Fcontacts%2Ftimbl%3E%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2FPerson%3E%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fgender%3E%20%22male%22. 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:

ASK
{
<http://localhost/contacts/timbl> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> ;
                                  <http://xmlns.com/foaf/0.1/gender> "male" .
}

Semap successful 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: 0

6. Find modified for the last month contacts:

It will be possible via using the application/rss+xml content format.

7. Get the default representation of the Timothy Berners-Lee contact resource:

URL: http://localhost/contacts/timbl

Service request:

GET /contacts/timbl HTTP/1.1
Host: localhost
Accept: text/plain
Accept-Language: en
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

It corresponds to the following SPARQL query:

DESCRIBE <http://localhost/contacts/timbl>

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 21

<http://localhost/contacts/timbl> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://localhost/contacts/timbl> <http://www.w3.org/2002/07/owl#sameAs> <http://www.w3.org/People/Berners-Lee/card#i> .
<http://localhost/contacts/timbl> <http://www.w3.org/2000/01/rdf-schema#label> "Timothy Berners-Lee"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/gender> "male" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/nick> "TimBL"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/nick> "timbl"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> "Timothy Berners-Lee"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/givenname> "Timothy"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/surname> "Berners-Lee"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/img> <http://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox> <mailto:timbl@w3.org> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "965c47c5a70db7407210cef6e4e6f5374a525c5c" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/phone> <tel:+1-(617)-253-5702> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/workplaceHomepage> <http://www.w3.org/> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/based_near> _:blank_1 .
_:blank_1 <http://www.w3.org/2003/01/geo/wgs84_pos#lat> "42.361860" .
_:blank_1 <http://www.w3.org/2003/01/geo/wgs84_pos#long> "-71.091840" .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/nwalsh> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/ivan_herman> .
<http://localhost/contacts/timbl> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/timbl/backlinks> .
<http://localhost/contacts/timbl> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/timbl/dump> .

8. Get the Timothy Berners-Lee full name in English, email and homepage:

URL: http://localhost/contacts/timbl

Service request:

GET /contacts/timbl?where=%3Chttp%3A%2F%2Flocalhost%2Fcontacts%2Ftimbl%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname%3E%20%3Fname_en%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fmbox%3E%20%3Fmbox%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fhomepage%3E%20%3Fhomepage. HTTP/1.1
Host: localhost
Accept: text/plain
Accept-Language: en
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

It corresponds to the following SPARQL query with automatically included from the Accept-Language HTTP head parameter filter statements (for example only):

CONSTRUCT
{
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> ?name_en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox> ?mbox .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/homepage> ?homepage .
}
WHERE
{
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> ?name_en . #FILTER (isIRI(?name_en) || lang(?name_en) = "" || lang(?name_en) = "en")
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox> ?mbox . #FILTER (isIRI(?mbox) || lang(?mbox) = "" || lang(?mbox) = "en")
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/homepage> ?homepage . #FILTER (isIRI(?homepage) || lang(?homepage) = "" || lang(?homepage) = "en")
}

or we can use simplified form of the SPARQL query, because we want to receive the graph is described by SPARQL graph pattern exactly:

CONSTRUCT *
WHERE
{
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> ?name_en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox> ?mbox .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/homepage> ?homepage .
}

or you can use with the where parameter also instead:

<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> ?name_en ;
                                  <http://xmlns.com/foaf/0.1/mbox> ?mbox ;
                                  <http://xmlns.com/foaf/0.1/homepage> ?homepage .

Semap response for text/plain format:

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 3

<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/name> "Timothy Berners-Lee"@en .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/mbox> <mailto:timbl@w3.org> .
<http://localhost/contacts/timbl> <http://xmlns.com/foaf/0.1/homepage> <http://www.w3.org/People/Berners-Lee/> .

Semap response for application/rdf+xml format:

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: application/rdf+xml;charset=utf-8
Content-Length: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 3

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:ont_1="http://xmlns.com/foaf/0.1/">
  <rdf:Description rdf:about="http://localhost/contacts/timbl">
    <ont_1:name xml:lang="en">Timothy Berners-Lee</ont_1:name>
    <ont_1:mbox rdf:resource="mailto:timbl@w3.org"/>
    <ont_1:homepage rdf:resource="http://www.w3.org/People/Berners-Lee/"/>
  </ont_1:Person>
</rdf:RDF>

9. Add a first name and surname in Russian to the Timothy Berners-Lee contact resource:

URL: http://localhost/contacts/timbl

Service 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: <the size of the entity-body in bytes>

<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

10. Change the nick name in English, the weblog page URL and delete the OpenID for Dmitry Ulanov's contact:

URL: http://localhost/contacts/dulanov

Service request:

PUT /contacts/dulanov?where=%3Chttp%3A%2F%2Flocalhost%2Fcontacts%2Ftimbl%3E%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fnick%3E%20%3Fnick_en%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fweblog%3E%20%3Fweblog%3B%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fopenid%3E%20%3Fopenid. HTTP/1.1
Host: localhost
Accept-Language: en
User-Agent: contactserv/1.0
Date: Fri, 25 Feb 2007 23:21:59 +0000
Content-Type: text/plain;charset=UTF-8
Content-Language: en
Content-Length: <the size of the entity-body in bytes>

<http://localhost/contacts/dulanov> <http://xmlns.com/foaf/0.1/nick> "DUlanov" .
<http://localhost/contacts/dulanov> <http://xmlns.com/foaf/0.1/weblog> <http://dulanov.wordpress.com/> .

It corresponds to the query to get the nick name in English, the weblog page URL and the OpenID for Dmitry Ulanov's contact (see previous examples for more details), but instead of the HTTP GET the HTTP PUT is used to update them.

Semap response:

HTTP/1.1 200 OK
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Content-Length: 0

11. Show all resources which refer to the Timothy Berners-Lee contact resource:

URL: http://localhost/contacts/timbl/backlinks

Service request:

GET /contacts/timbl/backlinks HTTP/1.1
Host: localhost
Accept: text/plain
Accept-Language: en
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

It corresponds to the following SPARQL query:

DESCRIBE <http://localhost/contacts/timbl/backlinks>

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: <the size of the entity-body in bytes>
X-SPARQL-Solutions-Number: 6

<http://localhost/contacts/timbl/backlinks> <http://www.w3.org/2000/01/rdf-schema#label> "Backlinks"@en .
<http://localhost/contacts/timbl/backlinks> <http://www.w3.org/2000/01/rdf-schema#comment> "Backlinks statements to this resource"@en .
<http://localhost/contacts/timbl/backlinks> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://localhost/contacts/timbl> .
<http://localhost/contacts/ivan_herman> <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/timbl> .
<http://localhost/contacts/chrisb> <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/timbl> .
<http://localhost/contacts/dave_beckett> <http://xmlns.com/foaf/0.1/knows> <http://localhost/contacts/timbl> .

12. Remove the Dmitry Ulanov's contact:

URL: http://localhost/contacts/dulanov

Service request:

DELETE /contacts/dulanov HTTP/1.1
Host: localhost
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

Semap response:

HTTP/1.1 204 No Content
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Content-Length: 0

13. Export/import all semap's data:

URL: http://localhost/contacts/dump

Service request to export all semap's data:

GET /dump HTTP/1.1
Host: localhost
User-Agent: contactserv/1.0
Date: Fri, 24 Feb 2007 23:21:59 +0000

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: application/x-trig;charset=utf-8
Content-Length: <the size of the entity-body in bytes>

<The dump of the semap data as quads>

Service request to import all semap's data:

PUT /dump HTTP/1.1
Host: localhost
User-Agent: contactserv/1.0
Date: Fri, 25 Feb 2007 23:21:59 +0000
Content-Type: application/x-trig;charset=utf-8
Content-Length: <the size of the entity-body in bytes>

<The dump of the semap data as quads>

Semap response:

HTTP/1.1 200 OK
Server: semap/1.0
Connection: close
Date: Fri, 24 Feb 2007 23:21:59 +0000
Content-Length: 0

AUTHOR

The semap project development team.

BUGS/TODO

Please report all bugs and suggestions via http://code.google.com/p/semap/issues/list.

LICENSE

	Copyright 2007 The semap project development team.

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.

VERSION

1.0-M1 (initial prototype version).

SEE ALSO

EXTERNAL RESOURCES


Sign in to add a comment