Home
iCOCOA User's Guide - Paris - Rocquencourt
Contents
1. lt process Output gt lt process hasOutput gt lt process AtomicProcess gt lt Conversation of method Brew gt lt process AtomicProcess rdf ID CoffeeMachineServiceBrewConversation gt lt process hasOutput gt lt process Output rdf ID CoffeeMachineServiceBrewOutput gt lt process parameterType rdf datatype http www w3 org 2001 XMLSchema anyURI gt http localhost 9080 AlarmClockOntology owl Void lt process parameterType gt lt process Output gt lt process hasOutput gt lt process AtomicProcess gt lt Conversation of method Serve gt lt process AtomicProcess rdf ID CoffeeMachineServiceServeConversation gt lt process hasOutput gt lt process Output rdf ID CoffeeMachineServiceServeOutput gt lt process parameterType rdf datatype http www w3 org 2001 XMLSchema anyURI gt http localhost 9080 AlarmClockOntology owl Void lt process parameterType gt lt process Output gt lt process hasOutput gt lt process AtomicProcess gt In this part we define the conversations of each of the capabilities of the service In this example all of the provided capabilities are atomic that is they are single capability not a workflow of capabilities and so here we need only define the capability s output lt Grounding global properties gt lt grounding WsdlGrounding rdf ID CoffeeMachineGrounding gt lt grounding hasAtomicProcessGrounding rdf resource C
2. lt owl Class rdf ID FmRadio gt lt rdfs subClassof rdf resource http amigo gforge inria fr owl ConsumerElectronics owl Audi oRenderDevice gt lt owl Class gt lt owl Class rdf ID CoffeeMachine gt lt rdfs subClassof rdf resource http amigo gforge inria fr owl ConsumerElectronics owl Cons umerElectronicsDevice gt lt owl Class gt INRIA Rocquencourt ARLES 9 July 2008 Public lt owl Class rdf ID AlarmClock gt lt rdfs subClassof rdf resource http amigo gforge inria fr owl ConsumerElectronics owl Cons umerElectronicsDevice gt lt owl Class gt Here we define the concepts for each of the services and for the application as well Note that an ontology should describe a shared data model sharing a common data model between different applications and systems is one of the key strengths of using OWL so first you should search the ontologies available in the Amigo project to see of the concepts you need already exist After searching the ontologies we discover that a Radio does not exist however an AudioRenderDevice concept and while neither a Coffee Machine nor Alarm Clock exist a ConsumerElectronicsDevice concept does As such the FmRadio concept is created to be a subclass of AudioRenderDevice and CoffeeMachine and AlarmClock to be subclasses of ConsumerElectronicsDevice lt Input and ouput semantics gt lt owl Class rdf ID Void f gt Next we define the input and output se
3. grab them from http tomcat apache org http ws apache org axis and http www active endpoints com respectively Get Apache Tomcat 5 5 Apache Axis 1 4 and ActiveBPEL 4 1 If you are unfamiliar with these projects documentation is available at the project pages Here we ll go over the essentials for using them with the Amigo Semantic Services middleware For debugging for Tomcat or Axis install however consult the documentation In the examples Tomcat is installed as a Windows service on port 9080 If you install Tomcat on a different port please update the examples appropriately OK were ready to turn make our services available Make sure Axis is running and deploy the services using the scripts provided cd axis axisDeploy bat CoffeeMachineDeploy wsdd axisDeploy txt FmRadioDeploy wsdd Take a look at the bat script and the wsdd files and understand what is going on You will be able to use the script and the wsdd files as templates for your own services Now copy your class files up into the Axis classes folder This folder will typically be Tomcat 5 5 webapps axis WEB INF classes Now go to the Axis page in your browser Apache Axis Mozilla Firefox EIER File Edit View History Bookmarks Tools Help gt O a a E http localhost 9080 axis E Apache Axis B Apache AXIS Language en ja Hello Welcome to Apache Axis What do you want to do today Validation Validat
4. lt grounding wsdlDocument rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine wsdl lt grounding wsdlDocument gt lt grounding owlsProcess rdf resource CoffeeMachineServiceBrewConversation gt lt grounding wsdlOperation gt lt grounding WsdlOperationRef gt lt grounding portType rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine lt grounding portType gt lt grounding operation rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine brew lt grounding operation gt lt grounding WsdlOperationRef gt lt grounding wsdlOperation gt lt grounding wsdlInputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine brewRequest INRIA Rocquencourt ARLES 14 July 2008 Public lt grounding wsdlInputMessage gt lt grounding wsdlOutputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine brewResponse lt grounding wsdlOutputMessage gt lt grounding WsdlAtomicProcessGrounding gt lt Provided capability Serve gt lt grounding WsdlAtomicProcessGrounding rdf ID CoffeeMachineServiceServeGrounding gt lt grounding wsdlDocument rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine wsdl lt grounding wsdlDocument gt lt grounding owlsProcess rdf resource CoffeeMachineServiceServeConversation gt lt g
5. Message java 539 org apache axis transport http AxisServlet sendResponse AxisServlet java 902 org apache axis transport http AxisServlet doPost AxisServlet java 777 javax servlet http HttpServlet service HttpServlet java 710 org apache axis transport http AxisServletBase service AxisServletBase java 327 javax servlet http HttpServlet service HttpServlet java 803 This is due the ActiveBPEL library upon which ICOCOA depends which is not supported at JDK 6 Please use a Java 5 SDK JVM INRIA Rocquencourt ARLES 3 July 2008 Public 2 Deployment System requirements In order to run ICOCOA you must have the following software installed on your machine e Apache Axis 1 4 Final e Apache Tomcat 5 5 e ActiveBPEL 4 1 Download The required software can be downloaded from the following locations e Apache Axis 1 4 Final http ws apache org axis java releases html e Apache Tomcat 5 5 http tomcat apache org download 55 cgi e ActiveBPEL 4 1 http www active endpoints com active bpel engine overview htm Install Installation instructions for the required software can be found at the following locations e Apache Axis 1 4 Final http ws apache org axis java install html e Apache Tomcat 5 5 http tomcat apache org tomcat 5 5 doc index html e ActiveBPEL 4 1 http www active endpoints com active bpel engine overview htm INRIA Rocquencourt ARLES 4 July 2008 Public 3 iCOCOA Tutorial In this tutori
6. capability In this example the subcapabilities written simply lang hasCapability are executed in order switch on radio then switch coffee machine then brew coffee Next we ll look at the conversation section of the task where this workflow is defined lt Conversations gt lt process CompositeProcess rdf ID AlarmClockActivateConversation gt lt process hasOutput gt lt process Output rdf ID AlarmClockServiceActivateOutput gt lt process parameterType rdf datatype http www w3 org 2001 XMLSchema anyURI gt http localhost 9080 AlarmClockOntology owl Void lt process parameterType gt lt process Output gt lt process hasOutput gt lt process composedOf gt lt process Sequence gt lt process components gt lt process ControlConstructList gt lt obj List first lt process Perform rdf ID FmRadioSwithOnPerform gt lt The first capability of the workflow gt lt process process rdf resource FmRadioSwitchOnCapability gt lt process Perform gt fobjListsfirsts lt objList rest gt lt process ControlConstructList gt lt objList first gt lt process Perform rdf ID CoffeeMachineSwitchOnPerform gt lt The second capability of the workflow gt lt process process rdfi resource CoffeeMachineSwitchOnCapability gt lt process Perform gt lt objList first gt INRIA Rocquencourt ARLES 17 July 2008 Public lt objList rest gt lt process ControlConstr
7. inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID CoffeMachineBrew gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt INRIA Rocquencourt ARLES 10 July 2008 Public lt owl Class rdf ID CoffeMachineServe gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt Capability semantics for AlarmClock gt lt owl Class rdf ID AlarmClockActivate gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt rdf RDF gt And finally we define the semantics for the alarm clock application Now that we have the semantic concepts we require we can create the semantic service descriptions Below is the semantic description for the coffee machine It can also be found in full at owI CoffeeMachine owl in the examples download It s a lot to take in so we ll look at each piece in turn below lt xml version 1 0 gt lt DOCTYPE uridef lt ENTITY xsd Theis www w3 org 2001 XMLSchema gt lt ENTITY process http www daml org services owl s 1 1 Process owl gt lt ENTITY objList http www daml org services owl s 1 1 generic ObjectList owl gt lt ENTITY wsdl http localhost 9080 axis services CoffeeMachine gt gt lt r
8. is recommend to use the Eclipse IDE available at www eclipse org to follow the examples in this tutorial 3 1 1 How to create and deploy the services First we must construct the services we are going to use the radio and the coffee machine Below is the listing of some simple Java code for these services These listings can be found in full in the src examples alarmclock folder of the examples download The radio interface package examples alarmclock public interface FmRadio void switchOn void switchOff void increaseVolume void decreaseVolume void findNextStation The coffee machine interface package examples alarmclock public interface CoffeeMachine void switchon void switchOff void brew void serve http www hitech projects com euprojects amigo deliverables amigo_d3 4_correctedfinal pdf INRIA Rocquencourt ARLES 5 July 2008 Public The radio implementation package examples alarmclock public class FmRadioService implements FmRadio private int volume 5 private double stations 88 6 99 5 100 8 102 5 private int currentStation private boolean switchedon 0 i false public void switchon if switchedon switchedOn true System out println The FM Radio has been switched on public void switchoff if switchedon switchedon false System out printIin The FM Radio has been switched Off public void d
9. must be filled in at that point Using amigosgen can considerable decrease the time is takes to create semantic service descriptions The examples download include the full semantic service description for the FmRadio service too It can be found in the owl folder Now that we have completed the semantic service descriptions we can register the semantic services with the Amigo Semantic Service Repository The code to this is included in the example in the sre tools addservices java Run this class to add the services If you wish to programmatically register semantic service within your own code you can use similar code to that used here If at any point you wish to remove the services in the repository you can use either the clearRepository method of the Semantic Repository or by simply deleting the repository folder At this point we have completed the description and registration of the radio and coffee machine semantic services 3 2 How to create a task description In this section we will look at how to create the task for the alarm clock application that will orchestrate the execution of the switch on radio switch of coffee machine and brew coffee capabilities The Alarm clock application simply has a single capability activate that is executed when the alarm goes off This capability must order the sequence of execution of the other composite semantic services capabilities To do this we create a task description The a
10. resource CoffeeMachineServiceSwitchoffoutput gt lt capabilities CoffeeMachineSwitchoff gt lt lang hasProvidedCapability gt lt Provided capability Brew gt lt lang hasProvidedCapability gt lt capabilities CoffeeMachineBrew rdf ID CoffeeMachineServiceBrewCapability gt lt lang hasConversation rdf resource CoffeeMachineServiceBrewConversation gt lt lang hasOutput rdf resource CoffeeMachineServiceBrewOutput gt lt capabilities CoffeeMachineBrew gt lt lang hasProvidedCapability gt lt Provided capability Serve gt lt lang hasProvidedCapability gt lt capabilities CoffeeMachineServe rdf ID CoffeeMachineServiceServeCapability gt lt lang hasConversation rdf resource CoffeeMachineServiceServeConversation gt lt lang hasOutput rdf resource CoffeeMachineServiceServeOutput gt lt capabilities CoffeeMachineServe gt lt lang hasProvidedCapability gt This part begins the definition of the service profile So far we have declared the each of the provided capabilities the service offers Each capability definition states the semantics of the capability e g capabilities CoffeeMachineSwitchon and declarations of its conversation and its inputs and outputs The bodies of these are defined later lt service presentedBy rdf resource CoffeeMachine gt lt profile textDescription rdf datatype http www w3 org 2001 XMLSchema string gt This is a semantic description of the C
11. But fortunately a service description template can be automatically generated for a service using the amigosgen tool The tool is included in the Amigo Semantic Repository bundle and can be run from the command line as such java tools amigosgen CoffeeMachine wsdl CoffeeMachine owl This takes the WSDL file as input and generates the corresponding template in CoffeeMachine owl The file produced looks like this lt service Service rdf ID SEMANTIC SERVICE NAME gt lt lang ServiceType rdf datatype http www w3 org 2001 XMLSchema string gt SERVICE TYPE SEMANTIC URI lt lang ServiceType gt lt service presents gt lt capabilities ServiceProfile rdf ID SEMANTIC SERVICE NAME Profile gt lt Provided capabilities gt lt lang hasProvidedCapability gt lt capabilities switchOn CAPABILITY SEMANTIC rdf ID CoffeeMachineServiceSwitchOnCapability gt lt lang hasConversation rdf resource CoffeeMachineServiceSwitchOnConversation gt lt lang hasOutput rdf resource CoffeeMachineServiceSwitchOnOutput gt lt capabilities switchOn CAPABILITY SEMANTIC gt lt lang hasProvidedCapability gt INRIA Rocquencourt ARLES 15 July 2008 Public Only part of the file is shown but the rest follows a similar pattern Almost all of the service description has been created automatically All that remains to be filled in are the few details in the tags Each tag indicates what information
12. ICOCOA User s Guide Graham Thomson Sebastien Bianco July 2008 Public Abstract The user s guide presents how to write semantic service descriptions and use the iCOCOA middleware for semantic service composition adaptation and execution Keyword list HOWTO ambient intelligence networked home system semantic concept ontology service description vocabulary service description language semantic reasoning service matching service composition service adaptation service execution middleware Table of Contents I iCOCOA Overview anne eileen Goede wus 2 Deployments es i e a aaa aata dodges tate a ra 3 MCOCOA Tutorial ip meii a e ne 3 1 How to create semantic services and descriptions essssssesssesesssetsssessersseresseeessees 3 1 1 How to create and deploy the services 2u0ssssessnsenssnnenssnnennnnnnnnnnnnnn nennen 3 1 2 How to create semantic service descriptions ueesssseessnseessnneenennennnnnennnnennnnn 3 143 Generating the service description using amigosgen ueenseeesssnenssnneesnnnennnn 15 3 2 Howto cr aie d task deseriplion nenne Risen 16 3 3 How to create a semantic service application sessssssesssessssseseseressseessressrrsseessees 18 3 4 How to deploy a semantic service application ucrsssesssseessnsenseneessnnnesnnnnnnnnnn 21 INRIA Rocquencourt ARLES 2 July 2008 Public 1 iCOCOA Overview Provider INRIA Paris Rocquencourt Introduc
13. al we shall look at how to construct a smart home alarm clock application that is based on Amigo Semantic Services The application switches on a radio and brews a cup of coffee when the alarm activates This tutorial has several parts first we will look at the services the radio and coffee maker and how they are described using the Amigo S semantic service description language next we look at how to a task is described and how it composes the services in the way the alarm clock application requires then we look at how to create the application and how to use the semantic service repository and finally we look at how to deploy and run the application For more a more detailed over view of Amigo Semantic Services middleware please refer to Amigo D3 4 Amigo overall middleware First Prototype implementation amp documentation 3 1 How to create semantic services and descriptions Our application requires to services to run a radio service and a coffee machine service When the alarm clock activates we want the application to switch on the radio switch on the coffee machine and then instruct the coffee machine to brew a cup of coffee A nice way to start the day in our smart home All the code scripts descriptions etc that feature in this tutorial are available in full in the examples download that accompanies this tutorial Please explore the contents of this download The download is in the format of an Eclipse project It
14. cription Remember to do as has been done here and include and namespace declaration and import statement for any application specific ontologies you define lt service Service rdf ID CoffeeMachine gt lt lang ServiceType rdf datatype http www w3 org 2001 XMLSchema string gt http localhost 9080 AlarmClockOntology owl CoffeeMachine lt lang ServiceType gt Here we introduce the service we state that a service is being defined and that is has the service type CoffeeMachine The id here is used only with the ontology file the name and display name of the service itself are defined later INRIA Rocquencourt ARLES 11 July 2008 Public lt service presents gt lt capabilities ServiceProfile rdf ID CoffeeMachineProfile gt lt Provided capability SwitchOn gt lt lang hasProvidedCapability gt lt capabilities CoffeeMachineSwitchOn rdf ID CoffeeMachineServiceSwitchOnCapability gt lt lang hasConversation rdf resource CoffeeMachineServiceSwitchOnConversation gt lt lang hasOutput rdf resources CoffeeMachineServiceSwitchOnOutput gt lt capabilities CoffeeMachineSwitchon gt lt lang hasProvidedCapability gt lt Provided capability Switchoff gt lt lang hasProvidedCapability gt lt capabilities CoffeeMachineSwitchOff rdf ID CoffeeMachineServiceSwitchOffCapability gt lt lang hasConversation rdf resource CoffeeMachineServiceSwitchOffConversation gt lt lang hasOutput rdf
15. df RDF xmlns lang http amigo gforge inria fr owl Amigo S owl xmlns capabilities http amigo gforge inria fr owl Capabilities owl xmlns process http www daml org services owl s 1 1 Process owl xmlns service http www daml org services owl s 1 1 Service owl xmlns profile http www daml org services owl s 1 1 Profile owl xmlns grounding http www daml org services owl s 1 1 Grounding owl xmlns objList http www daml org services owl s 1 1 generic ObjectList owl xmlns xsd http www w3 org 2001 XMLSchema xmlns rdf http www w3 org 1999 02 22 rdf syntax ns xmlns rdfs http www w3 org 2000 01 rdf schema xmlns owl http www w3 org 2002 07 owl xmlns daml http www daml org 2001 03 daml oil xmlns dc http purl org dc elements 1 1 xmlns aconto http localhost 9080 AlarmClockOntology owl xmlns http localhost 9080 axis services CoffeeMachine owl xml base http localhost 9080 axis services CoffeeMachine owl xmlns wsdl http localhost 9080 axis services CoffeeMachine wsdl gt lt owl Ontology rdf about gt lt owl imports rdf resource http amigo gforge inria fr owl Amigo S owl gt lt owl imports rdf resource http amigo gforge inria fr owl Capabilities owl gt lt owl imports rdf resource http localhost 9080 AlarmClockOntology owl gt lt owl Ontology gt Again this is standard header You could use this as well as the complete file as a template for your own des
16. dl extension Then go back to the services listing and do the same to get the WSDL for the coffee machine service Note that Example WSDL files for the services are already included in the wsdl folder of the examples download for reference Make sure to use your own for the services installed on your machine We have finished created and deploying our services 3 1 2 How to create semantic service descriptions We have created and deployed our services but as they are we can only use them as ordinary web services In order to use them as Amigo Semantic Services we must create semantic service descriptions for them First of all we must create the semantic concepts we need for the services their methods or rather their capabilities as well as their return types The file owl AlarmClock owl contains the ontology files that describe each of these features We ll look at piece by piece below lt xml version 1 0 gt lt DOCTYPE uridef lt ENTITY xsd http www w3 org 2001 XMLSchema gt lt ENTITY process http www daml org services owl s 1 1 Process owl gt lt ENTITY objList http www daml org services owl s 1 1 generic ObjectList owl gt lt ENTITY wsdl http localhost 9080 axis services CoffeeMachine gt gt lt rdf RDF xmlns amigo http amigo gforge inria fr owl Amigo owl xmlns lang http amigo gforge inria fr owl Amigo S owl xmlns capabilities http amigo gforge inria fr owl Capabilities ow
17. e a look at the Semantic Repository interface and try out the over methods that are available For example you can look up semantic services based on type or discover the Quality of Service properties of a semantic service We have completed the implementation of the alarm clock application 3 4 How to deploy a semantic service application To deploy the alarm clock application we must first package it up as an Amigo service bundle To do this we must first create a manifest file and a metadata file for the service The manifest for the example looks like ManifestVersion 1 0 BundleDescription An alarm clock application based on Amigo Semantic Services BundleName AlarmClock BundleActivator examples alarmclock AmigoCoreActivator BundleClassPath CreatedBy Graham Thomson BundleVendor INRIARocq ImportPackage com francetelecom amigo core org ungoverned gravity servicebinder org apache log4j fr inria icocoa semrep fr inria icocoa semrep excp fr inria icocoa common BundleCopyright LGPL Metadatalocation metadata xml And the metadata looks like lt xml version 1 0 encoding UTF8 gt lt bundle gt lt component class examples alarmclock SemanticRepositoryClientComponent gt lt requires service com francetelecom amigo core AmigoLdapLookup filter cardinality 1 1 policy dynamic bindmethod bindLookupService unbind method unbindLookupService gt lt component gt lt bundle gt The full source
18. e the local installation s configuration below if this does not work View the list of deployed Web services Call Call a local endpoint that list s the caller s http headers or see its WSDL Visit Visit the Apache Axis Home Page Administer Axis disabled by default for security reasons SOAPMonitor disabled by default for security reasons To enable the disabled features uncomment the appropriate declarations in WEB INF web xml in the webapplication and restart it Validating Axis v http localhost 9080 axis servlet AxisServlet INRIA Rocquencourt ARLES 7 July 2008 Public And click on the List option Mozilla Firefox LE ER File Edit View History Bookmarks Tools Help se E lt E e tat aR w Rael eui oogle S je http localhost 9080 axis servlet AxisServlet X gt http localho t AxisServiet E 7 And now Some Services FmRadio wsal switchOn switchOfF decreaseVolume increase Volume findNextStation AdminService wsdl o AdminService Version wsdl getVersion CoffeeMachine wsdl switchOn switchO o brew serve This lists all the services that are currently deployed on the local Axis instance We can see the FM radio and coffee machine services To create a semantic service description for our services we need to have the Web Services Description Language WSDL file for it Fortunately Axis provides these
19. ecreaseVolume if volume gt 0 volume System out println Volume decreased to volume public void increaseVolume if volume lt 10 volume System out println Volume increased to volume public void findNextStation currentStation currentStation 1 stations length System out println Found station stations currentStation y FM And the coffee machine implementation package examples alarmclock public class CoffeeMachineService implements CoffeeMachine private boolean switchedon private boolean brewed public void switchon if switchedon switchedOn true en Coffee Machine has been switched on public void switchof if switchedon switchedon false une Coffee Machine has been switched off T public void brew if brewed System out println The coffee is already brewed else brewed true public void serve if brewed System out println Please brew the coffee first else brewed false System out println The coffee is being served INRIA Rocquencourt ARLES 6 July 2008 Public Once we have these classes compiling and running we must make them into web services In this tutorial we will use Apache Tomcat and Apache Axis to host web services and Active Endpoints ActiveBPEL to executed composed semantic service applications If you do not already have these installed
20. for us Click on the wsdl link beside the FM radio service Mozilla Firefox File Edit View History Bookmarks Tools Help a lt x tat i u TAG l Google J je http localhost 9080 axis services FmRadio wsd gt http localh FmRadio wsdi A This XML file does not appear to have any style information associated with it The document tree is shown below lt wsdl definitions targetNamespace http localhost 9080 axis services FmRadio gt lt SDL created by Apache Axis version 1 4 Built on Apr 22 2006 06 55 48 PDT gt lt wsdl message name increaseV olumeRequest gt lt wsdl message gt lt wsdl message name decreaseV olumeResponse gt lt wsdl message gt lt wsdl message name switchOffResponse gt lt wsdl message gt lt wsdl message name switchOnResponse gt lt wsdl message gt lt wsdl message name findNextStationResponse gt lt wsdl message gt lt wsdl message name findNextStationRequest gt lt wsdl message gt lt wsdl message name switchOnRequest gt lt wsdl message gt lt wsdl message name switchOffRequest gt lt wsdl message gt lt wsdl message name decreaseV olumeRequest gt lt wsdl message gt lt wsdl message name increaseV olumeResponse gt lt wsdl message gt EmRadinSersice gt INRIA Rocquencourt ARLES 8 July 2008 Public This is the WSDL for the service Save this file locally giving it a ws
21. he Semantic Repository bundles semantic repository lib 1 0 0 jar and semanticrepository service 1 0 0 jar by entering their URL in the bar at the top and clicking Install and then start them Oscar should now look like this EIER Location System Bundle Shell Service 3 Active Shell GUI Shell Plugin Bundle Repository log4j Service Binder amigo_core Service Introspector Log Service JMX MX4J Agent Service MBean factory Service notifier Serviet HTTP Service Amigo mods amigo_stubgen amigo_ksoap_binding Jamigo_ksoap_export amigo_wsdiscovery AmigoSemanticRepositoryLib AmigoSemanticRepository You are now ready to install and run alarm clock application Similarly enter the URL or your service in to the bar click Install then Start and watch the console for your service s output INRIA Rocquencourt ARLES 22 July 2008 Public You can now use the Amigo Semantic Service Repository Go create your world INRIA Rocquencourt ARLES 23
22. l xmlns conselec http amigo gforge inria fr owl ConsumerElectronics owl xmlns process http www daml org services owl s 1 1 Process owl xmlns service http www daml org services owl s 1 1 Service owl xmlns profile http www daml org services owl s 1 1 Profile owl xmlns grounding http www daml org services owl s 1 1 Grounding owl xmlns objList http www daml org services owl s 1 1 generic ObjectList owl xmlns xsd http www w3 org 2001 XMLSchema xmlns rdf http www w3 org 1999 02 22 rdf syntax ns xmlns rdfs http www w3 org 2000 01 rdf schema xmlns owl http www w3 org 2002 07 owl xmlns daml http www daml org 2001 03 daml oil xmlns dc http purl org dc elements 1 1 xmlns http localhost 9080 AlarmClockOntology owl xml base http localhost 9080 AlarmClockOntology owl gt lt owl Ontology rdf about gt lt owl imports rdf resource http amigo gforge inria fr owl Amigo owl gt lt owl imports rdf resource http amigo gforge inria fr owl Amigo S owl gt lt owl imports rdf resource http amigo gforge inria fr owl Capabilities owl gt lt owl imports rdf resource http amigo gforge inria fr owl ConsumerElectronics owl gt lt owl Ontology gt So far this is just standard header material it links to the other ontology files we require We have additionally included the consumer electronics ontology and added a namespace declaration and import statement appropriately
23. larm clock task can be found in full in the owl folder and may serve as a basis for your own task descriptions A task description is simple a service description with a few key differences a service describes a real existing service and the capabilities it provides and their grounding while a task describe and abstract service that may not yet exist and the capabilities that are required As a task is abstract is does not require a grounding Services are matched against a task and provide the capabilities the task requires Let s look at the profile for the task lt service presents gt lt capabilities ServiceProfile rdf ID AlarmClockProfile gt lt Required capabilities high level capability gt lt lang hasRequiredCapability gt lt capabilities AlarmClockActivate rdf ID AlarmClockActivateCapability gt lt lang hasConversation rdf resource AlarmClockActivateConversation gt lt lang hasOutput rdi lt sresource AlarmClockServiceActivateOutput gt lt capabilities AlarmClockActivate gt lt lang hasRequiredCapability gt lt Required sub capability Switchon for FM Radio gt lt lang hasCapability gt lt capabilities FmRadioSwitchOn rdf ID FmRadioSwitchOnCapability gt lt lang hasConversation rdf resource FmRadioSwitchOnConversation gt lt lang hasOutput rdf resource FmRadioServiceSwitchOnOutput gt lt capabilities FmRadioSwitchOn gt lt lang hasCapability gt INRIA Rocquencou
24. localhost 9080 axis services CoffeeMachine switchOnResponse lt grounding wsdlOutputMessage gt lt grounding WsdlAtomicProcessGrounding gt lt Grounding for method SwitchOff gt lt grounding WsdlAtomicProcessGrounding rdf ID CoffeeMachineServiceSwitchOffGrounding gt lt grounding wsdlDocument rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine wsdl lt grounding wsdlDocument gt lt grounding owlsProcess rdf resource CoffeeMachineServiceSwitchoffConversation gt lt grounding wsdlOperation gt lt grounding WsdlOperationRef gt lt grounding portType rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine lt grounding portType gt lt grounding operation rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine switchoff lt grounding operation gt lt grounding WsdlOperationRef gt lt grounding wsdlOperation gt lt grounding wsdlInputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine switchoffRequest lt grounding wsdlInputMessage gt lt grounding wsdlOutputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine switchOffResponse lt grounding wsdlOutputMessage gt lt grounding WsdlAtomicProcessGrounding gt lt Provided capability Brew gt lt grounding WsdlAtomicProcessGrounding rdf ID CoffeeMachineServiceBrewGrounding gt
25. lse log warn No lookup service found for Semantic Repository Client bundle new Thread public void run try context getBundle stop catch BundleException e log warn Unable to stop bundle e start INRIA Rocquencourt ARLES 19 July 2008 Public public void deactivate log info Stopping the Semantic Repository Client bundle Again this can be used as a template Much of this code will be the same in your client service In fact in most case you ll only need to fill in the details of the activate method If you are interested in the details of the other methods here such as the bind and unbind methods or the binder context objects in the constructor please refer to the Amigo OSGi Programming Framework documentation available at https sforge inria fr frs group_id 160 The line after Find services for task is where we call upon the semantic service repository to compose available service to meet the requirements of the alarm clock task This will return a list of WSDL files of services that meet the task s requirements Now that you have a matching service we want to invoke the alarm clock activate capability To this we have a choice use code like the following log info Activating alarm clock invoker CapabilityInvoker invoker new CapabilityInvoker serviceWsdlUri invoker invoke AlarmClockActivate to use the dynamic capabilit
26. mantics we require In simple example we only require a void type for capability outputs lt Capability semantics for FmRadio gt lt owl Class rdf ID FmRadioSwitchon gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID FmRadioSwitchoff gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID FmRadioIncreaseVolume gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID FmRadioDecreaseVolume gt lt rdfs subClassOf rdf resource http amigo gforge inria f fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID FmRadioFindNextStation gt lt rdfs subClassOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt Above we define the semantics for each of the capabilities for the FM radio service lt Capability semantics for CoffeeMachine gt lt owl Class rdf ID CoffeMachineSwitchOn gt lt rdfs subClassoOf rdf resource http amigo gforge inria fr owl Capabilities owl ServiceCapability gt lt owl Class gt lt owl Class rdf ID CoffeMachineSwitchoff gt lt rdfs subClassOf rdf resource http amigo gforge
27. of both of these files can be found in src examples alarmclock Again these files can be used as a template and further details about these files can be found the Amigo OSGi Programming Framework documentation available at http amigo gforge inria fr home index html Next we must bundle these files up together with the class files of the service This can be done from the command line by running the make_osgi_bundle bat in the scripts folder cd scripts make_osgi_bundle bat INRIA Rocquencourt ARLES 21 July 2008 Public The resulting jar file in the osgi folder is the Amigo service bundle for you new service Next start up oscar by running oscar bat in the examples download root directory The screenshot below shows the minimal set of packages that must be installed to run the Semantic Repository Any missing bundles can be added from the OBR tab EDER Location System Bundle Shell Service Table Layout Shell GUI Shell Plugin Bundle Repository Active log4j Active Service Binder Active jamigo_core Active Service Introspector Active Log Service Active JMX MX4J Agent Service Active MBean factory Active Service notifier Active Serviet Active HTTP Service Amigo mods Active jamigo_stubgen Active amigo_ksoap_binding Active jamigo_ksoap_export Active amigo_wsdiscovery CO OD On amp oo ho Oo wo _ o Install t
28. offeeMachine service lt profile textDescription gt lt profile serviceName rdf datatype http www w3 org 2001 XMLSchema string gt Coffee machine lt profile serviceName gt lt capabilities ServiceProfile gt This part ends the definition of the service profile and includes a textual description of the service as well as a display name for the service lt service presents gt lt service supports rdf resource CoffeeMachineGrounding gt lt service Service gt INRIA Rocquencourt ARLES 12 July 2008 Public Here we add a declaration of the grounding for this service lt Conversation of method SwitchOn gt lt process AtomicProcess rdf ID CoffeeMachineServiceSwitchOnConversation gt lt process hasOutput gt lt process Output rdf ID CoffeeMachineServiceSwitchOnOutput gt lt process parameterType Rdf datatype http www w3 org 2001 XMLSchema anyURI gt http localhost 9080 AlarmClockOntology owl Void lt process parameterType gt lt process Output gt lt process hasOutput gt lt process AtomicProcess gt lt Conversation of method SwitchOff gt lt process AtomicProcess rdf ID CoffeeMachineServiceSwitchoffConversation gt lt process hasOutput gt lt process Output rdf ID CoffeeMachineServiceSwitchOffoutput gt lt process parameterType rdf datatype http www w3 org 2001 XMLSchema anyURI gt http localhost 9080 AlarmClockOntology owl Void lt process parameterType gt
29. offeeMachineServiceSwitchOnGrounding gt lt grounding hasAtomicProcessGrounding rdf resource CoffeeMachineServiceSwitchoffGrounding gt lt grounding hasAtomicProcessGrounding rdf resource CoffeeMachineServiceBrewGrounding gt lt grounding hasAtomicProcessGrounding rdf resource CoffeeMachineServiceServeGrounding gt lt grounding WsdlGrounding gt INRIA Rocquencourt ARLES 13 July 2008 Public lt Grounding for method SwitchOn gt lt grounding WsdlAtomicProcessGrounding rdf ID CoffeeMachineServiceSwitchOnGrounding gt lt grounding wsdlDocument rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine wsdl lt grounding wsdlDocument gt lt grounding owlsProcess rdf resource CoffeeMachineServiceSwitchOnConversation gt lt grounding wsdlOperation gt lt grounding WsdlOperationRef gt lt grounding portType rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine lt grounding portType gt lt grounding operation rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine switchon lt grounding operation gt lt grounding WsdlOperationRef gt lt grounding wsdlOperation gt lt grounding wsdlInputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine switchOnRequest lt grounding wsdlInputMessage gt lt grounding wsdlOutputMessage rdf datatype amp xsd anyURI gt http
30. okupService AmigoLdapLookup lookup this lookup lookup public void activate log info Activating Semantic Repository Client Service if lookup null AmigoService services try services lookup lookup urn amigo SemanticServiceRepository 5 if services length 0 log warn Unable to find services matching SemanticServiceRepository else if services length gt 1 log error Found multiple semantic repositories Arrays toString services else SemanticRepository semrep SemanticRepository services 0 getSpecificStub SemanticRepository class try String taskFileUri Tools getURIStringFromFilePath PropertyManager LOCAL DIRECTORY owl AlarmClock owl Find services for task log info Discovering services String matchingServices semrep getServicesForTask taskFileUri if matchingServices length gt 0 String serviceWsdlUri semrep getWsdlForService matchingServices 0 log info Activating alarm clock invoker CapabilityInvoker invoker new CapabilityInvoker serviceWsdlUri invoker invoke AlarmClockActivate log info Activating alarm clock stub AlarmClock alarmClock new AlarmClockStub serviceWsdlUri alarmClock activate else log info No services were found matching taskFileUri catch AmigoException e log warn Lookup failed for services of type SemanticServiceRepository e
31. rounding wsdlOperation gt lt grounding WsdlOperationRef gt lt grounding portType rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine lt grounding portType gt lt grounding operation rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine serve lt grounding operation gt lt grounding WsdlOperationRef gt lt grounding wsdlOperation gt lt grounding wsdlInputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine serveRequest lt grounding wsdlInputMessage gt lt grounding wsdlOutputMessage rdf datatype amp xsd anyURI gt http localhost 9080 axis services CoffeeMachine serveResponse lt grounding wsdlOutputMessage gt lt grounding WsdlAtomicProcessGrounding gt lt rdf RDF gt This part defines the grounding of the service Essentially we must map the atomic capabilities to the operations in the WSDL files At first it may be a little overwhelming but the structure is very regular and so simpler than first meets the eye Each capability has grounding WsdlAtomicProcessGrounding entry that described the input and output message of the associated WSDL operation as mapping to its port types operations and parts Again this example could serve as a template for your own services 3 1 3 Generating the service description using amigosgen I m sure you ll agree that writing all of this description by hand is tedious
32. rt ARLES 16 July 2008 Public lt Required sub capability SwitchOn for Coffee Machine gt lt lang hasCapability gt lt capabilities CoffeeMachineSwitchOn rdf ID CoffeeMachineSwitchOnCapability gt lt lang hasConversation rdf resource CoffeeMachineSwitchOnConversation gt lt lang hasOutput rdf resource CoffeeMachineSwitchOnOutput gt lt capabilities CoffeeMachineSwitchon gt lt lang hasCapability gt lt Required sub capability Brew for Coffee Machine gt lt lang hasCapability gt lt capabilities CoffeeMachineBrew rdf ID CoffeeMachineBrewCapability gt lt lang hasConversation rdf resource CoffeeMachineBrewConversation gt lt lang hasOutput rdf resource CoffeeMachineBrewOutput gt lt capabilities CoffeeMachineBrew gt lt lang hasCapability gt lt service presentedBy rdf resource AlarmClock gt lt profile textDescription rdf datatype http www w3 org 2001 XMLSchema string gt This is a semantic description of the AlarmClock service lt profile textDescription gt lt profile serviceName rdf datatype http www w3 org 2001 XMLSchema string gt Alarm clock lt profile serviceName gt lt capabilities ServiceProfile gt This is similar to the service description but here we describe the required capability as well as sub capabilities The activate capability is acomposite capability That is it executes a workflow of sub capabilities rather than a single atomic
33. tarted Remember to change the package to suit your own example and include the appropriate log4j and OSGi bundles in your class path when building The full code of the Activator can be found in the file src examples alarmclock AmigoCoreActivator java Next we want to create the application itself The code for is looks like package examples alarmclock import java util Arrays import org apache log4j Logger import org osgi framework BundleContext import org osgi framework BundleException import org ungoverned gravity servicebinder Lifecycle import org ungoverned gravity servicebinder ServiceBinderContext import com francetelecom amigo core AmigoException import com francetelecom amigo core AmigoLdapLookup import com francetelecom amigo core AmigoService import fr inria icocoa common PropertyManager import fr inria icocoa common Tools import fr inria icocoa semrep CapabilityInvoker import fr inria icocoa semrep SemanticRepository INRIA Rocquencourt ARLES 18 July 2008 Public public class SemanticRepositoryClientComponent implements Lifecycle private Logger log private AmigoLdapLookup lookup private BundleContext context public SemanticRepositoryClientComponent ServiceBinderContext sbc log Logger getLogger this getClass getName context sbc getBundleContext public void bindLookupService AmigoLdapLookup lookup this lookup lookup public void unbindLo
34. te The repository can be configured to match services to tasks in different ways By default the repository will matches only identical concepts That is the capability semantic for a service s provided capability must be identical to the capability semantic of the task s required capability for there to be a match between them This is termed syntactic matching The repository can be set to use this type of matching as follows INRIA Rocquencourt ARLES 20 July 2008 Public semrep setMatcher syntactic In addition the repository offers two other looser modes of matching First is exact matching this will match concepts that are identical but also concepts that are either explicitly equivalent tagged with the owl equivalentClass relation or implicitly equivalent it has similar properties of another class tagged with the owlowl equivalentProperty relation The repository can be set to use this type of matching as follows semrep setMatcher exact Second is weak matching this will match all concepts that exact matching does but also this will match concepts that are identical but also concepts that are within a stated radius of the to be matched concept For example if we have a radius of 1 the concept would be matched with either an immediate super class or an immediate sub class The repository can be set to use this type of matching as follows semrep setMatcher weak 1 Tak
35. tion Short description of the service module Development status Prototype complete Intended audience Users of the iCOCOA who wish to create semantic service descriptions for services and use the semantic composition adaptation and execution middleware License The GNU Lesser General Public License v3 0 http www gnu org licenses lgpl html Language Java WSDL BPEL Platform JDK 5 Note that the ActiveBPEL library upon which iCOCOA depends is not supported at JDK 6 Tools The eclipse IDE available at www eclipse org is recommended to build the ICOCOA software and examples Files All source code files are available via anonymous checkout from the Amigo SVN repository at https gforge inria fr scm group_id 160 Documents In addition to this User s Guide an iCOCOA Developer s Guide an integrated Howto for all Amigo middleware components 1COCOA examples with accompanying tutorials and iCOCOA API documentation are available for download at https gforge inria fr frs group_id 160 Bugs The following exception will be encountered when attempting to run ICOCOA using a Java 6 JVM java lang ClassCastException com sun xml internal messaging saaj soap verl_1 Envelopel_1Impl cannot be cast to java lang String org apache axis SOAPPart getAsString SOAPPart java 554 org apache axis SOAPPart writeTo SOAPPart java 322 org apache axis SOAPPart writeTo SOAPPart java 269 org apache axis Message writeTo
36. uctList gt lt objList first gt lt process Perform rdf ID CoffeeMachineBrewPerform gt lt The last capability gt process process rdfi resource CoffeeMachineBrewCapability gt lt process Perform gt objList firsts lt always end with nil LISP mode gt lt objList rest rdf resource amp objList nil gt lt process ControlConstructList gt lt objList rest gt lt process ControlConstructList gt lt objList rest gt lt process ControlConstructList gt lt process components gt lt process Sequence gt lt process composedOf gt lt process CompositeProcess gt The conversations for the atomic sub capabilities are defined similar to there service description counter parts We have now completed the alarm clock task description 3 3 How to create a semantic service application In this section we ll look at how to create the alarm clock semantic service application First of all we need create the Amigo Activator for our new application The example Activator looks like this package examples alarmclock import org apache log4j Logger import org osgi framework BundleContext import org ungoverned gravity servicebinder GenericActivator public class AmigoCoreActivator extends GenericActivator public void start BundleContext bundleContext throws Exception super start bundleContext Logger logger Logger getLogger this getClass logger info Alarm clock activator s
37. y invoker This allows any of capabilities of your task description to be invoked even if the task description was generated dynamically at runtime If you would prefer to use a Java interface to invoke the capabilities you must first have designed and built a suitable Java interface and stub class These are straightforward to write simply include each of the task s capabilities in the interface and then write a stub that extends the AbstractStub class and use doInvoke to invoke the task capability As an example an interface and stub for the alarm clock application are provided below The full source code for both of these is available in src examples alarmclock The interface looks like package examples alarmclock public interface AlarmClock void activate And the stub looks like this package examples alarmclock import fr inria icocoa semrep AbstractStub import fr inria icocoa semrep excp InvocationException public class AlarmClockStub extends AbstractStub implements AlarmClock public AlarmClockStub String wsdl super wsdl public void activate try doInvoke AlarmClockActivate catch InvocationException e System err println An invocation error occurred e Then we can invoke the capabilities of the services returned by the Semantic Repository as so log info Activating alarm clock stub AlarmClock alarmClock new AlarmClockStub serviceWsdlUri alarmClock activa
Download Pdf Manuals
Related Search
Related Contents
Operating instructions Samsung HOME CINEMA DVD HT-D550 Manual de Usuario Récapitulatif des trois types de congés de représentation Viper Model 160XV Automobile Alarm User Manual Natural Gas Service Manual Samsung NP670Z5E User Manual (Windows 8) Manuel d`utilisation 補足説明書 第1版 894k Biogam Zn Forte Copyright © All rights reserved.
Failed to retrieve file