protege构建本体教程.ppt

上传人:小飞机 文档编号:5445493 上传时间:2023-07-07 格式:PPT 页数:49 大小:410.50KB
返回 下载 相关 举报
protege构建本体教程.ppt_第1页
第1页 / 共49页
protege构建本体教程.ppt_第2页
第2页 / 共49页
protege构建本体教程.ppt_第3页
第3页 / 共49页
protege构建本体教程.ppt_第4页
第4页 / 共49页
protege构建本体教程.ppt_第5页
第5页 / 共49页
点击查看更多>>
资源描述

《protege构建本体教程.ppt》由会员分享,可在线阅读,更多相关《protege构建本体教程.ppt(49页珍藏版)》请在三一办公上搜索。

1、protege构建本体教程,1.什么是本体(Ontologie),Ontologies are used to capture knowledge about some domain of interest.本体是用来获得你所感兴趣的领域的知识;,2.OWL Ontologies,The most recent development in standard ontology languages is OWL from the World Wide Web Consortium(W3C)由w3c从斯坦福大学的本体语言发展而来的。,3.OWL Ontologies的组成,OWL Ontologi

2、es与基于Protege frame的本体语言在组成上比较相似,但是从专业术语上来描述时他们又有着细微的不同。OWL Ontologies是由个体(Individuals),属性(Properties),类(Classes)组成,大致对应于Protege frame的Instances,Slots,Classes.,3.1 Individuals(个体)指的是在域(domain)中我们感兴趣的对象。类中的一个实例。Individuals必须明确的声明彼此之间是否相同。不同的名字可能指的是相同的Individuals。,3.2 Properties(属性)指的是Individuals上二元关系,

3、他连接着两个Individuals。如:小三的父亲叫大三。其中,“的父亲叫”就连接着小三和大三两个Individuals。Properties可以存在reverse,如上所示,“的父亲叫”的reverse就是“的儿子叫”。Properties可以被限定成单值,此时Properties是functional的。(后面介绍)Properties也可以是transitive(可传递的)或symmetric(对称的)(后面介绍),3.3 Classes可以看作是包含Individuals的集合。我们使用正式而精准的形式来描述Classes。Classes通常被组织成supperclasssubclas

4、s形式的层状结构,比如,动物和狗。,4 创建本体myPizza,(PizzaBase是Pizza结构之一,中文叫“饼底”,主要由面粉做成,是Pizza的主体,和pizza toppings(比萨饼面)一起构成整个Pizza),4.1 命名一个Classes(采用单词首字母大写方式,类似于java中类的命名)一个初始化的本体包含一个名字叫做Thing的classes,他表示包含所有individuals的集合,所以,所有的其他classes都是他的subclasses。,4.2 Disjoint(解体)Classes如果任意一个Individuals(或Object)仅仅是众多Classes中某

5、一个的实例(instance),那么这些Classes是Disjoint的。,4.3 Using The OWL Tools To Create Classes,【PizzaBase 子类 ThinAndCrispy 和 DeepPan】PizzaTopping子类如下CheeseMozzarellaParmezanMeatHamPepperoniSalamiSpicyBeefSeaFoodAnchovyPrawnTunaVegtableCaperMushroomOliveOnionPepperRedPepperGreenPepperJalapenoPepperTomato,4.4 subcl

6、ass到底是什么意思呢?,例如“狗”是“动物”的subclass。那么“狗”的instance也是“动物”的instance,一个东西是狗,那么他一定是动物。(这和java中的子类父类貌似是一样的),4.5.OWL Properties,(概述)OWL Properties represent relationships.There are two main types of properties,Object properties and Datatype properties.Object properties are relationships between two individua

7、ls.(先介绍Object properties)如下是Object properties 和 Datatype properties,Object properties link an individual to an individual.【hasIngredien 子 hasBase hasTopping】我们可以创建Sub properties,它用来限定Supper properties的范围。For example,the property hasFather might specialise(限定范围)the more general property of hasParent.

8、小明有父亲大明,那么我们也可以说小明的双亲有大明。“有父亲”就是“有双亲”的subproperty。,4.6 Inverse Properties(逆属性)【isIngredientOf 子 isBaseOf isToppingOf】如该例中:hasBase 和 isBaseOf就是一对Inverse PropertiesFor example:if Matthew hasParent Jean,then the inverse property we can infer that Jean hasChild Matthew.,4.7 OWL Object Property Character

