This document discusses moving beyond REST API Level 3 to Level 5 by using storytelling and defining user activities and behaviors. Level 5 APIs focus on user goals and activities rather than resources and HTTP verbs. Behaviors can be represented as behavior trees that sequence activities to achieve goals. This approach makes APIs more user-centric and allows behaviors to be discovered and executed on demand to meet user needs. The document provides an example of using behavior trees to retrieve a flood map by executing activities from different data services in parallel or sequentially.
5. OGC [Many] APIs - Too Low Level - Too Complex
RM Level < 2
WMS WFS WPS SPS WCS
WCPS WfCS SOS WNS SAS
CSW WPS-T
WfCS WFS-T
Many Competing Approaches (REST/RPC, SOAP, GeoServices...) 5
And Harmonization Issues
6. RM Level 3 Is Great But...
• Where Is The User?
The User Does Not [Necessarily] Care About Your Resources! 6
7. User Centric
Level 5 API Approach
• Use Story Telling To Convey Information to Access/Share The Information
• Define User Activities To Generate Products (and a Story)
• Define Behaviors To Achieve User Goals By Sequencing Activities
• Web Services Publish Their Behaviors On Request Based On User Goals
• Users Execute Behaviors To Meet Goals and Retrieve Products
User Cares About Stories, Goals, Activities, Behaviors...
7
12. Execute And Achieve Goal
Floodmap Port-au-Prince
Port-Au-Prince Hawai Flooding Get Floodmap Port-au-Prince
Execute And Retrieve Data
Available Modis Radarsat EO-1
Services
Too
Coarse
12
13. Activities Appears In User Timeline and News Feed
Now They Can be Shared (Discovered And Duplicated) 13
14. Level 4: Define Activities
• See Activity Streams Protocol or Facebook
OpenGraph API
• Activity (or Story):
• {actor} {verb} {object} {target} Not Unlike the User Stories of Agile Development Process
14
17. Level 5: Define Behaviors
• Not Unlike Behavior Driven Development
We Are Taking About Behaviors We Can Discover And
Execute On-Demand On The Client-Side 17
18. Encoding Behavior...
Hierarchical Finite State Machines
Many Options... intuitive
reactive
HFSM
Behavior
Trees
Hierarchical Task Network Planners
Scripting
Workflows C++ Planners
LUA
autonomous
integrated purposefule
flexible
http://aigamedev.com/open/articles/behavior-trees-part1/
http://aigamedev.com/open/articles/behavior-trees-part2/
Alex Champandard 18
http://aigamedev.com/open/articles/behavior-trees-part3/
19. Behavior Trees
Par
1!
Seq Sel
1+
Task Action Task Action
✔
Cond Action Cond Action
✔ ✔
Par: Parallel Execution
Seq: Sequential Execution (do all of them)
Sel: Select First Successful Path
Cond: Condition
Task
Action 19
20. Putting It Together: Start From GOAL
Client Server
Goals
Get Floodmap Port-au-Prince
✔1 1
Query
Burnscar
✔ ✔
1 1
Floodmap
NDVI
✔ ✔
✔
...
✔1 1
✔ ✔
1 1
✔ ✔
✔
20
21. Retrieve The Tree
Client Server
Goals
Get Burnscar
Get Floodmap
1 1
✔ ✔
Get NDVI ✔
1 1
✔
✔ ✔
21
22. Execute The Tree
Client Server
Resources
1 1
HTTP POST
✔ Activity
Activity
Activity
✔ ✔ Activity
Execute Code-On-Demand
22
24. You Start with User Stories...
User
Service
Stories
Agile Development
24
25. You Develop Test Scenarios...
User
Service
Stories
Agile Development
Test
Scenarios
Behavior Driven Development
25
26. You Implement Service and Test..
User
Service
Stories
Agile Development
Test
Scenarios
Behavior Driven Development
26
27. Your User Starts Using the API..
REST Level 1-3 API
User
Service User
Stories
Agile Development
Test
Scenarios
Behavior Driven Development
Right?
27
28. Your User Starts Using the API..
REST Level 1-3 API
User
Service User
Stories
Agile Development
Test
Scenarios
Behavior Driven Development
NOT
28
29. Level 4: Define User Activities From User Stories
User
Activities
User
Stories
Agile Development
29
30. Level 5: Define Behaviors Wrapping User Activities
User
Behaviors
Activities
User
Stories
Agile Development
Behaviors are Represented as Behavior Trees
They Are The Means to User Goals
They Sequence Activities
30
31. Level 5: Execute Behaviors
REST Level 5 API
User Local
Behaviors User
Activities Behavior Tree
User
Service
Stories
Agile Development
Test
Scenarios
• User Searches for Behaviors that Can Help Him Meet A Goal
• User Retrieves Behavior Trees
• User Executes Behavior On-Demand
• Behavior Executes Activities
• Activities Trigger Implementation 31
32. What About Those Behavior Trees...?
Game AI?
Alex Champandard
AI GameDev Understanding Behavior Trees
http://aigamedev.com/open/article/bt-overview/
32
33. MODIS Behavior Tree for FloodMap
Goal
Floodmap
Activities
GET GET
TILE PRODUCT
33
34. EO-1 Behavior Tree for FloodMap
Floodmap
PROCESS
TASK FLOODMAP GET
ASSET ALGORITHM DATA
GET SUBMIT
FEASIBILITIES TASK
34
35. RADARSAT-2 Behavior Tree for FloodMap
Floodmap
TASK PROCESS GET
ASSET DATA DATA
GET SUBMIT
FEASIBILITIES TASK
35
36. Local User Tree For Floodmap (After Query)
Goal Many SubTrees To Execute in Parallel (or Sequentially...
Floodmap
Sub-Trees MODIS EO-1 RADARSAT2
Retrived BT BT BT
Dynamically
.. .. .. .. .. ..
.. .. .. ..
36
37. How To Define Behavior Trees...
Tree GUI
Ruby DSL (Radial)
JavaScript
37
38. Unexpected Benefit Of API Layer Level 5
What’s Under The Cloud Does Not Matter As Much
REST Level 3
SOAP
REST/RPC
38
39. Credits...
jmettraux/ruote-fluo
maryrosecook/machinejs
FaceBook OpenGraph Team
Mike Amundsen Benjamin Young Stu Charlton
Check His Keynote
http://www.restfest.org/
39
40. API Level 5
THANK YOU
Pat Cappelaere
email: pat at cappelaere.com
twitter: @cappelaere
blog: http://blog.geobliki.com
web: http://www.vightel.com
github: github.com/cappelaere
linkedin: www.linkedin.com/pub/pat-cappelaere/0/163/236
40