protege構(gòu)建本體教程_第1頁
protege構(gòu)建本體教程_第2頁
protege構(gòu)建本體教程_第3頁
protege構(gòu)建本體教程_第4頁
protege構(gòu)建本體教程_第5頁
已閱讀5頁,還剩45頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

protege構(gòu)建本體教程protege構(gòu)建本體教程1.什么是本體(Ontologie)Ontologiesareusedtocaptureknowledgeaboutsomedomainofinterest. 本體是用來獲得你所感興趣的領(lǐng)域的知識(shí);protege構(gòu)建本體教程2.OWLOntologiesThemostrecentdevelopmentinstandardontologylanguagesisOWLfromtheWorldWideWebConsortium(W3C)由w3c從斯坦福大學(xué)的本體語言發(fā)展而來的。protege構(gòu)建本體教程

3.OWLOntologies的組成 OWLOntologies與基于Protegeframe的本體語言在組成上比較相似,但是從專業(yè)術(shù)語上來描述時(shí)他們又有著細(xì)微的不同。OWLOntologies是由個(gè)體(Individuals),屬性(Properties),類(Classes)組成,大致對(duì)應(yīng)于Protegeframe的Instances,Slots,Ctege構(gòu)建本體教程3.1Individuals(個(gè)體)

指的是在域(domain)中我們感興趣的對(duì)象。類中的一個(gè)實(shí)例。 Individuals必須明確的聲明彼此之間是否相同。不同的名字可能指的是相同的Itege構(gòu)建本體教程3.2Properties(屬性)

指的是Individuals上二元關(guān)系,他連接著兩個(gè)Individuals。如:小三的父親叫大三。其中,“的父親叫”就連接著小三和大三兩個(gè)Individuals。 Properties可以存在reverse,如上所示,“的父親叫”的reverse就是“的兒子叫”。 Properties可以被限定成單值,此時(shí)Properties是functional的。(后面介紹) Properties也可以是transitive(可傳遞的)或symmetric(對(duì)稱的)(后面介紹)protege構(gòu)建本體教程3.3Classes

可以看作是包含Individuals的集合。

我們使用正式而精準(zhǔn)的形式來描述Classes。Classes通常被組織成supperclass—subclass形式的層狀結(jié)構(gòu),比如,動(dòng)物和狗。protege構(gòu)建本體教程4創(chuàng)建本體myPizza(PizzaBase是Pizza結(jié)構(gòu)之一,中文叫“餅底”,主要由面粉做成,是Pizza的主體,和pizzatoppings(比薩餅面)一起構(gòu)成整個(gè)Pizza)protege構(gòu)建本體教程4.1命名一個(gè)Classes(采用單詞首字母大寫方式,類似于java中類的命名)一個(gè)初始化的本體包含一個(gè)名字叫做Thing的classes,他表示包含所有individuals的集合,所以,所有的其他classes都是他的tege構(gòu)建本體教程

4.2Disjoint(解體)Classes如果任意一個(gè)Individuals(或Object)僅僅是眾多Classes中某一個(gè)的實(shí)例(instance),那么這些Classes是Disjoint的。protege構(gòu)建本體教程4.3UsingTheOWLToolsToCreateClasses

【PizzaBase子類ThinAndCrispy和DeepPan】PizzaTopping子類如下Cheese Mozzarella ParmezanMeat Ham Pepperoni Salami SpicyBeefSeaFood Anchovy Prawn TunaVegtable Caper Mushroom Olive Onion Pepper RedPepper GreenPepper JalapenoPepper Tomatoprotege構(gòu)建本體教程4.4subclass到底是什么意思呢?例如“狗”是“動(dòng)物”的subclass。那么“狗”的instance也是“動(dòng)物”的instance,一個(gè)東西是狗,那么他一定是動(dòng)物。(這和java中的子類父類貌似是一樣的)

