<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF  xmlns:owl = "http://www.w3.org/2002/07/owl#"
          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/owl-s/1.1/Service.owl#"
          xmlns:process = "http://www.daml.org/services/owl-s/1.1/Process.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:expr 	= "http://www.daml.org/services/owl-s/1.1/generic/Expression.owl#"
		  xmlns:swrl		="http://www.w3.org/2003/11/swrl#"
          xml:base = "http://127.0.0.1/services/1.1/EBookOrder2.owls">

  <owl:Ontology rdf:about="">
    <owl:imports rdf:resource="http://127.0.0.1/ontology/Service.owl" />
    <owl:imports rdf:resource="http://127.0.0.1/ontology/Process.owl" />
    <owl:imports rdf:resource="http://127.0.0.1/ontology/Profile.owl" />
    <owl:imports rdf:resource="http://127.0.0.1/ontology/Grounding.owl" />
    <owl:imports rdf:resource="http://127.0.0.1/ontology/books.owl" />
    <owl:imports rdf:resource="http://127.0.0.1/ontology/Expression.owl" />
	<owl:imports rdf:resource="http://127.0.0.1/ontology/ShoppingCart.owl" />
	<owl:imports rdf:resource="http://127.0.0.1/ontology/ontosem.owl" />
	<owl:imports rdf:resource="http://127.0.0.1/ontology/core-plus-office.owl" />
  </owl:Ontology>

  <service:Service rdf:ID="EBookOrder2Service">
    <service:presents rdf:resource="#EBookOrderProfile" />
    <service:describedBy rdf:resource="#EBookOrderProcess" />
    <service:supports rdf:resource="#EBookOrderGrounding" />
  </service:Service>

  <profile:Profile rdf:ID="EBookOrderProfile">
    <service:presentedBy rdf:resource="#EBookOrder2Service" />
    <profile:serviceName xml:lang="en">EBookOrder2</profile:serviceName>
    <profile:textDescription xml:lang="en">An e-book order web service, where an ebook request is given by title and the required book is placed into the users shopping cart. The service also checks availability of the book in the stock and verifies user's account.</profile:textDescription>
    <profile:hasInput rdf:resource="#EBookRequest" />
    <profile:hasInput rdf:resource="#UserAccount" />
    <profile:hasOutput rdf:resource="#EBook" />
	<profile:hasPrecondition rdf:resource="#Authorization" />
	<profile:hasResult rdf:resource="#BookOrdered" />
  </profile:Profile>

  <process:AtomicProcess rdf:ID="EBookOrderProcess">
    <service:describes rdf:resource="#EBookOrder2Service" />
    <process:hasInput  rdf:resource="#EBookRequest"/>
    <process:hasInput  rdf:resource="#UserAccount"/>
    <process:hasOutput rdf:resource="#EBook"/>
	<process:hasPrecondition>
		<expr:SWRL-Condition rdf:ID="Authorization">
			<expr:expressionLanguage rdf:resource="http://www.daml.org/services/owl-s/1.1/generic/Expression.owl#SWRL"/>
			<expr:expressionBody rdf:parseType="Literal">
				<swrl:AtomList>
					<rdf:first>
						<swrl:ClassAtom>
							<swrl:classPredicate rdf:resource="http://127.0.0.1/ontology/ontosem.owl#Accepted"/>
							<swrl:argument1 rdf:resource="#EBookRequest"/>
						</swrl:ClassAtom>
					</rdf:first>
					<rdf:rest>
						<swrl:AtomList>
							<rdf:first>
								<swrl:ClassAtom>
									<swrl:classPredicate rdf:resource="http://127.0.0.1/ontology/core-plus-office.owl#Authorized"/>
									<swrl:argument1 rdf:resource="#UserAccount"/>
								</swrl:ClassAtom>
							</rdf:first>
							<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
						</swrl:AtomList>
					</rdf:rest>
				</swrl:AtomList>
			</expr:expressionBody>
		</expr:SWRL-Condition>
	</process:hasPrecondition>
	<process:hasResult>
	  <process:Result rdf:ID="BookOrdered">
		<process:hasEffect>
			<expr:SWRL-Expression>
				<expr:expressionLanguage rdf:resource="http://www.daml.org/services/owl-s/1.1/generic/Expression.owl#SWRL"/>
				<expr:expressionBody rdf:parseType="Literal">
					<swrl:AtomList>
						<rdf:first>
							<swrl:ClassAtom>
								<swrl:classPredicate rdf:resource="http://127.0.0.1/ontology/ShoppingCart.owl#ShoppingCartRequestItems"/>
								<swrl:argument1 rdf:resource="#Ebook"/>
							</swrl:ClassAtom>
						</rdf:first>
						<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
					</swrl:AtomList>
				</expr:expressionBody>
			</expr:SWRL-Expression>
		</process:hasEffect>
	  </process:Result>
	</process:hasResult>
  </process:AtomicProcess>

  <process:Input rdf:ID="EBookRequest">
    <process:parameterType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI">http://127.0.0.1/ontology/books.owl#Title</process:parameterType>
    <rdfs:label>The name of the book.</rdfs:label>
  </process:Input>

  <process:Input rdf:ID="UserAccount">
    <process:parameterType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI">http://127.0.0.1/ontology/books.owl#User</process:parameterType>
    <rdfs:label>The account information of the user.</rdfs:label>
  </process:Input>

  <process:Output  rdf:ID="EBook">
    <process:parameterType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI">http://127.0.0.1/ontology/books.owl#Book</process:parameterType>
    <rdfs:label>The desired book.</rdfs:label>
  </process:Output>

  <grounding:WsdlGrounding rdf:ID="EBookOrderGrounding">
    <service:supportedBy rdf:resource="#EBookOrder2Service" />
    <grounding:hasAtomicProcessGrounding>
      <grounding:WsdlAtomicProcessGrounding rdf:ID="EBookOrder2AtomicProcessGrounding"/>
    </grounding:hasAtomicProcessGrounding>
  </grounding:WsdlGrounding>
  
  <grounding:WsdlAtomicProcessGrounding rdf:about="#EBookOrder2AtomicProcessGrounding">
    <grounding:wsdlDocument rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >http://127.0.0.1/wsdl/EBookOrder2.wsdl</grounding:wsdlDocument>
    <grounding:owlsProcess rdf:resource="#EBookOrderProcess"/>
    <grounding:wsdlOperation>
      <grounding:WsdlOperationRef>
        <grounding:operation rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://127.0.0.1/wsdl/Ebookorder2#getEBook</grounding:operation>
        <grounding:portType rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://127.0.0.1/wsdl/Ebookorder2#Ebookorder2Soap</grounding:portType>
      </grounding:WsdlOperationRef>
    </grounding:wsdlOperation>
    <grounding:wsdlInputMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >http://127.0.0.1/wsdl/Ebookorder2#getEBookRequest</grounding:wsdlInputMessage>
    <grounding:wsdlOutputMessage rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
    >http://127.0.0.1/wsdl/Ebookorder2#getEBookResponse</grounding:wsdlOutputMessage>
    <grounding:wsdlInput>
      <grounding:WsdlInputMessageMap>
        <grounding:owlsParameter rdf:resource="#EBookRequest"/>
        <grounding:wsdlMessagePart rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://127.0.0.1/wsdl/Ebookorder2#EBookRequest</grounding:wsdlMessagePart>
        <grounding:xsltTransformationString>None (XSL)</grounding:xsltTransformationString>
      </grounding:WsdlInputMessageMap>
    </grounding:wsdlInput>
    <grounding:wsdlInput>
      <grounding:WsdlInputMessageMap>
        <grounding:owlsParameter rdf:resource="#UserAccount"/>
        <grounding:wsdlMessagePart rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://127.0.0.1/wsdl/Ebookorder2#UserAccount</grounding:wsdlMessagePart>
        <grounding:xsltTransformationString>None (XSL)</grounding:xsltTransformationString>
      </grounding:WsdlInputMessageMap>
    </grounding:wsdlInput>
    <grounding:wsdlOutput>
      <grounding:WsdlOutputMessageMap>
        <grounding:owlsParameter rdf:resource="#EBook"/>
        <grounding:wsdlMessagePart rdf:datatype="http://www.w3.org/2001/XMLSchema#anyURI"
        >http://127.0.0.1/wsdl/Ebookorder2#EBook</grounding:wsdlMessagePart>
        <grounding:xsltTransformationString>None (XSL)</grounding:xsltTransformationString>
      </grounding:WsdlOutputMessageMap>
    </grounding:wsdlOutput>
  </grounding:WsdlAtomicProcessGrounding>

</rdf:RDF>
