1 / 48

面向服务计算形式化 表示 方法

面向服务计算形式化 表示 方法. 马殿富 北航计算机学院 200 6-05 http://act.buaa.edu.cn/tutor_MaDianFu.asp. 主要内容. 启示 Services 集定义 Services 路径 Services 集元操作 Services 文档文法元语言 SOA 体系结构的形式化定义. XML 示例. <?xml version="1.0" encoding="gb2312" ?> - < 简况 > < 姓名 > 马殿富 </ 姓名 > < 单位 > 北京航空航天大学 计算机学院 </ 单位 >

rae-mccarty
Download Presentation

面向服务计算形式化 表示 方法

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 面向服务计算形式化表示方法 马殿富 北航计算机学院 2006-05 http://act.buaa.edu.cn/tutor_MaDianFu.asp

  2. 主要内容 • 启示 • Services集定义 • Services路径 • Services集元操作 • Services文档文法元语言 • SOA体系结构的形式化定义

  3. XML示例 • <?xml version="1.0" encoding="gb2312" ?> • - <简况> • <姓名>马殿富</姓名> • <单位>北京航空航天大学 计算机学院</单位> • <职称 职称系列="教学">教授</职称> • <授课> • <课程>离散数学</课程> • <课程>web 服务原理</课程> • </授课> • <手机>13701068603</手机> • <E-mail>dfma@nlsde.buaa.edu.cn</E-mail> • <住址>北京市海淀区大有北里</住址> • </简况>

  4. XML示例 • <?xml version="1.0" encoding="UTF-8"?> • <schematargetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2000/10/XMLSchema"> • <elementname="x1" type="int"/> • <elementname="x2"/> • <elementname="x3"/> • <complexTypename="PaymentConfirmation"> • <sequence> • <elementname="confirmationNum" type="int"/> • <elementname="patee" type="string"/> • <elementname="amt" type="double"/> • </sequence> • </complexType> • </schema>

  5. 启示 • 图灵机模型 • qmSiSjqn • qmSiRqn • qmSiLqn • 递归函数 • 复合、原始递归、取极小(μ运算) • 数理逻辑公理系统 • 命题公理系统 • 谓词公理系统 • 数学模型

  6. Services集定义 定义1: • 由XML元素名空间所确定的元素名构成的集合称为元素名集合,记为Se。 • 由XML属性名空间所确定的属性名构成的集合称为属性名集合,记为Sa集合。 • 由XML属性值构成的集合称为属性值集合,记为Sv。

  7. XML的元素递归定义 定义2: • 如果e是元素,且e没有子元素,则称e是0型元素。 • 如果e是元素,且e仅有0型子元素,则称e是1型元素。 • 如果e是元素,并且e至少有一个n-1型子元素,则称e是n型元素。

  8. 递归构造Services 集合 定义3:Services集 • 设e是元素名,并且<e/>或<e></e>是元素,则e有0型Services集表示为S0(e),其中, • <e,,>S0(e) • 设e是元素名,(ai, vi)是元素e的属性值偶对,如果元素e没有子元素,则元素e有0型Services集表示为S0(e),其中 • S0(e)={<e,ai,vi>| i= 1, 2, ……} • 例如: • <e name="a", type="int"> • {<e,name,"a">,<e,type,"int">}

  9. 递归构造Services 集合 • 设e是元素名,(ai, vi)是元素e的属性值偶对,如果元素e仅有0型子元素,其0型子元素ej的Services集表示为S0(ej),则元素e有1型Services集表示为S1(e),其中 • S1(en)= {<e,ai,vi>| i= 1, 2, ……}{ S0(ej)| j=1,2,……} • 设e是元素名,(ai, vi)是元素e的属性值偶对,如果元素e仅有k个m型子元素,m<n,并且至少有一个n-1型子元素,其m型子元素ej的Services集表示为Sm(e),则元素e有n型Services集表示为Sn(e),其中 • Sn(e)= {<e, ai, vi>| i= 1, 2, ……}{Sm(ej)| m=1,2,……,k-1 j=1,2,……} • 对于所有n型Services集,n=0,1,2,…,统称为Services集,表示为Ss(e)。

  10. Services 集合示例 • <portType name="BookQuote"> • <operation name="getBookPrice"> • <input name="isbn" • message="GetBookPriceRequest"/> • <output name="price" • message="GetBookPriceResponse"/> • </operation> • </portType>

  11. Services 集合示例 • S1={<input,name,"isbn">, • <input,message," GetBookPriceRequest">} • S2={<output,name,"isbn">, • <output,message," GetBookPriceResponse">} • S3={<operation,name,"getBookPrice">}{S1}{S2} • ={<operation,name,"getBookPrice">, • {<input,name,"isbn">, • <input,message," GetBookPriceRequest">}, • {<output,name,"isbn">, • <output,message," GetBookPriceResponse">} • }

  12. Services 集合示例 • S4={<portType,name,"BookQuote">}{S3} • ={<portType,name,"BookQuote">, • {<operation,name,"getBookPrice">, • {<input,name,"isbn">, • <input,message," GetBookPriceRequest"> • }, • {<output,name,"isbn">, • <output,message," GetBookPriceResponse">} • } • } • }

  13. Services集路径 • 路径表示了元素与子元素的层次关系,它蕴含了services集合中元素集合与子元素集合之间的包含关系。 • 定义5:如果e0是元素名,则e0是路径;如果e0\e1\…\ek-1是路径,且ek是元素名,则e0\e1\…\ek是路径;所有路径集合表示为Sp。 • 路径中元素的services集与其子元素的services集有包含关系,因此有下面关系。 • Ss(en)∈……∈Ss(e1)∈Ss(e0)

  14. Services集路径示例 • S4={<portType,name,"BookQuote">, • {<operation,name,"getBookPrice">, • {<input,name,"isbn">, • <input,message," GetBookPriceRequest"> • }, • {<output,name,"isbn">, • <output,message," GetBookPriceResponse">} • } • } • } • portType\operation\input S1∈S3∈S4 • portType\operation\output S2∈S3∈S4

  15. Services集元操作 • Add函数(+) • Remove函数(-) • 滤波函数(λ) • 选择函数(σ) • car函数(δ) • cdr函数(θ) • 连接函数(τ)

  16. add函数(+) • add(Ss,p,<e0,ak,vk>) • Ss {<e0,ak,vk>|p=} • add(Ss,p,<en,ak,vk>) • {Ss|pSp,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en){<en,ak,vk>}} • add(Ss,p,Ss(en+1)) • {Ss|pS p,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en){Ss(en+1)}}

  17. Remove函数(-) • remove(Ss,p,<en,ak,vk>) • {Ss|pSp,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en)-{<en,ak,vk>}} • remove(Ss,p,Ss(en+1)) • {Ss|pSp,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en)-{Ss(en+1)}}

  18. 滤波函数λ(filter) • λ(Ss,p) • {Ss(en)|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0)} • λ(Ss,p,a) • {Ss(en)|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • <en,a,*>Ss(en)} • λ(Ss,p,a,v) • {Ss(en)|pSp,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • <en,a,v>Ss(en)}

  19. 滤波函数λ(filter)示例 • <portType name="p1"> • <operation name=“op1"> • <input name="i1" message="m11"/> • <output name="o1" message="m12"/> • </operation> • <operation name="op2"> • <input name="i2" message="m21"/> • <output name=“o2" message=“m22"/> • </operation> • <operation name=“op3"> • <input name="i3" message=“m31"/> • <output name="o3" message="m32"/> • </operation> • </portType>

  20. 滤波函数λ(filter)示例 • λ(S, "portType\operation\input") • ={{<input,name,"i1">,<input,message,"m11">}, • {<input,name,"i2">, <input,message,"m21">}, • {<input,name,"i3">,<input,message, "m31">}} • λ(S,"portType\operation","name","op2") • {{<operation,name,"op2">, • {<input,name,"i2">,<input,message,"m21">}, • {<output,name,“o2">, <input,message,"m22">} • }}

  21. 选择函数σ(selector) • σ(Ss,p) • e{en+1|pSp, p=e0\e1\…\en\*, • Ss(en+1)∈Ss(en)∈……∈Ss(e1)∈Ss(e0), • <en+1,*,*>Ss(en)} • σ(Ss,p,a) • e{v|pSp,p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • <en,a,v>Ss(en)}

  22. 选择函数σ(selector) • <portType name="p1"> • <operation name=“op1"> • <input name="i1" message="m11"/> • <output name="o1" message="m12"/> • </operation> • </portType> • σ(Ss,"portType\*") • operation • σ(Ss,"portType\*",“name") • “op1" • σ(Ss,"portType\operation",“name") • “op1" • σ(Ss,"portType\operation\output","message") • "m12"

  23. 函数δ(car) • δ(Ss) S1,Ss={S1,S2,……,Sm} • δ(Ss,p)S, • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0),Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m}} • δ(Ss,p,a)S, • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m}, <en,a,*>Ss(en)j} • δ(Ss,p,a,v)S, • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m},<en,a,v>Ss(en)j}

  24. 函数θ(cdr) • θ(Ss){S1,S2,……,Sm}-{S1} • θ(Ss,p)Ss(e0) • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0), • Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m}, • Ss(en)-{Ss(en)1} • θ(Ss,p,a)Ss(e0), • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0),Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m}, • <en,a,*>Ss(en), • Ss(en)-{Ss(en)1} • θ(Ss,p,a,v)Ss(e0), • S{Ss(en)1|pSp, p=e0\e1\…\en, • Ss(en)∈……∈Ss(e1)∈Ss(e0),Ss(en)={Ss(en)1,Ss(en)2,……,Ss(en)m}, • <en,a,v>Ss(en), • Ss(en)-{Ss(en)1}

  25. δ与θ函数示例 • <portType name="p1"> • <operation name=“op1"> • <input name="i1" message="m11"/> • <output name="o1" message="m12"/> • </operation> • </portType> • δ(S,"portType\operation") •  {<input,name,"i1">,<input,message,"m11">} • θ(S,"portType\operation") •  • {{<portType,name, “p1">, • {<operation,name,"op2">, • {<output,name,“o2">, <input,message,"m22">} • } • }}

  26. 连接函数 τ • τ(s1,s2)s1+s2

  27. Services文法 • 乔姆斯基文法定义 • V-非终结符的非空集合;T-终结符的非空集合;P-产生式的非空集合;SV,初始符。 • 设文法G=<V,T,P,S>, • 如果L(G)是递归可枚举集,则G称为0型文法; • 如果P,||≥||,则称G为1型文法,即上下文有关文法; • 如果P,||≥||,且V,则称G为2型文法,即上下文无关文法; • 如果P,均有形式,A或AB,则称G为3型文法,即正则文法。

  28. XML文档文法元语言 • XML文法为G=<V,T,P,S>,其中, • V={$Str|Str是字符串}; • T={sequence,switch,choice,case,,!, func,t,S} • {1,2,3,4,5} • {<,>,(,)} • {+,-,λ,σ,δ,θ,τ};

  29. XML文档文法元语言 • S=$元素文法; • P是如下文法规则: • $元素文法::= $元素类|$元素类$元素文法 • $元素类::= • $sequence元素|$switch元素|$func元素| • $t元素|$元素

  30. XML文档文法元语言 • $sequence元素::= • <sequence $状态属性>$元素</sequence> • $ switch元素::= • <switch $choice属性 $状态属性>$case元素</switch> • $func元素::= • <func $状态属性>$函数元素</func> • $t元素::= • <t $状态属性>字符串</t> • $元素::= • <元素名 $状态属性>$元素类</元素名> • $case元素::= <$case元素名 $case属性 $状态属性>$元素类</元素名> • $case元素名::=sequence|switch|func|t|元素名

  31. XML文档文法元语言 • $状态属性::= • |$状态="$状态函数" • $状态::= • S|S$状态下标 • $状态下标:: • =1|2|3|4|5 • $case属性::= • case ="$case属性值"|case ="$case元素名" • $case属性值::= • |!|$元素名|$属性值 • $状态函数::= • +函数|-函数|λ函数|σ函数|δ函数|θ函数|τ函数

  32. <端口类型序列 S1="S1" S2="S2"> • <switch choice="S1"> • <φ元素 case="φ"> • <func>φ</func> • </φ元素> • <sequence case="!φ"> • <接口类型类定义 S1="δ(S1)" S2="S2"/> • <端口类型序列 S1="θ(S1)" S2="S2"/> • </sequence> • </switch> • </端口类型序列>

  33. <element变量 S1="S1"> • <t>private </t> • <switch choice="σ(S1,element,type)"> • <func case="!φ"> • σ(S1,"element","type") • </func> • <func case="φ"> • τ("C",σ(S1,"element","name")) • </func> • </switch> • <func>σ(S1,"element","name")</func> • <t>;</t> • </element变量>

  34. 逻辑公式 • xy(x=y) • xy(xy) • xaQ(x)x(xaQ(x)) • xaQ(x)x(xaQ(x)) • !xQ(x)x(Q(x)y(Q(x)x=y))

  35. 逻辑公式示例 • 名字唯一性 • xλ(&s,"message") • (yλ(&s,"message","name",σ(&x,"name")) • x=y) • 使用QName引用XSD(简单类型)或complexType (复合类型), • xλ(&s,"message\part") • (σ(&x,"type") • σ(&x,"type")XSDtypes) • yλ(&s,"types\schema\complexType") • (σ(&x,"type")=σ(&y,"name"))

  36. 面向服务体系架构 • 三个角色 • 提供者 • 使用者 • 注册中心 • 三个操作 • Publish • Find • Bind&invoke

  37. 面向服务视图 WSDL2JAVA JAVA2WSDL • 规范描述资源与协议变换 • 实现自动服务部署和调用 UDDI 客户端(人) 发布 发现与定位 Content 发现与定位 浏览器AJAX 运行时 操作 客户端(机器) 服务 资源

  38. 服务 • SoaRole=< Provider, Registry, Consumer> 定义: • 部署在提供者、并提供接口的应用程序称为服务。服务可以表示为一组类子有限集C={Ci|iI}和一组运算有限集F={fj|jJ},其中I,J是有限下标集,每个运算fi可表示为 • fi:Ci,1×Ci,2×...×Ci,kCi,k+1 • Ci,jC并且Ci,j能表示为XMLSchema的类型,称Service=<C,F>是一个服务。

  39. 基调(signature) 定义: • 设S={Si|iI}和O={Oj|jI }都为有限集,其中I,J是有限下标集,每个Si是XMLSchema一个类型,每个Oi称为一个操作,可表示为 • Oi:Si,1×Si,2×...×Si,kSi,k+1 • Si,jS,则Signature=<S,O>称为一个基调(signature)。 基调集合Signature ={<Oi, Si,1, Si,2,...,Si,k, Si,k+1>|OiOSi,jS}

  40. 应用(Application) 定义: • 如果Signature=<S,O>是一个基调,S={Si|iI}并且O={Oi|iI }。则有一组类子有限集D={Di|iI}和一组运算有限集F={fj| jJ },其中I,J是有限下标集, • fi:Di,1×Di,2×...×Di,kDi,k+1 • 使得Si,j和诸类子Di,j之间有一一对应关系,诸操作Oi和诸运算fi之间有一一对应关系,则称Application=<D, F>是一个应用。 应用集合Application={<fi,Ci,1,Ci,2,...,Ci,k, Ci,k+1>|fiFCi,jC}

  41. Provider=<Services,Signature,Description,Protocol,URL>Provider=<Services,Signature,Description,Protocol,URL> • Registry=<Description,Protocol,URL> • Consumer=<Description,Application,Protocol,URL> • Service=<C,F> • Signature=<S,O> • Application=<D,F> • Protocol={p|p是传输或通信协议}

  42. 变换序列 • Represent: • Provider×Service  Provider×Signature • Abstract: • Provider×Signature  Provider×Description • Publish: • Provider×Description  Registry×Description • Find: • (Registry + Provider)×Description  Consumer×Description • Bind: • Consumer×Description  Consumer×Application • Invoke: • Consumer×Application Provider×Service

  43. 变换定义 • 定义:sService,kSignature,s变换为k,记为s∝k;k变换为s,记为k∝-1s;。 • 定义:kSignature,dDescription,k变换为d,记为kd;d变换为k,记为d-1k。 • 定义:dDescription,aApplication,d变换为a,记为da,a变换为d,记为a-1d • 定义:aApplication,sService,a变换为s,记为as。 • 定义:r Registry并且r'Registry,如果r和r'相互可以访问,则称r和r'可达,简记为rr'。

  44. Services(p:Provider) • ={<p,s>|pProvider sServices} • 简记为Services(p) • Signatures(p:Provider,s:Service) • = {<p,k>|<p,s>Services(p) kSignatures∝k}, • 记为Signatures(p:Provider),或简记为Signatures(p)

  45. Abstract(p:Provider, k:Signature) • ={<p,d>|<p,k>Signatures(p)dDescription kd} • 记为Descriptions(p:Provider),或简记为Descriptions(p) • Publish(p: Provider, d:Description) • ={<r,d>|<p,d>Descriptions(p,d)rRegistry} • 记为Descriptions(r:Registry),或简记为Descriptions(r)

  46. Find(c:Consumer, r:Registry) • ={<c,d>|rRegistryr'Registryrr' • <r',d>Descriptions(r')} • 记为Descriptions(c:Consumer, r:Registry),或简记为Descriptions(c,r) • Find(c:Consumer,p:Provider) • ={<c,d>|<p,d>Descriptions(p)} • 记为Descriptions(c:Consumer,p:Provider),或简记为Descriptions(c,p) • Descriptions(c:Consumer) • =Descriptions(c,r)∪Descriptions(c,p) • 简记为Descriptions(c)

  47. Bind(c,d) • ={<c,a>|<c,d>Descriptions(c)aApplicationda} • 记为Applications(c:Consumer),或简记为Applications(c) • Invoke(c,a) • ={<c,a,p,s>|<c,a> Applications(c) <c,d>Descriptions(c)a-1d • pψ(d)<p,d>Descriptions(p) • <p,k>Signatures(p)d-1k • <p,s> Services(p)k∝-1s} • 简记为as

  48. Services • ={<p,s>|<p,s>Services(p) pProvider} • Signatures • ={<p,k>|pProvider<p,k>Signatures(p)} • Descriptions • ={<p,d>|pProvider<p,d>Descriptions(p)} ∪{<r,d>|r Registry<r,d> Descriptions(r)} ∪{<c, d>|cConsumer<c,d>Description(c)} • Applications • ={<p,a>|pProvider<p,a>Applications(c)}

More Related