protege構(gòu)建本體教程protege構(gòu)建本體教程4.5.OWLProperties (概述)OWLPropertiesrepresentrelationships.Therearetwomaintypesofproperties,ObjectpropertiesandDatatypeproperties.Objectpropertiesarerelationshipsbetweentwoindividuals.(先介紹Objectproperties)如下是Objectproperties和Datatypepropertiesprotege構(gòu)建本體教程Objectpropertieslinkanindividualtoanindividual.【hasIngredien子hasBasehasTopping】

我們可以創(chuàng)建Subproperties,它用來限定Supperproperties的范圍。Forexample,thepropertyhasFathermightspecialise(限定范圍)themoregeneralpropertyofhasParent.小明有父親大明,那么我們也可以說小明的雙親有大明。“有父親”就是“有雙親”的tege構(gòu)建本體教程4.6InverseProperties(逆屬性)【isIngredientOf子isBaseOfisToppingOf】如該例中::hasBase和isBaseOf就是一對(duì)InverseProperties

Forexample:ifMatthewhasParentJean,thentheinversepropertywecaninferthatJeanhasChildMtege構(gòu)建本體教程4.7OWLObjectPropertyCharacteristics(特征)OWL允許通過使用propertycharacteristics來增強(qiáng)properties的含義(內(nèi)涵)。protege構(gòu)建本體教程(1)FunctionalPropertiesIfapropertyisfunctional,foragivenindividual,therecanbeat mostoneindividualthatisrelatedtotheindividualviatheproperty.. 也就是說,Properties是單值的。例如::hasBirthMother

,這個(gè)就是functional的,因?yàn)橐粋€(gè)人他只能有一個(gè)生母。protege構(gòu)建本體教程另外::IfwesaythattheindividualJeanhasBirthMotherLilyandwealsosaythattheindividualJeanhasBirthMotherMary,thenbecausehasBirthMotherisafunctionalproperty,wecaninferthatLilyandMarymustbethesameindividual.但是如果Lily和Mary明確的聲明為兩個(gè)不同的Individuals,那么就會(huì)出現(xiàn)矛盾(inconsistency)。protege構(gòu)建本體教程

(2)InverseFunctionalProperties就是FunctionalProperties的inverse如下::protege構(gòu)建本體教程(3)TransitivePropertiesIfapropertyistransitive,andthepropertyrelatesindividualato individualb,andalsoindividualbtoindividualc,thenwecaninfer thatindividualaisrelatedtoindividualcviapropertyP.如下::注::

a)Ifapropertyistransitivethenitsinversepropertyshouldalsobetransitive.(祖先那個(gè)例子)b)

tege構(gòu)建本體教程(4)Symmetric(對(duì)稱)PropertiesIfapropertyPissymmetric,andthepropertyrelatesindividualatoindividualbthenindividualbisalsorelatedtoindividualaviapropertyP.如下::protege構(gòu)建本體教程(5)Antisymmetric(反對(duì)稱)propertiesIfapropertyPisantisymmetric,andthepropertyrelatesindividualatoindividualbthenindividualbcannotberelatedtoindividualaviapropertyP.如下::protege構(gòu)建本體教程(6)Re?exive(自反)propertiesApropertyPissaidtobere?exivewhenthepropertymustrelate individualatoitself.如下::protege構(gòu)建本體教程(7)Irre?exive(非自反)propertiesIfapropertyPisirre?exive,itcanbedescribedasapropertythatrelatesanindividualatoindividualb,whereindividualaand individualbarenotthesame.也就是說,這種properties只能連接

