<?xml version="1.0" encoding="ISO-8859-1" ?> 
<rdf:RDF
  xmlns:daml="http://www.daml.org/2001/03/daml+oil#"
  xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:service="http://www.daml.org/services/daml-s/0.7/Service.daml#"
  xmlns:process="http://www.daml.org/services/daml-s/0.7/Process.daml#"
  xmlns:profile="http://www.daml.org/services/daml-s/0.7/Profile.daml#"
  xmlns:grounding="http://www.daml.org/services/daml-s/0.7/Grounding.daml#" 
  xmlns:fla="http://www.flacp.fujitsulabs.com/~mhgrove/services/FLACP-ServiceOnt.daml#"
  xmlns:profileHierarchy="http://www.mindswap.org/2002/services/MindswapProfileHierarchy.daml#"
  xmlns="http://www.mindswap.org/2002/services/CurrencyConverter.daml#">

<daml:Ontology rdf:about="">
  <daml:imports rdf:resource="http://www.mindswap.org/2002/services/MindswapProfileHierarchy.daml#"/>
</daml:Ontology>
										
<!-- Service description -->

<service:Service rdf:ID="CurrencyConverterService">
  <service:presents rdf:resource="#CurrencyConverterProfile" />
  
  <service:describedBy rdf:resource="#CurrencyConverterProcessModel" /> 
  
  <service:supports rdf:resource="#CurrencyConverterGrounding" />
</service:Service>

<!-- Profile description -->

    <profileHierarchy:InfoService rdf:ID="CurrencyConverterProfile">
      <service:isPresentedBy rdf:resource="#CurrencyConverterService"/>

      <profile:serviceName>Currency Converter</profile:serviceName>
      <profile:textDescription>
      </profile:textDescription>

      <profile:has_process rdf:resource="#convertCurrency"/>

      <profile:input> 
        <profile:ParameterDescription rdf:ID="BookISBN"> 
          <profile:parameterName>Input Price</profile:parameterName>
          <profile:restrictedTo rdf:resource="http://www.mindswap.org/2002/services/concepts.daml#Price"/>
          <profile:refersTo rdf:resource="#bookISBN"/>
        </profile:ParameterDescription>
      </profile:input>

      <profile:input> 
        <profile:ParameterDescription rdf:ID="BookISBN2"> 
          <profile:parameterName>Output currency</profile:parameterName>
          <profile:restrictedTo rdf:resource="http://www.daml.ecs.soton.ac.uk/ont/currency.daml#Currency"/>
          <profile:refersTo rdf:resource="#bookISBN2"/>
        </profile:ParameterDescription>
      </profile:input>

      <profile:output> 
      	<profile:ParameterDescription rdf:ID="BookPrice"> 
          <profile:parameterName>Output Price</profile:parameterName>
          <profile:restrictedTo rdf:resource="http://www.mindswap.org/2002/services/concepts.daml#Price"/>
          <profile:refersTo rdf:resource="#bookPrice"/>
      	</profile:ParameterDescription>
      </profile:output>
    </profileHierarchy:InfoService>

<!-- Process Model description -->

<process:ProcessModel rdf:ID="CurrencyConverterProcessModel">
  <service:describes rdf:resource="#CurrencyConverterService" /> 
  <process:hasProcess rdf:resource="#CheckBookPrice" /> 
</process:ProcessModel>

<daml:Class rdf:ID="CheckBookPrice">
  <rdfs:subClassOf rdf:resource="http://www.daml.org/services/daml-s/0.7/Process.daml#AtomicProcess" /> 
  <rdfs:subClassOf>
    <daml:Restriction daml:cardinality="1">
      <daml:onProperty rdf:resource="#bookISBN" /> 
    </daml:Restriction>
  </rdfs:subClassOf>
</daml:Class>

<rdf:Property rdf:ID="bookISBN">
  <rdfs:subPropertyOf rdf:resource="http://www.daml.org/services/daml-s/0.7/Process.daml#input" /> 
  <rdfs:domain rdf:resource="#CheckBookPrice" /> 
  <rdfs:range rdf:resource="http://www.mindswap.org/2002/services/concepts.daml#Price" /> 
</rdf:Property>