9、istics(特征)OWL允许通过使用property characteristics来增强properties的含义(内涵)。,(1)Functional Properties,If a property is functional,for a given individual,there can be at most one individual that is related to the individual via the property.也就是说,Properties是单值的。例如:hasBirthMother,这个就是functional的,因为一个人他只能有一个生母。,另外:

10、If we say that the individual Jean hasBirthMother Lily and we also say that the individual Jean hasBirthMother Mary,then because hasBirthMother is a functional property,we can infer that Lily and Mary must be the same individual.但是如果Lily和Mary明确的声明为两个不同的Individuals,那么就会出现矛盾(inconsistency)。,(2)Inverse

11、 Functional Properties,就是Functional Properties 的 inverse 如下:,(3)Transitive Properties,If a property is transitive,and the property relates individual a to individual b,and also individual b to individual c,then we can infer that individual a is related to individual c via property P.如下:,注:a)If a pro

12、perty is transitive then its inverse property should also be transitive.(祖先那个例子)b)if a property is transitive then it cannot be functional.,(4)Symmetric(对称)Properties,If a property P is symmetric,and the property relates individual a to individual b then individual b is also related to individual a

13、via property P.如下:,(5)Antisymmetric(反对称)properties,If a property P is antisymmetric,and the property relates individual a to individual b then individual b cannot be related to individual a via property P.如下:,(6)Reexive(自反)properties,A property P is said to be reexive when the property must relate i

14、ndividual a to itself.如下:,(7)Irreexive(非自反)properties,If a property P is irreexive,it can be described as a property that relates an individual a to individual b,where individual a and individual b are not the same.也就是说,这种properties只能连接不同的individuals。如:小明的父亲是大明,那么我们不能说小明的父亲是小明,4.8 Property Domains a

15、nd Ranges,【定义 hasTopping 的 Range PizzaTopping domain Pizza】【定义 isToppingOf 的 Range Pizza domain PizzaTopping】Properties may have a domain and a range specied(指定的).Properties link individuals from the domain to individuals from the range.例如:in myPizza 本体,the property hasTopping would probably link in

16、dividuals belonging the the class Pizza to individuals belonging to the class of PizzaTopping.In this case the domain of the hasTopping property is Pizza and the range is PizzaTopping。另外:如果有 a hasTopping b,并且a与b都是individuals,那么我们就可以说a属于class Pizza,b属于class PizzaTopping。通常来说,domain for a property is

17、the range for its inverse,and the range for a property is the domain for its inverse,4.9描述和定义Classes,4.9.1 Property RestrictionsOwl的restriction有三种:Quantifier RestrictionsCardinality RestrictionshasValue Restrictions.,1.quantifier restrictions(existential restrictions 和 universal restrictions),Existe

18、ntial restrictions:describe classes of individuals that participate in at least one relationship along a specied property to individuals that are members of a specied class.例子:我至少(at least one)买了一袋饼干从好又多超市。再比如:我做的蛋糕,上面至少覆盖了一层紫色奶酪,【Pizza 限制 hasBase some PizzaBase】,universal restrictions:,describe cla

19、sses of individuals that for a given property only have relationships along this property to individuals that are members of a specified class.例子:我买的东西都是从好又多市(或者我买东西只(only)从好又多超市)注:A restriction describes an anonymous class(an unnamed class).The anonymous class contains all of the individuals that s

20、atisfy the restriction。例如:Existential restrictions“上面至少覆盖了一层紫色奶酪。”这句话就描述了一个匿名类,任何上面覆盖至少一层紫色奶酪的individuals都属于该匿名类的,“我做的蛋糕”这个类也属于这个匿名类。所以当我们对一个类进行限制时,在supperclass里定义。,2 定义一些其他的类(一些使用技巧),【Pizza 子类 NamedPizza】【NamedPizza 子类MargheritaPizza has at least one toppings of MozzarellaTopping and TomatoTopping】

21、【创建AmericanaPizza 通过克隆 MargheritaPizza 因为他扩展了一个限制 PepperoniTopping】【创建AmericanHotPizza 通过克隆 AmericanaPizza 增加限制JalapenoPepperTopping】【创建SohoPizza 克隆MargheritaPizza 增加OliveTopping 和ParmezanTopping】,4.10 使用Reasoner(推理机),the reasoner shipped with Protege is called Fact+.两种hierarchy:In Protege 4 the man

