Skip to content

How to describe a RESTfull API for a service interaction?

drleidig edited this page Feb 8, 2013 · 4 revisions

Tags: snippets

Vocabularies

@prefix hr:  <http://www.wsmo.org/ns/hrests#> .
@prefix wsl:  <http://www.wsmo.org/ns/wsmo-lite#> .
@prefix  msm:  <http://www.wsmo.org/ns/wsmo-lite#> .
@prefix  sawsdl:  <http://www.w3.org/ns/sawsdl#> .

In USDL-Core

usdl:receives a rdf:Property 
  rdfs:domain usdl:InteractionPoint;
  rdfs:range rdfs:Class.

usdl:yields a rdf:Property 
  rdfs:domain usdl:InteractionPoint;
  rdfs:range rdfs:Class.

Domain Specific Ontology

 :PersonDetails a rdfs:Class.

 :hasAge a rdf:Property;
    rdfs:range gr:QuantitativeValue;
    rdfs:domain :PersonDetails.

:hasWeight a rdf:Property;
  rdfs:range gr:QuantitativeValue;
  rdfs:domain :PersonDetails.

 :Calories a rdfs:Class.

 :hasCalories a rdf:Property;
    rdfs:range gr:QuantitativeValue;
    rdfs:domain :PersonDetails.

Service Specific

<#CaloriesInteractionPoint> a usdl:InteractionPoint;
   dcterms:title "Calculate calories";
   usdl:hasInterface <#msmCalcCalories> ;
   usdl:receives :PersonDetails;
   usdl:yields :Calories.

 <#msmCalcCalories> a msm:Operation, usdl:Interface ;
     rdfs:label "CalcCalories";
     msm:hasInput :calcCaloriesInput;
     msm:hasOutput :calcCaloriesOutput;
     hrests:hasMethod "GET";
     hrests:hasAddress "age={p1}&weight={p2}" .

 <#msmCalcService> a msm:Service;
    hrest:hasAddress: "http://foo.bar/services/calories/";
    msm:hasOperation <#msmCalcCalories> .

 :calcCaloriesInput a msm:MessageContent;
        msm:hasPart :part1, :part2;
        sawsdl:modelReference :PersonDetails.

:part1 a msm:MessagePart;
        sawsdl:modelReference :hasAge;
        hrests:isGroundedIn "p1"^^rdf:PlainLiteral. 
 
:part2 a msm:MessagePart;
        sawsdl:modelReference :hasWeight;
        hrests:isGroundedIn "p2"^^rdf:PlainLiteral .

 :calcCaloriesOutput a msm:MessageContent;
        msm:hasPart :out1;
        sawsdl:modelReference :Calories.

:out1 a msm:MessagePart;
        wsl:liftingSchemaMapping "http://example.org/CaloriesCalculatorResult.xslt" .