Вы находитесь на странице: 1из 5

Biu din OWL-S qua dch v chuyn i tin t ( CurrencyConverter).

1. CurrencyConverter.owl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE uridef [
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns">
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema">
<!ENTITY owl "http://www.w3.org/2002/07/owl">
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema">
<!ENTITY service "http://www.daml.org/services/owl-s/1.1/Service.owl">
<!ENTITY profile "http://www.daml.org/services/owl-s/1.1/Profile.owl">
<!ENTITY process "http://www.daml.org/services/owl-s/1.1/Process.owl">
<!ENTITY grounding "http://www.daml.org/services/owl-s/1.1/Grounding.owl">
<!ENTITY concepts "http://www.mindswap.org/2004/owl-s/concepts.owl">
<!ENTITY currency "http://www.daml.ecs.soton.ac.uk/ont/currency.owl">
<!ENTITY mind "http://www.mindswap.org/2004/owl-s/1.1/MindswapProfileHierarchy.owl">
]>
<rdf:RDF
xmlns:rdf="&rdf;#"
xmlns:rdfs="&rdfs;#"
xmlns:owl="&owl;#"
xmlns:xsd="&xsd;#"
xmlns:service="&service;#"
xmlns:profile="&profile;#"
xmlns:process="&process;#"
xmlns:grounding="&grounding;#"
xmlns:mind="&mind;#"
xml:base="http://www.mindswap.org/2004/owl-s/1.1/CurrencyConverter.owl"
>
<owl:Ontology rdf:about="">
<owl:imports rdf:resource="&service;"/>
<owl:imports rdf:resource="&profile;"/>
<owl:imports rdf:resource="&process;"/>
<owl:imports rdf:resource="&grounding;"/>
<owl:imports rdf:resource="&concepts;"/>
<owl:imports rdf:resource="&currency;"/>
<owl:imports rdf:resource="&mind;"/>
</owl:Ontology>
<!-- Service description -->
<service:Service rdf:ID="CurrencyConverterService">
<service:presents rdf:resource="#CurrencyConverterProfile"/>
<service:describedBy rdf:resource="#CurrencyConverterProcess"/>
<service:supports rdf:resource="#CurrencyConverterGrounding"/>
</service:Service>
<!-- Profile description -->
<mind:CurrencyService rdf:ID="CurrencyConverterProfile">
<service:isPresentedBy rdf:resource="#CurrencyConverterService"/>
<profile:serviceName xml:lang="en">Price Converter</profile:serviceName>
<profile:textDescription xml:lang="en">Converts the given price to another
currency.</profile:textDescription>
<profile:hasInput rdf:resource="#InputPrice"/>
<profile:hasInput rdf:resource="#OutputCurrency"/>
<profile:hasOutput rdf:resource="#OutputPrice"/>
</mind:CurrencyService>
<!-- Process description -->
<process:AtomicProcess rdf:ID="CurrencyConverterProcess">
<service:describes rdf:resource="#CurrencyConverterService"/>
<process:hasInput rdf:resource="#InputPrice"/>
<process:hasInput rdf:resource="#OutputCurrency"/>
<process:hasOutput rdf:resource="#OutputPrice"/>
</process:AtomicProcess>

<process:Input rdf:ID="InputPrice">
<process:parameterType rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2004/owls/concepts.owl#Price</process:parameterType>
<rdfs:label>Input Price</rdfs:label>
</process:Input>
<process:Input rdf:ID="OutputCurrency">
<process:parameterType
rdf:datatype="&xsd;#anyURI">http://www.daml.ecs.soton.ac.uk/ont/currency.owl#Currency</proc
ess:parameterType>
<rdfs:label>Output Currency</rdfs:label>
</process:Input>
<process:Output rdf:ID="OutputPrice">
<process:parameterType rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2004/owls/concepts.owl#Price</process:parameterType>
<rdfs:label>Output Price</rdfs:label>
</process:Output>
<!-- 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:owlsProcess rdf:resource="#CurrencyConverterProcess"/>
<grounding:wsdlDocument
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl</g
rounding:wsdlDocument>
<grounding:wsdlOperation>
<grounding:WsdlOperationRef>
<grounding:portType
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#Cu
rrencyConvertor</grounding:portType>
<grounding:operation
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#co
nvertPrice</grounding:operation>
</grounding:WsdlOperationRef>
</grounding:wsdlOperation>
<grounding:wsdlInputMessage
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#co
nvertPriceRequest</grounding:wsdlInputMessage>
<grounding:wsdlInput>
<grounding:WsdlInputMessageMap>
<grounding:owlsParameter rdf:resource="#InputPrice"/>
<grounding:wsdlMessagePart
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#in
0</grounding:wsdlMessagePart>
<grounding:xsltTransformationString>
<![CDATA[
<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/2004/owl-s/concepts.owl#"
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>
]]>
</grounding:xsltTransformationString>
</grounding:WsdlInputMessageMap>
</grounding:wsdlInput>

