Cloud (Anti)Patterns: OCCI Perspective

OCCI (anti)patterns represent the good and bad practices in the OCCI RESTful Protocol that we have identified by performing a rigorous and deep analysis on all principles defined under this specification. We distinguished three categories of (anti)patterns: Management Related (Anti)Patterns, Cloud Structure Related (Anti)Patterns, and OCCI REST Related (Anti)Patterns.


  1. Management related (anti)patterns
    1. Query interface support vs Missing query interface
    2. Compliant Create vs. Non-Compliant Create
    3. Compliant Trigger Action vs. Non-Compliant Trigger Action
    4. Compliant Update vs. Non-Compliant Update
    5. Compliant Delete vs. Non-Compliant Delete
    6. Compliant Retrieve vs. Non-Compliant Retrive
  2. Cloud Structure related (anti)patterns
    1. Compliant Link between Resources vs.Non-Compliant Link between Resources
    2. Compliant Association of resource(s) with Mixin vs. Non-compliant Association of resource(s) With Mixin
    3. Compliant Dissociation of resource(s) From Mixin vs. Non-compliant dissociation of resource(s) From Mixin
  3. OCCI REST related (anti)patterns
    1. Compliant URL vs. Non-Compliant URL
    2. Compliant Request Header vs. Non-Compliant Request Header
    3. Compliant Response Header vs. Non- Compliant Response Header

Cloud (Anti)Patterns: REST Perspective

REST (anti)patterns represent the good and bad practices in the REST APIs regardless of any cloud standard. We distinguished five categories of (anti)patterns: URI (anti)patterns, HTTP methods (anti)patterns, Error Handling (anti)patterns, HTTP Header (anti)patterns, Hypermedia (anti)patterns.


  1. URI (anti)patterns
    1. Verbless URIs vs. CRUDy URIs
    2. Tidy URIs vs. Amorphous URIs
    3. Compliant Update vs. Non-Compliant Update
    4. Singularized nodes vs. pluralized nodes
  2. HTTP methods (anti)patterns
    1. Correct use of POST, GET, PUT, DELETE, HEAD vs. Tunneling every things through GET and POST
  3. Error handling (Anti)Patterns
    1. Supporting Status Code vs. Ignoring Status Code
  4. HTTP Header (Anti)Patterns
    1. Supporting Caching vs. Ignoring Caching
    2. Supporting MIME Types vs. Ignoring MIME Types
  5. Hypermedia (Anti)Patterns
    1. Supporting Hypermedia vs. Forgetting Hypermedia

Examples of semantic detection rules

SWRL Rules for Query interface support pattern and Missing query interface anti-pattern

(Anti)patterns SWRL rules
Query interface support pattern Rest:API(?ap)^ Rest:ComposedOf(?ap,?operation)^ Rest:hasURL(?operation, ?url)^ Rest:value(?url, ?urlval)^ swrlb:matches(?urlval,“\-\”)^ Rest:hasHttpMethod(? operation, ?httpmethod)^ Rest:verb(?httpmethod, ?verb)^ detection:matchesOne(?verb, “POST”, “PUT”, “GET”, “DELETE”)->Rest:hasPattern(?ap, Ptt:Query_interface_support)
Missing query interface anti-pattern Rest:API(?ap)^ Rest:ComposedOf(?ap, ?operation)^ Rest:hasURL(?operation,?url)^Rest:value(?url, “\-\” )^ sqwrl:makeSet(?s1, ?url)^sqwrl:isEmpty(?s1) ->Rest:hasAntiPattern(?ap, Att:Missing_query_interface)

SWRL rules for Compliant Trigger Action pattern and Non-Compliant Trigger Action anti-pattern

