Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

May 2018

COMP3011

Web Services and Web Data

Question 1 (20 marks)

Indicate whether each of the following statements is true or false by unambiguously marking one of the words: True or False, then explain briefly and clearly why the   statement is true or false.

(2 marks/statement; 1 mark for correctly categorising the statement and 1 mark for explaining why)

a)  To be RESTful, an API implementation must only use existing data exchange standards.

The above statement is ( True / False ) because:

b)  If an API has two different functionalities, a RESTful design should provide one

single URI for both of them with a different HTTP verb for each.

The above statement is ( True / False ) because:

c)  The semantic web connects existing web pages to each other with clearly defined semantic relationships.

The above statement is ( True / False ) because:

d)  The predicate of an RDF statement can be a URL or a literal.

The above statement is ( True / False ) because:

e)  HTTP is a transport layer protocol.

The above statement is ( True / False ) because:

f)   A single URL can exhibit different behaviour depending on the HTTP method sent to it.

The above statement is ( True / False ) because:

g)  An HTTP response message must have a body containing the response data . The above statement is ( True / False ) because:

h)  To be HTTP Version 1.1 compliant, servers need only implement the GET and

POST methods for each resource.

The above statement is ( True / False ) because:

i)   The HTTP Accept header can be used by HTTP clients to indicate that the client

is up and running and is ready to accept server responses.

The above statement is ( True / False ) because:

j)   PageRank has the ability to distinguish pages that have links from popular pages

from those that have links from unpopular ones.

The above statement is ( True / False ) because:

Question 2 (16 marks)

Clearly mark the correct statements (e.g. by drawing a circle around the bullet letter of a correct statement).  In each case there may be more than one correct statement.

 mark/statement; there are a total of 32 correct statements)

a)  Search engines cannot discover the web pages of the deep web because these pages

A.  may be written in rare natural languages that are difficult for computer programs to parse

B.  may contain client-side scripting code

C. may require filling web forms with data

D. may be protected by CAPTCHAs

b)  When implementing a RESTful API,

A.  all implementers must use the same programming languages

B.  client application developers must use the same programming languages that the API implementers have used to implement the API.

C. API implementers are free to choose the programming language they like

D. client applications must be written using a RESTful framework like Django

c)  When naming URIs for linked data entities, the URI should be

A.  easily understood by humans.

B.  one of the predefined W3C standard entities.

C. free of any fragment identifiers.

D. none of the above.

d)  In a RESTful system,

A.  The server maintains information about the state of all clients

B.  The client should maintain state information about its own transitions

C.  Both the server and the client maintain state information about each other.

D. The server serves each request on its own merits regardless of any previous requests

e)  In the PageRank algorithm, a rank sink is a page that

A.  has no outbound links

B.  accumulates PageRank but does not distribute it

C.  has no inbound links

D.  has a circular relation with another web page

f)   An HTTP request can have the following parts:

A. A request method

B. A request URL

C. A status code

D. A block of headers

g)  The following are acceptable media types for an HTTP payload:

A.  text/plain

B.  image/HTML

C. text/vnd.ms-powerpoint

D. application/json

h)  We use the HEAD HTTP method to

A.  check if a resource has been modified

B.  set a column header (field name) in a database table

C. determine if an object (resource) exists

D.  modify the header of a response

i)   When a client makes an HTTP request to a URL, the server responds with

A. A representation of the resource

B.  The HTTP version used by the server

C. The IP address of the server

D. The type of the server’s underlying database

j)   In a RESTful API, the principle of addressability means that

A.  a resource should have one and only one URL

B.  a URL must be translated to a unique IP address

C. every resource should have its own URL.

D. every client must have one and only one IP address

k)  Stemming is a component of text processing that

A.  captures the relationships between different variations of a word.

B.  reduces the different forms of a word that occur because of inflection

C.  increases the chances of finding a relevant page in a highly inflectional language like English

D. does not makes a significant improvement in the quality of results for documents written in Russian or Arabic

l)   When a client sends a request to a non-existent resource, the server should respond with the following status code:

A.  303

B.  401

C. 404

D. 200

m) The principle of connectedness means that

A.  The client connects to the server through an HTTP session

B.  Each web page tells the client how to get the next page

C. The web as a whole works on this principle

D.  RESTful servers connect to each other to exchange data

n)  Representational State Transfer (REST) works when clients

A.  determine the current state of the server

B.  request representations of resources and parse these representation

C.  recognise control structures that leads to further resources

D. change their current state when the new resource is received

o)  A suffix is an augmentation to a media type that

A.  specifies the syntax of that media type.

B.  is registered and maintained by IANA

C.  is specified with the using’ keyword, for example application/collection using jason’

D.  is essential for any RESTful API

p)  In search engines, an inverted list may store postings for words containing

A.  a pointer to all documents that contain a word

B.  the number of times the word appears in a document

C. the stem of the word

D. the extent list for the major sections of a document

Question 3 (14 marks)

We want to design a RESTful API for a car rental business. The business owns a number of cars of different sizes. There are three size groups for cars called Group A (for small cars), Group B (for medium cars), and Group C (for large cars). Each car group  has a specific  per-day  rental  price. A customer can  book a car online  by specifying the car’s size group, the rental start date, and the rental end date.  In return the customer gets a unique booking number.

We are assuming that there is only one branch for this business in one location, and that the customer can only pick up and return a car to this location. We are also assuming that the customer does not have to pay online to book a car (payment is made in person at the branch when the car is picked up).

You do not need to consider payment details and procedures for this exercise. No logging in or authentication is required for any of the services. Customers do not need to provide their details (such as name or address) to make a booking.

a)  Design a database model for this business, by specifying:

(6 marks, 2 marks each)

i.     all required database tables

ii.     the essential fields of each table

iii.     and the relationships between the tables

b)  Write a detailed, comprehensive, and clear RESTful API specification for each of the following services:

(8 marks, 4 marks each)

i.     Getting a list of all available cars for a certain pick up and return dates (regardless of car category), that includes the total rental price for that period.

ii.     Booking a car of a certain size for a certain pick up and return dates.

For each service you have to specify an HTTP verb, a URL, the request payload, the response status codes, and the response payload. Assume that JSON objects are    used for both the request and response payloads .

Note: You can use the API specifications in Project/Coursework 1 as a template for your specifications.