<grounding:wsdlInput>
<grounding:WsdlInputMessageMap>
<grounding:owlsParameter rdf:resource="#OutputCurrency"/>
<grounding:wsdlMessagePart
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#in
1</grounding:wsdlMessagePart>
<grounding:xsltTransformationString>
<![CDATA[
<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:lang="http://www.daml.ecs.soton.ac.uk/ont/currency.owl#"
xmlns="urn:org:mindswap:services">
<xsl:template match="/ ">
<xsl:value-of select="//lang:code"/>
</xsl:template>
</xsl:stylesheet>
]]>
</grounding:xsltTransformationString>
</grounding:WsdlInputMessageMap>
</grounding:wsdlInput>
<grounding:wsdlOutputMessage
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#co
nvertPriceResponse</grounding:wsdlOutputMessage>
<grounding:wsdlOutput>
<grounding:WsdlOutputMessageMap>
<grounding:owlsParameter rdf:resource="#OutputPrice"/>
<grounding:wsdlMessagePart
rdf:datatype="&xsd;#anyURI">http://www.mindswap.org/2002/services/CurrencyConverter.wsdl#re
turn</grounding:wsdlMessagePart>
<grounding:xsltTransformationString>
<![CDATA[
<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.owl#',$X1)"/>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:concepts="http://www.mindswap.org/2004/owl-s/concepts.owl#">
<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>
]]>
</grounding:xsltTransformationString>
</grounding:WsdlOutputMessageMap>
</grounding:wsdlOutput>
</grounding:WsdlAtomicProcessGrounding>
</rdf:RDF>

2. CurrencyConverter.wsdl.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:org:mindswap:services:CurrencyConverter"
xmlns:impl="urn:org:mindswap:services:CurrencyConverter-impl"
xmlns:intf="urn:org:mindswap:services:CurrencyConverter"

xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="urn:org:mindswap:services"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:org:mindswap:services">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="Price">
<sequence>
<element name="currency" nillable="true" type="soapenc:string"/>
<element name="amount" type="xsd:double"/>
</sequence>
</complexType>
<element name="Price" nillable="true" type="tns1:Price"/>
</schema>
</wsdl:types>
<wsdl:message name="convertPriceResponse">
<wsdl:part name="return" type="tns1:Price"/>
</wsdl:message>
<wsdl:message name="convertPriceRequest">
<wsdl:part name="in0" type="tns1:Price"/>
<wsdl:part name="in1" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="convertRequest">
<wsdl:part name="in0" type="xsd:double"/>
<wsdl:part name="in1" type="soapenc:string"/>
<wsdl:part name="in2" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="convertResponse">
<wsdl:part name="return" type="xsd:double"/>
</wsdl:message>
<wsdl:portType name="CurrencyConverter">
<wsdl:operation name="convert" parameterOrder="in0 in1 in2">
<wsdl:input name="convertRequest" message="intf:convertRequest"/>
<wsdl:output name="convertResponse" message="intf:convertResponse"/>
</wsdl:operation>
<wsdl:operation name="convertPrice" parameterOrder="in0 in1">
<wsdl:input name="convertPriceRequest" message="intf:convertPriceRequest"/>
<wsdl:output name="convertPriceResponse" message="intf:convertPriceResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="rpcrouterSoapBinding" type="intf:CurrencyConverter">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="convert">

<wsdlsoap:operation soapAction=""/>
<wsdl:input name="convertRequest">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:org:mindswap:services:CurrencyConverter"/>
</wsdl:input>
<wsdl:output name="convertResponse">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:org:mindswap:services:CurrencyConverter"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="convertPrice">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="convertPriceRequest">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:org:mindswap:services:CurrencyConverter"/>
</wsdl:input>
<wsdl:output name="convertPriceResponse">
<wsdlsoap:body use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:org:mindswap:services:CurrencyConverter"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CurrencyConverterService">
<wsdl:port name="rpcrouter" binding="intf:rpcrouterSoapBinding">
<wsdlsoap:address
location="http://www.mindswap.org:8080/soap/servlet/rpcrouter"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>