(Anti)patterns SWRL rules
Compliant Trigger Action Rest:Operation(?op) ^ Rest:type(?op, "Trigger Action") ^ Rest:hasHttpMethod(?op, ?httpmd) ^ Rest:verb(?httpmd, ?verb) ^ swrlb:matches(?verb, "POST") ^ Rest:hasRequest(?op, ?req) ^ Rest:hasRq-Body(?req, ?reqbody) ^ Rest:hasParameterDefinition(?reqbody, ?pradef) ^ Occi:Action(?action) ^ Rest:isComposedOf(?pradef, ?action) ^ Occi:term(?action, ?term) ^ Occi:scheme(?action, ?scheme) ^ Occi:class(?action, "action") ^ Rest:hasURL(?op, ?url) ^ Rest:value(?url, ?value) ^ swrlb:contains(?value, "action=") ^ swrlb:endsWith(?value, ?term) -> Rest:hasPattern(?op, Ptt:Compliant_Trigger_Action)
Non-Compliant Trigger Action anti-pattern Rest:Operation(?op) ^ Rest:type(?op, "Trigger Action") ^ Rest:hasHttpMethod(?op, ?httpmd) ^ Rest:verb(?httpmd, ?verb) ^ swrlb:notEqual(?verb, "POST") Rest:hasAntipattern(?op, Att:Non-CompliantTriggerAction)
- Rest:Operation(?op)^Rest:type(?op, "Trigger Action")^Rest:hasURL(?op, ?url) ^ Rest:value(?url, ?value) ^ detection:notcontains(?value, "action=") -> Rest:hasAntiPattern(?op, Ptt:Non-Compliant_Trigger_Action)

SWRL rules for Verbless URIs pattern and CRUDy URIs anti-pattern

(Anti)patterns SWRL rules
Verbless URIs pattern Rest:Operation(?operation)^ Rest:hasHttpMethod(? operation, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^detection:matchesOne(?verb, "POST", " PUT", "GET", "DELETE") ^ Rest:hasURL(?operation, ?url)^ Rest:value(?url,?urlval)^ detection: contain(?return,?urlval, "create", "update", " read", "delete") ^ swrlb:matches(?return, "False ")->Rest:hasPattern(?operation, Ptt: Verbless_URIs)
CRUDy URIs anti-pattern - Rest:Operation(?operation) ^ Rest:hasHttpMethod(? operation, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^ detection:matchesOne (?verb, "create", "update", "read", "delete")^Rest: hasAntipattern (?operation, Att:CRUDy_URIs)
-Rest:Operation(?operation) ^ Rest:hasURL(? operation, ?url) ^ Rest:value(?url,?urlval) ^ detection:contain(?return,?urlval, "create", " update", "read", "delete") ^ swrlb:matches(? return, "True")->Rest:hasAntipattern (?operation, Att:CRUDy_URIs)

SWRL rules for Tunneling every things through GET and POST anti-patterns

(Anti)patterns SWRL rules
Tunneling every things through GET anti-pattern Rest:Operation(?op) ^ Rest:hasHttpMethod(?op, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^ swrlb:matches(?verb, "GET") ^ Rest:URL(?url) ^ Rest:value(?url, ?urlval) ^ detection:contain(?return, ?urlval, "delete", "update", "head", "put") ^ swrlb:matches(?return, "True")-> Rest:hasAntipattern(?url, Att:Tunnelling_every_things_through_GET)
Tunneling every things through POST anti-pattern - Rest:Operation(?op) ^ Rest:hasHttpMethod(?op, ?httpmethod) ^ Rest:verb(?httpmethod, ?verb) ^ swrlb:matches(?verb, "POST") ^ Rest:URL(?url) ^ Rest:value(?url, ?urlval) ^ detection:contain(?return, ?urlval, "delete", "update", "head", "put") ^ swrlb:matches(?return, "True")-> Rest:hasAntipattern(?url, Att:Tunnelling_every_things_through_POST)

SWRL rules for Ignoring Status Code pattern and Supporting Status Code anti-pattern

(Anti)patterns SWRL rules
Supporting Status Code pattern Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value) ^ detection:matchelist(?value, "200 (OK), 201 (Created), 201 (Created), 202 (Accepted), 204 (No Content), 204 (No Content), 304 (Not Modified), 400 (Bad Request)") -> Rest:hasPattern(?op, Ptt:Supporting_Status_Code)
Ignoring Status Code anti-pattern - Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value) ^ detection:Notmatchelist(?value, "200 (OK), 201 (Created), 201 (Created), 202 (Accepted), 204 (No Content), 204 (No Content), 304 (Not Modified), 400 (Bad Request)") -> Rest:hasPattern(?op, Att:Ignoring_Status_Code)
-Rest:Operation(?op) ^ Rest:hasCode(?op, ?codestatus) ^ Rest:value(?codestatus, ?value) ^ swrlb:matches(?value, " ") -> Rest:hasPattern(?op, Att:Ignoring_Status_Code)

Contact

  • Hayet Brabra
    Telecom SudParis
    Computer Science Departement
    email: hayet.brabra (-at-) telecom-sudparis.eu