不同的individuals。如::小明的父親是大明,那么我們不能說小明的父親是小明protege構(gòu)建本體教程4.8PropertyDomainsandRanges【定義hasTopping的RangePizzaToppingdomainPizza】【定義isToppingOf的RangePizzadomainPizzaTopping】Propertiesmayhaveadomainandarangespeci?ed(指定的).Propertieslinkindividualsfromthedomaintoindividualsfromtherange.例如::inmyPizza本體,thepropertyhasToppingwouldprobablylinkindividualsbelongingthetheclassPizzatoindividualsbelongingtotheclassofPizzaTopping.InthiscasethedomainofthehasToppingpropertyisPizzaandtherangeisPizzaTopping。另外::如果有ahasToppingb

,并且a與b都是individuals,那么我們就可以說a屬于classPizza,b屬于classPizzaTopping。通常來說,domainforapropertyistherangeforitsinverse,andtherangeforapropertyisthedomainforitsinverseprotege構(gòu)建本體教程4.9描述和定義Classes4.9.1PropertyRestrictionsOwl的restriction有三種:QuantifierRestrictionsCardinalityRestrictionshasValueRtege構(gòu)建本體教程1.quantifierrestrictions(existentialrestrictions和universalrestrictions)

Existentialrestrictions

:describeclassesofindividualsthatparticipateinatleastonerelationshipalongaspeci?edpropertytoindividualsthataremembersofaspeci?edclass.例子::我至少(atleastone)買了一袋餅干從好又多超市。再比如::我做的蛋糕,上面至少覆蓋了一層紫色奶酪protege構(gòu)建本體教程【Pizza限制hasBasesomePizzaBase】protege構(gòu)建本體教程universalrestrictions

:describeclassesofindividualsthatforagivenpropertyonlyhaverelationshipsalongthispropertytoindividualsthataremembersofaspecifiedclass.例子::我買的東西都是從好又多市(或者我買東西只(only)從好又多超市)

注::Arestrictiondescribesananonymousclass(anunnamedclass).Theanonymousclasscontainsalloftheindividualsthatsatisfytherestriction。例如:Existentialrestrictions“上面至少覆蓋了一層紫色奶酪?!边@句話就描述了一個(gè)匿名類,任何上面覆蓋至少一層紫色奶酪的individuals都屬于該匿名類的,“我做的蛋糕”這個(gè)類也屬于這個(gè)匿名類。所以當(dāng)我們對(duì)一個(gè)類進(jìn)行限制時(shí),在supperclass里定義。protege構(gòu)建本體教程2定義一些其他的類(一些使用技巧)

【Pizza

子類NamedPizza】【NamedPizza子類MargheritaPizzahasatleastonetoppingsofMozzarellaToppingandTomatoTopping】【創(chuàng)建AmericanaPizza

通過克隆MargheritaPizza因?yàn)樗麛U(kuò)展了一個(gè)限制PepperoniTopping】【創(chuàng)建AmericanHotPizza

通過克隆AmericanaPizza

增加限制JalapenoPepperTopping】【創(chuàng)建SohoPizza克隆MargheritaPizza

增加OliveTopping和ParmezanTopping】protege構(gòu)建本體教程4.10使用Reasoner(推理機(jī))thereasonershippedwithProt′eg′eiscalledFact++.兩種hierarchy:InProt′eg′e4the‘manuallyconstructed’classhierarchyiscalledtheassertedhierarchy.Theclasshierarchythatisautomaticallycomputedbythereasoneriscalledtheinferredhierarchy.主要功能:1,判斷一個(gè)類是否是另一個(gè)類的子類2,consistencychecking(一致性檢測)【為了使用推理機(jī),我們先定義一個(gè)矛盾的類ProbeInconsistentTopping,讓他既是CheeseTopping

又是VegetableTopping的子類,前提是這兩個(gè)類是disjoint的】:Ifaclasshasbeenfoundtobeinconsistentit’siconwillbehighlightedinred.【將CheeseToppingVegetableTopping設(shè)為非disjoint的之后,再Classify,觀察結(jié)果】protege構(gòu)建本體教程4.11充分必要條件

(primitiveclass和definedclass)

