Examples

Let’s see an example, of how Leopold Bloom could interact with a digital store nowadays to order a book.

  1. Search according to a keyword on the online store
  2. Filter only by schema.org/Book objects
  3. Pick an object from the list
  4. Pick the postage method
  5. Pick the posting address
  6. Proceed to checkout
  7. Provide payment options
  8. Wait to verify the transaction
  9. Retrieve the receipt

Requests 1 and 2 could be combined by sending the search get request only for books.

It is quite easy to recognize the resources involved in this transaction.

  • Resources:
  • Book
  • List of Books
  • Address
  • Postage
  • Order
  • Receipt

The affordances taking are listed also below: Affordances:

  • Search on store
  • Add to Basket
  • Filter by
  • Pick an object
  • Select address
  • Provide payment options
  • Waiting until request finalizes
  • Retrieving the receipt

The search could be modelled according to SearchAction

application/ld+json

{
“@context”: “http://schema.org”,
“@type”: “SearchAction”,
“agent”: {
“@type”: “Person”,
“name”: “Leopold”
},
“query”: “Bring all the books named Ulysses.”
}

The API is described according to the Hydra Specification regarding the Hypermedia structure of it.

At the end of it, there is the Finite State Machine, in a SWRL format. This is recognised by ‘fsm’ tag. So, an agent will recognise this by finding the

{
“fsm”: {
#Rules
}
}

The code for this can be found on this github repository.