<rdf:Property rdf:ID="bookISBN2">
  <rdfs:subPropertyOf rdf:resource="http://www.daml.org/services/daml-s/0.7/Process.daml#input" /> 
  <rdfs:domain rdf:resource="#CheckBookPrice" /> 
  <rdfs:range rdf:resource="http://www.daml.ecs.soton.ac.uk/ont/currency.daml#Currency" /> 
</rdf:Property>

<rdf:Property rdf:ID="bookPrice">
  <rdfs:subPropertyOf rdf:resource="http://www.daml.org/services/daml-s/0.7/Process.daml#output" /> 
  <rdfs:domain rdf:resource="#CheckBookPrice" /> 
  <rdfs:range rdf:resource="http://www.mindswap.org/2002/services/concepts.daml#Currency" /> 
</rdf:Property>

<!-- Grounding description -->

<grounding:WsdlGrounding rdf:ID="CurrencyConverterGrounding">
  <service:supportedBy rdf:resource="#CurrencyConverterService" /> 
  <grounding:hasAtomicProcessGrounding rdf:resource="#CurrencyConverterProcessGrounding" /> 
</grounding:WsdlGrounding> 

<grounding:WsdlAtomicProcessGrounding rdf:ID="CurrencyConverterProcessGrounding">
      <grounding:damlsProcess rdf:resource="#CheckBookPrice"/>
      <grounding:wsdlOperation rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#convertPrice"/>
    
      <grounding:wsdlInputMessage rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#convertPriceRequest"/>
      <grounding:wsdlInputMessageParts rdf:parseType="Collection">
    	<grounding:wsdlMessageMap>
	  <grounding:damlsParameter rdf:resource="#bookISBN"/>
	  <grounding:wsdlMessagePart
            rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#in0"/>
<fla:xsltTransformation rdf:parseType="Literal">
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:concepts="http://www.mindswap.org/2002/services/concepts.daml#"
xmlns="urn:org:mindswap:services">
<xsl:template match="//concepts:Price">  

<xsl:variable name="X1" select="concepts:currency/@rdf:resource"/>

<Price>
  <amount><xsl:value-of select="concepts:amount" /></amount>
  <currency><xsl:value-of select="substring-after($X1,'#')" /></currency>
</Price>


</xsl:template>
</xsl:stylesheet>
</fla:xsltTransformation>
    	</grounding:wsdlMessageMap>
    	<grounding:wsdlMessageMap>
	  <grounding:damlsParameter rdf:resource="#bookISBN2"/>
	  <grounding:wsdlMessagePart
            rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#in1"/>
    	</grounding:wsdlMessageMap>
      </grounding:wsdlInputMessageParts>
    
      <grounding:wsdlOutputMessage rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#convertPriceResponse"/>
      <grounding:wsdlOutputMessageParts rdf:parseType="Collection">
    	<grounding:wsdlMessageMap>
	  <grounding:damlsParameter rdf:resource="#bookPrice"/>
	  <grounding:wsdlMessagePart
            rdf:resource="http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#return"/>
<fla:xsltTransformation rdf:parseType="Literal">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/return">  
<xsl:variable name="X1" select="currency"/>
<xsl:variable name="X2" select="amount"/>
<xsl:variable name="X3" select="concat('http://www.daml.ecs.soton.ac.uk/ont/currency.daml#',$X1)"/>

<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:concepts="http://www.mindswap.org/2002/services/concepts.daml#"
>

<concepts:Price>
  <concepts:currency>
  <xsl:attribute name="rdf:resource">
  <xsl:value-of select="$X3" />
  </xsl:attribute>  
  </concepts:currency>
  <concepts:amount><xsl:value-of select="$X2"/></concepts:amount>
</concepts:Price>

</rdf:RDF>

</xsl:template>
</xsl:stylesheet>
</fla:xsltTransformation>
    	</grounding:wsdlMessageMap>
      </grounding:wsdlOutputMessageParts>
    
      <grounding:wsdlReference>http://www.w3.org/TR/2001/NOTE-wsdl-20010315</grounding:wsdlReference>
      <grounding:otherReference>http://www.w3.org/TR/2001/NOTE-wsdl-20010315 http://schemas.xmlsoap.org/wsdl/soap/ http://schemas.xmlsoap.org/soap/http/</grounding:otherReference>
      <grounding:wsdlDocument>http://www.mindswap.org/2002/services/CurrencyConverter.wsdl</grounding:wsdlDocument>
</grounding:WsdlAtomicProcessGrounding>

</rdf:RDF>