Alloftheclassesthatwehavecreatedsofarhaveonlyusednecessaryconditionstodescribethem.Necessaryconditionscanbereadas,“Ifsomethingisamemberofthisclassthenitisnecessarytofulfilltheseconditions”.Withnecessaryconditionsalone,wecannotsaythat,“Ifsomethingfulfillstheseconditionsthenitmustbeamemberofthisclass”.只定義了必要條件的類叫做primitiveclass定義了充要條件的類叫做definedclass【定義Pizza的子類CheesyPizza定義限制hasToppingsomeCheeseTopping】【將其轉(zhuǎn)化為充分必要條件】【Classify我們可以看出definedclass的不同】總結(jié)::ifclassAisnowdefinedusingnecessaryandsufficientconditions,wecansaythatifanindividualisamemberoftheclassAitmustsatisfytheconditionsandwecannowsaythatifany(random)individualsatis?estheseconditionsthenitmustbeamemberofclassA.protege構(gòu)建本體教程4.12AutomatedClassification(自動(dòng)分類)

為什么要使用Reasoner。當(dāng)我們創(chuàng)建了成百上千的類時(shí),使用Reasoner來自動(dòng)計(jì)算子類父類之間的關(guān)系將是十分必要的。沒有了Reasoner我們很難保證大規(guī)模本體的健壯性和邏輯性。自動(dòng)分類這項(xiàng)技術(shù),使得本體可維護(hù)并且模塊化,它不僅使得其他的本體和程序能夠reuse我們定義的本體,而且還最大限度的減少了使用者在建立多繼承類時(shí)的錯(cuò)誤?!臼褂肙WLViz顯示類的繼承層次結(jié)構(gòu)】protege構(gòu)建本體教程4.13UniversalRestrictions(QuantifierRestrictions)【創(chuàng)建一個(gè)Pizza的子類VegetarianPizza】【增加限制hasToppingonly(CheeseToppingorVegtableTopping)】ThismeansthatifsomethingisamemberoftheclassVegetarianPizzaitisnecessaryforittobeakindofPizzaanditisnecessaryforittoonly(universalquanti?er)havetoppingsthatarekindsofCheeseToppingorkindsofVegetableTopping,也可以沒有,比如,中國現(xiàn)在實(shí)行計(jì)劃生育,如果夫妻有了孩子那么只能有一個(gè),但是這個(gè)夫妻也可以沒有孩子。那么就不存在only這個(gè)限制?!緦⑸厦娴谋匾獥l件轉(zhuǎn)化為充分條件】protege構(gòu)建本體教程4.14AutomatedClassificationandOpenWorldReasoning

【使用推理機(jī)進(jìn)行自動(dòng)分類】我們發(fā)現(xiàn)MargheritaPizza

和SohoPizza

并沒有被歸類為VegetarianPizza的子類,但是按照我們的定義,MargheritaPizza和SohoPizza都至少有個(gè)蔬菜的頂部和奶酪的頂部,再看VegetarianPizza的充要條件,onlyhave蔬菜的頂部和奶酪的頂部的pizza都是VegetarianPizza。但是ReasoninginOWL(DescriptionLogics)isbasedonwhatisknownastheopenworldassumption(OWA),意思是,除非我們明確的說明某個(gè)事物的存在,否則我們就不能說他是存在的。分析上面的:因?yàn)槲覀儧]有明確的指定他們只有奶酪和蔬菜頂,那么他們就可以有其他的頂部。這樣的話,他們就不符合VegetarianPizza的充要條件了。為了使這兩種pizza只有蔬菜和奶酪頂部,我們就得在hasTopping上使用closureaxiom(封閉公理)protege構(gòu)建本體教程4.14.1ClosureAxioms(封閉公理)

itcanonlybefilledbythespecifiedfillers.Therestrictionhasafillerthatistheunionofthefillersthatoccurintheexistentialrestrictionsfortheproperty。

【為MargheritaPizza的