22、ually constructed class hierarchy is called the asserted hierarchy.The class hierarchy that is automatically computed by the reasoner is called the inferred hierarchy.主要功能:1,判断一个类是否是另一个类的子类2,consistency checking(一致性检测)【为了使用推理机,我们先定义一个矛盾的类ProbeInconsistentTopping,让他既是CheeseTopping 又是 VegetableTopping

23、的子类,前提是这两个类是disjoint的】:If a class has been found to be inconsistent its icon will be highlighted in red.【将CheeseTopping VegetableTopping 设为非disjoint的之后,再Classify,观察结果】,4.11 充分必要条件(primitive class 和 defined class),All of the classes that we have created so far have only used necessary conditions to d

24、escribe them.Necessary conditions can be read as,“If something is a member of this class then it is necessary to fulfill these conditions”.With necessary conditions alone,we cannot say that,“If something fulfills these conditions then it must be a member of this class”.只定义了必要条件的类叫做primitive class定义了

25、充要条件的类叫做 defined class【定义Pizza的子类CheesyPizza定义限制hasTopping some CheeseTopping】【将其转化为充分必要条件】【Classify 我们可以看出defined class 的不同】总结:if class A is now defined using necessary and sufficient conditions,we can say that if an individual is a member of the class A it must satisfy the conditions and we can no

26、w say that if any(random)individual satises these conditions then it must be a member of class A.,4.12 Automated Classification(自动分类),为什么要使用Reasoner。当我们创建了成百上千的类时,使用Reasoner来自动计算子类父类之间的关系将是十分必要的。没有了Reasoner我们很难保证 大规模本体的健壮性和逻辑性。自动分类这项技术,使得本体可维护并且模块化,它不仅使得其他的本体和程序能够reuse 我们定义的本体,而且还最大限度的减少了使用者在建立多继承类时

27、的错误。【使用OWLViz 显示类的继承层次结构】,4.13 Universal Restrictions(Quantifier Restrictions),【创建一个Pizza的子类VegetarianPizza】【增加限制 hasTopping only(CheeseTopping or VegtableTopping)】This means that if something is a member of the class VegetarianPizza it is necessary for it to be a kind of Pizza and it is necessary f

28、or it to only(universal quantier)have toppings that are kinds of CheeseTopping or kinds of VegetableTopping,也可以没有,比如,中国现在实行计划生育,如果夫妻有了孩子那么只能有一个,但是这个夫妻也可以没有孩子。那么就不存在only这个限制。【将上面的必要条件转化为充分条件】,4.14 Automated Classification and Open World Reasoning,【使用推理机进行自动分类】我们发现MargheritaPizza 和SohoPizza 并没有被归类为 Ve

29、getarianPizza的子类,但是按照我们的定义,MargheritaPizza 和 SohoPizza 都至少有个蔬菜的顶部和奶酪的顶部,再看VegetarianPizza 的充要条件,only have 蔬菜的顶部和奶酪的顶部的pizza都是VegetarianPizza。但是Reasoning in OWL(Description Logics)is based on what is known as the open world assumption(OWA),意思是,除非我们明确的说明某个事物的存在,否则我们就不能说他是存在的。分析上面的:因为我们没有明确的指定他们只有奶酪和蔬菜

30、顶,那么他们就可以有其他的顶部。这样的话,他们就不符合VegetarianPizza 的充要条件了。为了使这两种pizza只有蔬菜和奶酪顶部,我们就得在hasTopping上使用closure axiom(封闭公理),4.14.1 Closure Axioms(封闭公理),it can only be filled by the specified fillers.The restriction has a filler that is the union of the fillers that occur in the existential restrictions for the pro

31、perty。【为MargheritaPizza 的 hasTopping 添加封闭公理】【hasTopping only(MozzarellaTopping or TomatoTopping)】【为其他几个pizza使用更方便的方法添加封闭公理】现在我们可以说,MargheritaPizza 至少有一个MozzarellaTopping和TomatoTopping,并且the toppings must only be kinds of MozzarellaTopping or TomatoTopping。【Classify之后我们看结果】,4.15 Value Partitions,Valu

