protege构建本体教程课件

上传人:文**** 文档编号:241916682 上传时间:2024-08-05 格式:PPT 页数:49 大小:508.33KB
返回 下载 相关 举报
protege构建本体教程课件_第1页
第1页 / 共49页
protege构建本体教程课件_第2页
第2页 / 共49页
protege构建本体教程课件_第3页
第3页 / 共49页
点击查看更多>>
资源描述
protege构建本体教程构建本体教程1Aprotege构建本体教程1A1.什么是本体(什么是本体(Ontologie)Ontologiesareusedtocaptureknowledgeaboutsomedomainofinterest.本体是用来获得你所感兴趣的领域的知识;2A1.什么是本体(Ontologie)Ontologiesa2.OWL OntologiesThemostrecentdevelopmentinstandardontologylanguagesisOWLfromtheWorldWideWebConsortium(W3C)由w3c从斯坦福大学的本体语言发展而来的。3A2.OWLOntologiesThemostrecen 3.OWL Ontologies的的组成成OWLOntologies与基于Protegeframe的本体语言在组成上比较相似,但是从专业术语上来描述时他们又有着细微的不同。OWLOntologies是由个体(Individuals),属性(Properties),类(Classes)组成,大致对应于Protegeframe的Instances,Slots,Classes.4A3.OWLOntologies的组成OWLOntol3.1 Individuals(个体)指的是在域(domain)中我们感兴趣的对象。类中的一个实例。Individuals必须明确的声明彼此之间是否相同。不同的名字可能指的是相同的Individuals。5A3.1Individuals(个体)5A3.2 Properties(属性)指的是Individuals上二元关系,他连接着两个Individuals。如:小三的父亲叫大三。其中,“的父亲叫”就连接着小三和大三两个Individuals。Properties可以存在reverse,如上所示,“的父亲叫”的reverse就是“的儿子叫”。Properties可以被限定成单值,此时Properties是functional的。(后面介绍)Properties也可以是transitive(可传递的)或symmetric(对称的)(后面介绍)6A3.2Properties(属性)6A3.3 Classes可以看作是包含Individuals的集合。我们使用正式而精准的形式来描述Classes。Classes通常被组织成supperclasssubclass形式的层状结构,比如,动物和狗。7A3.3Classes7A4 创建本体建本体myPizza(PizzaBase是Pizza结构之一,中文叫“饼底”,主要由面粉做成,是Pizza的主体,和pizzatoppings(比萨饼面)一起构成整个Pizza)8A4创建本体myPizza(PizzaBase是Pizza结4.1 命名一个命名一个Classes(采用单词首字母大写方式,类似于java中类的命名)一个初始化的本体包含一个名字叫做Thing的classes,他表示包含所有individuals的集合,所以,所有的其他classes都是他的subclasses。9A4.1命名一个Classes(采用单词首字母大写方式,类似4.2 Disjoint(解体)(解体)Classes如果任意一个Individuals(或Object)仅仅是众多Classes中某一个的实例(instance),那么这些Classes是Disjoint的。10A4.2Disjoint(解体)Classes10A4.3 Using The OWL Tools To Create Classes【PizzaBase子类ThinAndCrispy和DeepPan】PizzaTopping子类如下CheeseMozzarellaParmezanMeatHamPepperoniSalamiSpicyBeefSeaFoodAnchovyPrawnTunaVegtableCaperMushroomOliveOnionPepperRedPepperGreenPepperJalapenoPepperTomato11A4.3UsingTheOWLToolsToC4.4 subclass到底是什么意思呢到底是什么意思呢?例如“狗”是“动物”的subclass。那么“狗”的instance也是“动物”的instance,一个东西是狗,那么他一定是动物。(这和java中的子类父类貌似是一样的)12A4.4subclass到底是什么意思呢?例如“狗”是“动13A13A4.5.OWL Properties(概述)OWLPropertiesrepresentrelationships.Therearetwomaintypesofproperties,ObjectpropertiesandDatatypeproperties.Objectpropertiesarerelationshipsbetweentwoindividuals.(先介绍Objectproperties)如下是Objectproperties和Datatypeproperties14A4.5.OWLProperties(概述)OWLPObjectpropertieslinkanindividualtoanindividual.【hasIngredien子hasBasehasTopping】我们可以创建Subproperties,它用来限定Supperproperties的范围。Forexample,thepropertyhasFathermightspecialise(限定范围)themoregeneralpropertyofhasParent.小明有父亲大明,那么我们也可以说小明的双亲有大明。“有父亲”就是“有双亲”的subproperty。15AObjectpropertieslinkanindi4.6 InverseProperties(逆属性)【isIngredientOf子isBaseOfisToppingOf】如该例中:hasBase和isBaseOf就是一对InversePropertiesForexample:ifMatthewhasParentJean,thentheinversepropertywecaninferthatJeanhasChildMatthew.16A4.6InverseProperties(逆属性)164.7 OWL Object Property Characteristics(特征)(特征)OWL允许通过使用propertycharacteristics来增强properties的含义(内涵)。17A4.7OWLObjectPropertyCha(1)FunctionalPropertiesIfapropertyisfunctional,foragivenindividual,therecanbeatmostoneindividualthatisrelatedtotheindividualviatheproperty.也就是说,Properties是单值的。例如:hasBirthMother,这个就是functional的,因为一个人他只能有一个生母。18A(1)FunctionalPropertiesIfa另外:IfwesaythattheindividualJeanhasBirthMother LilyandwealsosaythattheindividualJeanhasBirthMotherMary,thenbecausehasBirthMotherisafunctional property,wecaninferthatLilyandMarymustbethesameindividual.但是如果Lily和Mary明确的声明为两个不同的Individuals,那么就会出现矛盾(inconsistency)。19A另外:19A(2)InverseFunctionalProperties就是FunctionalProperties的inverse如下:20A(2)InverseFunctionalProper(3)TransitivePropertiesIfapropertyistransitive,andthepropertyrelatesindividualato individualb,andalsoindividualbtoindividualc,thenwecaninferthatindividualaisrelatedtoindividualcviapropertyP.如下:注:a)Ifapropertyistransitivethenitsinversepropertyshouldalsobetransitive.(祖先那个例子)b)ifapropertyistransitivethenitcannotbefunctional.21A(3)TransitivePropertiesIfa(4)Symmetric(对称)PropertiesIfapropertyPissymmetric,andthepropertyrelatesindividualatoindividualbthenindividualbisalsorelatedtoindividualaviapropertyP.如下:22A(4)Symmetric(对称)PropertiesIf(5)Antisymmetric(反对称)propertiesIfapropertyPisantisymmetric,andthepropertyrelatesindividualatoindividualbthenindividualbcannotberelatedtoindividualaviapropertyP.如下:23A(5)Antisymmetric(反对称)propert(6)Reflexive(自反)propertiesApropertyPissaidtobereflexivewhenthepropertymustrelateindividualatoitself.如下:24A(6)Reflexive(自反)propertiesAp(7)Irreflexive(非自反)propertiesIfapropertyPisirreflexive,itcanbedescribedasapropertythatrelatesanindividualatoindividualb,whereindividualaandindividualbarenotthesame.也就是说,这种properties只能连接不同的individuals。如:小明的父亲是大明,那么我们不能说小明的父亲是小明25A(7)Irreflexive(非自反)properties4.8 Property Domains and Ranges【定义hasTopping的RangePizzaToppingdomainPizza】【定义isToppingOf的RangePizzadomainPizzaTopping】Propertiesmayhaveadomainandarangespecified(指定的).Propertieslinkindividualsfromthedomaintoindividualsfromtherange.例如:inmyPizza本体,thepropertyhasToppingwouldprobablylinkindividualsbelongingthetheclassPizzatoindividualsbelongingtotheclassofPizzaTopping.InthiscasethedomainofthehasToppingpropertyisPizzaandtherangeisPizzaTopping。另外:如果有ahasToppingb,并且a与b都是individuals,那么我们就可以说a属于classPizza,b属于classPizzaTopping。通常来说,domainforapropertyistherangeforitsinverse,andtherangeforapropertyisthedomainforitsinverse26A4.8PropertyDomainsandRange4.9描述和定描述和定义Classes4.9.1PropertyRestrictionsOwl的restriction有三种:QuantifierRestrictionsCardinalityRestrictionshasValueRestrictions.27A4.9描述和定义Classes4.9.1Property1.quantifierrestrictions(existentialrestrictions和universalrestrictions)Existentialrestrictions:describeclassesofindividualsthatparticipateinat least onerelationshipalongaspecifiedpropertytoindividualsthataremembersofaspecifiedclass.例子:我至少(atleastone)买了一袋饼干从好又多超市。再比如:我做的蛋糕,上面至少覆盖了一层紫色奶酪28A1.quantifierrestrictions(ex【Pizza限制hasBasesomePizzaBase】29A【Pizza限制hasBasesomePizzaBauniversalrestrictions:describeclassesofindividualsthatforagivenpropertyonlyhaverelationshipsalongthispropertytoindividualsthataremembersofaspecifiedclass.例子:我买的东西都是从好又多市(或者我买东西只(only)从好又多超市)注:Arestrictiondescribesananonymousclass(anunnamedclass).Theanonymousclasscontainsalloftheindividualsthatsatisfytherestriction。例如:Existentialrestrictions“上面至少覆盖了一层紫色奶酪。”这句话就描述了一个匿名类,任何上面覆盖至少一层紫色奶酪的individuals都属于该匿名类的,“我做的蛋糕”这个类也属于这个匿名类。所以当我们对一个类进行限制时,在supperclass里定义。30Auniversalrestrictions:des2定义一些其他的类(一些使用技巧)【Pizza子类NamedPizza】【NamedPizza 子类MargheritaPizza hasatleastonetoppingsofMozzarellaToppingandTomatoTopping】【创建AmericanaPizza通过克隆MargheritaPizza 因为他扩展了一个限制PepperoniTopping】【创建AmericanHotPizza通过克隆AmericanaPizza增加限制JalapenoPepperTopping】【创建SohoPizza克隆MargheritaPizza 增加OliveTopping和ParmezanTopping】31A2定义一些其他的类(一些使用技巧)【Pizza子类4.10 使用使用Reasoner(推理机)(推理机)thereasonershippedwithProtegeiscalledFact+.两种hierarchy:InProtege4themanuallyconstructedclasshierarchyiscalledtheasserted hierarchy.Theclasshierarchythatisautomaticallycomputedbythereasoneriscalledtheinferred hierarchy.主要功能:1,判断一个类是否是另一个类的子类2,consistencychecking(一致性检测)【为了使用推理机,我们先定义一个矛盾的类ProbeInconsistentTopping,让他既是CheeseTopping又是VegetableTopping的子类,前提是这两个类是disjoint的】:Ifaclasshasbeenfoundtobeinconsistentitsiconwillbehighlightedinred.【将CheeseTopping VegetableTopping 设为非disjoint的之后,再Classify,观察结果】32A4.10使用Reasoner(推理机)thereason4.11 充分必要条件充分必要条件(primitive class 和和 defined class)Alloftheclassesthatwehavecreatedsofarhaveonlyusednecessaryconditionstodescribethem.Necessaryconditionscanbereadas,“Ifsomethingisamemberofthisclassthenitisnecessarytofulfilltheseconditions”.Withnecessaryconditionsalone,wecannotsaythat,“Ifsomethingfulfillstheseconditionsthenitmustbeamemberofthisclass”.只定义了必要条件的类叫做primitiveclass定义了充要条件的类叫做definedclass【定义Pizza的子类CheesyPizza定义限制hasTopping some CheeseTopping】【将其转化为充分必要条件】【Classify我们可以看出definedclass的不同】总结:ifclassAisnowdefinedusingnecessaryandsufficientconditions,wecansaythatifanindividualisamemberoftheclassAitmustsatisfytheconditionsandwecannowsaythatifany(random)individualsatisfiestheseconditionsthenitmustbeamemberofclassA.33A4.11充分必要条件(primitiveclass和4.12 Automated Classification(自(自动分分类)为什么要使用Reasoner。当我们创建了成百上千的类时,使用Reasoner来自动计算子类父类之间的关系将是十分必要的。没有了Reasoner我们很难保证大规模本体的健壮性和逻辑性。自动分类这项技术,使得本体可维护并且模块化,它不仅使得其他的本体和程序能够reuse我们定义的本体,而且还最大限度的减少了使用者在建立多继承类时的错误。【使用OWLViz显示类的继承层次结构】34A4.12AutomatedClassification4.13 Universal Restrictions (Quantifier Restrictions)【创建一个Pizza的子类VegetarianPizza】【增加限制hasToppingonly(CheeseToppingorVegtableTopping)】ThismeansthatifsomethingisamemberoftheclassVegetarianPizzaitisnecessaryforittobeakindofPizzaanditisnecessaryforittoonly(universalquantifier)havetoppingsthatarekindsofCheeseToppingorkindsofVegetableTopping,也可以没有,比如,中国现在实行计划生育,如果夫妻有了孩子那么只能有一个,但是这个夫妻也可以没有孩子。那么就不存在only这个限制。【将上面的必要条件转化为充分条件】35A4.13UniversalRestrictions(4.14 Automated Classification and Open World Reasoning 【使用推理机进行自动分类】我们发现MargheritaPizza和SohoPizza并没有被归类为VegetarianPizza的子类,但是按照我们的定义,MargheritaPizza 和SohoPizza 都至少有个蔬菜的顶部和奶酪的顶部,再看VegetarianPizza 的充要条件,onlyhave蔬菜的顶部和奶酪的顶部的pizza都是VegetarianPizza。但是Reasoning in OWL(DescriptionLogics)isbasedonwhatisknownastheopen world assumption(OWA),意思是,除非我们明确的说明某个事物的存在,否则我们就不能说他是存在的。分析上面的:因为我们没有明确的指定他们只有奶酪和蔬菜顶,那么他们就可以有其他的顶部。这样的话,他们就不符合VegetarianPizza 的充要条件了。为了使这两种pizza只有蔬菜和奶酪顶部,我们就得在hasTopping上使用closure axiom(封闭公理)36A4.14AutomatedClassification4.14.1ClosureAxioms(封闭公理)itcanonlybefilledbythespecifiedfillers.Therestrictionhasafillerthatistheunionofthefillersthatoccurintheexistential restrictionsfortheproperty。【为MargheritaPizza 的 hasTopping 添加封闭公理】【hasToppingonly(MozzarellaToppingorTomatoTopping)】【为其他几个pizza使用更方便的方法添加封闭公理】现在我们可以说,MargheritaPizza 至少有一个MozzarellaTopping和TomatoTopping,并且thetoppingsmustonlybekindsofMozzarellaToppingorTomatoTopping。【Classify之后我们看结果】37A4.14.1ClosureAxioms(封闭公理)i4.15 Value PartitionsValuePartitionsare他并不属于任何一种本体语言的一部分,而是一种设计模式,类似于面向对象程序设计中的设计模式。它可以改善我们对类的描述。【创建thing的子类ValuePartition】【ValuePartition的子类SpicinessValuePartition(Hot Medium Mild)】【创建ObjectPropertyhasSpiciness 并使其functional】【为SpicinessValuePartition 增加coveringaxiom在equivalent里面输入HotorMediumorMild】38A4.15ValuePartitionsValuePa这种设计模式的效果我们可以看个对比图:disjoint(关键词)39A这种设计模式的效果我们可以看个对比图:disjoint(关键4.16 Adding Spiciness to Pizza Toppings【对PepperTopping的所有子类设置必要条件hasSpicinesssomeHot】【定义Pizza的子类SpicyPizza设置必要条件:hasToppingsome(PizzaToppingandhasSpicinesssomeHot)】【将必要条件化为充要条件】Fillter描述了一个匿名类,这个顶是Pizzatopping,并且特别辣。【Classifiy之后我们发现AmericanHotPizza成为了SpicyPizza的子类】40A4.16AddingSpicinesstoPizz4.17 Cardinality Restrictions(Owl的的restriction中的中的第二种)第二种)describetheclassofindividualsthathaveatleast(min),atmost(max)orexactlyaspecifiednumber(exactly)ofrelationshipswithotherindividualsordatatypevalues.【创建Pizza的子类InterestingPizza定义必要条件hasToppingmin3】注意:我们这里3后面并没有指定fillter是什么,代表可以是任意的individuals,等价于:hasToppingmin3Thing【转化为充要条件】【Classify之后观察。】41A4.17CardinalityRestrictions4.18 Qualified(受限的)(受限的)Cardinality Restrictions他比上面的morespecify【定义NamedPizza的子类FourCheesePizza定义必要条件hasToppingexactly4CheeseTopping】42A4.18Qualified(受限的)Cardinali5.Datatype Propertiesdescriberelationshipsbetweenanindividualanddatavalues.【现在来描述pizza所含的热量】【增加DatatypePropertieshasCalorificContentValue】【增加individualExampleMargherita其type是MargheritaPizza】【为该对象增加DataPropertyassertion其中type选择integer值填写250】【增加individualExampleSoho其type是SohoPizza】【为该对象增加DataPropertyassertion其中type选择integer值填写800】43A5.DatatypePropertiesdescrib我们声明所有的pizza都有热量值【选定Pizza类,增加Supperclass选择Datarestrictioncreator】我们对pizza的热量值进行分类,产生不同的pizza【创建HighCaloriePizza和LowCaloriePizza作为Pizza的子类】【创建SupperClass选择Classexpressioneditor】【键入PizzathathasCalorificContentValuesomeinteger=400】【同理LowCaloriePizza应当是400】【分别将他们设为充要条件】【Classify之后我们看他们的members】某一确定的Pizza他所含的热量是固定的,也就是说是单值的,我们可以使用functional来限定DataProperty。【选定hasCalorificContentValue选中functional】44A我们声明所有的pizza都有热量值44A6.More On Open World Reasoning这部分主要展示了OpenWorldReasoning中的细微差别【创建NonVegetarianPizza类,作为VegetarianPizza类的complement】【使他们disjoint】【双击Supperclass中的pizza,添加PizzaandnotVegetarianPizza】【转换为充分必要条件】【Classify.之后观察】我们创建一个类,doesnothaveaclosureaxiom(封闭公理)onthehasToppingproperty【创建NamedPizza的子类UnclosedPizza】【必要条件:hasToppingsomeMozzarellaTopping】【Classify.之后观察UnclosedPizza既不是VegetarianPizza也不是NonVegetarianPizza.】前面封闭公理部分已经讲过了原因。45A6.MoreOnOpenWorldReasoni我们创建一个类,doesnothaveaclosureaxiom(封闭公理)onthehasToppingproperty【创建NamedPizza的子类UnclosedPizza】【必要条件:hasToppingsomeMozzarellaTopping】【Classify.之后观察UnclosedPizza既不是VegetarianPizza也不是NonVegetarianPizza.】前面封闭公理部分已经讲过了原因。46A我们创建一个类,doesnothaveaclosu7.Creating Other OWL Constructs7.1CreatingIndividuals我们现在来描述pizza饼起源的国家;【创建Thing的子类Country】【创建individual:ItalyEnglandAmericaFrance】因为相同的individual可以有不同的名称。【是他们Differentfromeachother】47A7.CreatingOtherOWLConstruc7.2hasValueRestrictions(Owl的的restriction中的第三种中的第三种)描述的是两个individual之间至少有的关系P,【创建Objectproperty:hasCountryOfOrigin】【选定MozzarellaTopping增加必要条件hasCountryOfOriginvalueItaly】48A7.2hasValueRestrictions(Owl7.3EnumeratedClasses【选定Country类,在Equivalentclass处增加America,England,France,Italy】意思是如果一个individual他属于Country,那么他一定属于这几个国家中的一个。49A7.3EnumeratedClasses49A
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 教学培训


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!