hasTopping添加封閉公理】 【hasToppingonly(MozzarellaToppingorTomatoTopping)】 【為其他幾個(gè)pizza使用更方便的方法添加封閉公理】

現(xiàn)在我們可以說,MargheritaPizza至少有一個(gè)MozzarellaTopping和TomatoTopping,并且thetoppingsmustonlybekindsofMozzarellaToppingorTomatoTopping。

【Classify之后我們看結(jié)果】protege構(gòu)建本體教程4.15ValuePartitionsValuePartitionsare他并不屬于任何一種本體語言的一部分,而是一種設(shè)計(jì)模式,類似于面向?qū)ο蟪绦蛟O(shè)計(jì)中的設(shè)計(jì)模式。它可以改善我們對(duì)類的描述?!緞?chuàng)建thing的子類ValuePartition】【ValuePartition的子類SpicinessValuePartition(HotMediumMild)】【創(chuàng)建ObjectPropertyhasSpiciness并使其functional】【為SpicinessValuePartition增加coveringaxiom在equivalent里面輸入HotorMediumorMild】protege構(gòu)建本體教程這種設(shè)計(jì)模式的效果我們可以看個(gè)對(duì)比圖:disjoint(關(guān)鍵詞)protege構(gòu)建本體教程4.16AddingSpicinesstoPizzaToppings

【對(duì)PepperTopping的所有子類設(shè)置必要條件hasSpicinesssomeHot】 【定義Pizza的子類SpicyPizza設(shè)置必要條件:hasToppingsome(PizzaToppingandhasSpicinesssomeHot)】【將必要條件化為充要條件】 Fillter描述了一個(gè)匿名類,這個(gè)頂是Pizzatopping,并且特別辣。【Classifiy之后我們發(fā)現(xiàn)AmericanHotPizza成為了SpicyPizza的子類】protege構(gòu)建本體教程4.17CardinalityRestrictions(Owl的restriction中的第二種)

describetheclassofindividualsthathaveatleast(min),atmost(max)orexactlyaspecifiednumber(exactly)ofrelationshipswithotherindividualsordatatypevalues.【創(chuàng)建Pizza的子類InterestingPizza定義必要條件hasToppingmin3】注意:我們這里3后面并沒有指定fillter是什么,代表可以是任意的individuals,等價(jià)于::hasToppingmin3Thing【轉(zhuǎn)化為充要條件】【Classify之后觀察。。?!縫rotege構(gòu)建本體教程4.18Qualified(受限的)CardinalityRestrictions

他比上面的morespecify【定義NamedPizza的子類FourCheesePizza定義必要條件hasToppingexactly4CheeseTopping】protege構(gòu)建本體教程5.DatatypeProperties

describerelationshipsbetweenanindividualanddatavalues.【現(xiàn)在來描述pizza所含的熱量】【增加DatatypePropertieshasCalorificContentValue】【增加individualExampleMargherita其type是MargheritaPizza】【為該對(duì)象增加DataPropertyassertion其中type選擇integer值填寫250】【增加individualExampleSoho其type是SohoPizza】【為該對(duì)象增加DataPropertyassertion其中type選擇integer值填寫800】protege構(gòu)建本體教程我們聲明所有的pizza都有熱量值【選定Pizza類,增加Supperclass選擇Datarestrictioncreator】

我們對(duì)pizza的熱量值進(jìn)行分類,產(chǎn)生不同的pizza【創(chuàng)建HighCaloriePizza和LowCaloriePizza作為Pizza的子類】【創(chuàng)建SupperClass選擇Classexpressioneditor】【鍵入PizzathathasCalorificContentValuesomeinteger[>=400]】【同理LowCaloriePizza應(yīng)當(dāng)是<400】【分別將他們?cè)O(shè)為充要條件】【Classify之后我們看他們的members】

某一確定的Pizza他所含的熱量是固定的,也就是說是單值的,我們可以使用function

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論