32、e Partitionsare他并不属于任何一种本体语言的一部分,而是一种设计模式,类似于面向对象程序设计中的设计模式。它可以改善我们对类的描述。【创建thing的子类ValuePartition】【ValuePartition的子类SpicinessValuePartition(Hot Medium Mild)】【创建Object Property hasSpiciness 并使其functional】【为SpicinessValuePartition 增加covering axiom 在equivalent里面输入Hot or Medium or Mild】,这种设计模式的效果我们可以看个

33、对比图:disjoint(关键词),4.16 Adding Spiciness to Pizza Toppings,【对PepperTopping的所有子类设置必要条件 hasSpiciness some Hot】【定义Pizza的子类SpicyPizza 设置必要条件:hasTopping some(PizzaTopping and hasSpiciness some Hot)】【将必要条件化为充要条件】Fillter描述了一个匿名类,这个顶是Pizzatopping,并且特别辣。【Classifiy之后我们发现AmericanHotPizza 成为了SpicyPizza的子类】,4.17

34、Cardinality Restrictions(Owl的restriction中的第二种),describe the class of individuals that have at least(min),at most(max)or exactly a specified number(exactly)of relationships with other individuals or datatype values.【创建Pizza的子类InterestingPizza 定义必要条件hasTopping min 3】注意:我们这里3后面并没有指定fillter是什么,代表可以是任意的i

35、ndividuals,等价于:hasTopping min 3 Thing【转化为充要条件】【Classify之后观察。】,4.18 Qualified(受限的)Cardinality Restrictions,他比上面的more specify【定义NamedPizza的子类FourCheesePizza 定义必要条件hasTopping exactly 4 CheeseTopping】,5.Datatype Properties,describe relationships between an individual and data values.【现在来描述pizza所含的热量】【增加

36、Datatype Properties hasCalorificContentValue】【增加individual ExampleMargherita其 type是MargheritaPizza】【为该对象增加Data Property assertion 其中type选择integer 值填写250】【增加individual ExampleSoho其 type是SohoPizza】【为该对象增加Data Property assertion 其中type选择integer 值填写800】,我们声明所有的pizza都有热量值【选定Pizza类,增加Supperclass 选择Data re

37、striction creator】我们对pizza的热量值进行分类,产生不同的pizza【创建HighCaloriePizza 和LowCaloriePizza 作为Pizza的子类】【创建SupperClass 选择Class expression editor】【键入Pizza that hasCalorificContentValue some integer=400】【同理LowCaloriePizza应当是 400】【分别将他们设为充要条件】【Classify之后我们看他们的members】某一确定的Pizza他所含的热量是固定的,也就是说是单值的,我们可以使用functional

38、来限定Data Property。【选定hasCalorificContentValue 选中functional】,6.More On Open World Reasoning,这部分主要展示了Open World Reasoning中的细微差别【创建NonVegetarianPizza 类,作为VegetarianPizza类的complement】【使他们disjoint】【双击Supperclass中的pizza,添加Pizza and not VegetarianPizza】【转换为充分必要条件】【Classify.之后观察】我们创建一个类,does not have a closu

39、re axiom(封闭公理)on the hasTopping property【创建NamedPizza的子类UnclosedPizza】【必要条件:hasTopping some MozzarellaTopping】【Classify.之后观察UnclosedPizza 既不是VegetarianPizza也不是NonVegetarianPizza.】前面封闭公理部分已经讲过了原因。,我们创建一个类,does not have a closure axiom(封闭公理)on the hasTopping property【创建NamedPizza的子类UnclosedPizza】【必要条件

40、:hasTopping some MozzarellaTopping】【Classify.之后观察UnclosedPizza 既不是VegetarianPizza也不是NonVegetarianPizza.】前面封闭公理部分已经讲过了原因。,7.Creating Other OWL Constructs,7.1 Creating Individuals我们现在来描述pizza饼起源的国家;【创建Thing 的子类Country】【创建 individual:Italy England America France】因为相同的individual可以有不同的名称。【是他们Different fr

41、om each other】,7.2 hasValue Restrictions(Owl的restriction中的第三种)描述的是两个individual之间至少有的关系P,【创建Object property:hasCountryOfOrigin】【选定MozzarellaTopping 增加必要条件hasCountryOfOrigin value Italy】,7.3 Enumerated Classes【选定Country类,在Equivalent class处增加America,England,France,Italy】意思是如果一个individual他属于Country,那么他一定属于这几个国家中的一个。,

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号