語(yǔ)義網(wǎng)簡(jiǎn)明教程SW6-OWL-Protege_第1頁(yè)
語(yǔ)義網(wǎng)簡(jiǎn)明教程SW6-OWL-Protege_第2頁(yè)
語(yǔ)義網(wǎng)簡(jiǎn)明教程SW6-OWL-Protege_第3頁(yè)
語(yǔ)義網(wǎng)簡(jiǎn)明教程SW6-OWL-Protege_第4頁(yè)
語(yǔ)義網(wǎng)簡(jiǎn)明教程SW6-OWL-Protege_第5頁(yè)
已閱讀5頁(yè),還剩61頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、1語(yǔ)義網(wǎng)開(kāi)發(fā)工具語(yǔ)義網(wǎng)開(kāi)發(fā)工具: Protg2ProtgProtg is a free, open-source platform that provides a growing user community with a suite of tools to construct domain models and knowledge-based applications with ontologies. At its core, Protg implements a rich set of knowledge-modeling structures and actions that suppo

2、rt the creation, visualization, and manipulation of ontologies in various representation formats. Protg can be customized to provide domain-friendly support for creating knowledge models and entering data. Further, Protg can be extended by way of a plug-in architecture and a Java-based Application P

3、rogramming Interface (API) for building knowledge-based tools and applications. 3一、一、 Protg-OWL Editor4Create a new OWL projectNew ProjectSelect file type5OWL Classes TabDisjoint classesClass hierarchyRestriction ConditionAnnotations Operation Button6Properties TabProperties ListDomainRangeAnotation

4、Property characteristics7Individuals TabIndividuals8MetaData Tab9Save ProjectSave ProjectEnter Project name10Building An OWL OntologyComponents of OWL Ontologies Individuals : represent objects in the domain that we are interested in Properties : are binary relations on individuals - i.e. properties

5、 link two individuals together Classes : are interpreted as sets that contain individuals.111、ClassOWL supports six main ways of describing classes of individuals. The simplest of these is a Named Class. The other types of class descriptions are anonymous classes.Named classes :create a class and as

6、sign a name to it. Two built in named classes: owl:Thing and owl:Nothing.Anonymous classes:built up from class descriptionsIntersection, Union and Complement classesRestriction classes:existential, universal,cardinality, hasValueEnumeration classesCombinations of Named classes and anonymous classes

7、are used to build up complex class descriptions.12Create classesModify class nameCreate subclass Select owl:Thing 13Create subclassesModify class nameCreate subclass Select class 14Create Group Of classes with WizardMenu item Enter class name 15Disjoint ClassesAdd all siblling . Set disjoint class e

8、ach other 162、Creating IndividualsSelect Class Create InstanceModify name173、PropertyOWL Properties represent relationships between two individuals. There are two main types of properties Object properties : link an individual to an individual. Datatype properties : link an individual to an Datatype

9、 value Annotation properties : Annotation properties can be used to add information (metadata) to classes, individuals and properties. Properties may have super-properties or sub-properties, form a property hierarchy.18Create propertyCreate Property Modify name 19Create SubpropertySelect superproper

10、tyModify name Create subproperty 20Inverse Property1. Select property 2. Set inverse property 3. Select inverse property 21Property CharacteristicsSelect property Select characteristics 22Property Domains Select Property Specialise Domain Select Class 23Property RangesSelect Property Specialise Rang

11、e Select Class 244、Property RestrictionRestrictions in OWL fall into three main categories: Quantifier Restrictions Cardinality Restrictions hasValue Restrictions.A restriction actually describes an anonymous class. The anonymous class contains all of the individuals that satisfy the restriction25Cr

12、eate RestrictionSelect “NECESSARY”Select Class Create Restriction 26Create Restriction DialogSelect Property Select Restriction Specify fillerInsert ClassOperator Panel 27Complex class Specify fillerUnion operatorSelect operator28Asserted ConditionsAsserted Conditions29Necessary Conditions For a giv

13、en class, necessary conditions are the conditions that an individual must fulfil if it is a member of that class. represent superclasses classes of that class.The Description of CheesyPizzaThe Description of CheesyPizza states that if something is a member of the class CheesyPizza it is necessary fo

14、r it to be a member of the class Pizza and it is necessary for it to have at least one topping that is a member of the class CheeseTopping.30Necessary and Suffcient conditionsNecessary & Sufficient conditions allow us to determine that any individual that satisfies the conditions can be inferred

15、 to be a member of the classThe Description of CheesyPizzaThe Description of CheesyPizza states that if something is a member of the class CheesyPizza it is necessary ., Moreover, if an individual is a member of the class Pizza and it has at least one topping that is a member of the class CheeseTopp

16、ing then these conditions are suffcient to determine that the individual must be a member of the class CheesyPizza.31Primitive And Defined ClassesPrimitive Classes : Classes that do not have any sets of necessary & suffcient conditions (only have necessary conditions) are know as primitive class

17、es. are said to have a Description are also known as partial classes.Defined Classes : Classes that have at least one set of necessary & suffcient conditions are known as defined classes. are said to have a Definition. are also known as complete classes.Reasoner can only automatically classify c

18、lasses under defined classes32Clone ClassClone class 335、Reasoning For an ontology that falls into the scope of OWL-DL, we can use a DL Reasoner to infer information that isnt explicitly represented in the ontology ontology. Standard reasoning services are:Subsumption checking : the descriptions of

19、the classes (conditions) are used to determine if a super-class/subclass relationship exists between them.Consistency checkingEquivalence checking34Use a reasonerProtege-OWL can be used with any DIG compliant reasoner.Ensure a reasoner is runningCommunication with reasoner takes place via HTTP.Use R

20、ACERto automatically compute the classification hierarchy, The class hierarchy that is automatically computed by the reasoner is called the inferred hierarchy. the manually constructed class hierarchy is called the asserted hierarchy.to check the logical consistency of the ontology.35check consisten

21、cycheck consistency36Classify taxonomyClassify taxonomy376、Visualizing38二、二、Protg-OWL APIThe Protg-OWL API is an open-source Java library for OWL and RDF(S). provides classes and methods to load and save OWL files, to query and manipulate OWL data models, perform reasoning based on Description Logic

22、 engines. The API is designed to be used in two contexts: For the development of Protg plug-ins that are executed inside of the Protg-OWL editors user interface For the development of stand-alone applications 39Installation & Getting Started DownLoad The Protg-OWL API The API is bundled with the

23、 full installation of Protg Configure IDE (ie. Eclipse) Include protege.jar and protege-owl.jar into Libraries of Java Build Path protege.jar is located in protege installation directory protege-owl.jar is located in .tegex.owl Add protege.jar into ClasspathImport interfac

24、es Import used interfaces into your application40An exampleimport tegex.owl.model.OWLModel;import tegex.owl.model.OWLNamedClass;import tegex.owl.ProtegeOWL;public class OWLAPIDemoApplication public static void main(String args) OWLModel owl

25、Model = ProtegeOWL.createJenaOWLModel(); owlModel.getNamespaceManager().setDefaultNamespace(http:/#); OWLNamedClass worldClass = owlModel.createOWLNamedClass(World); System.out.println(Class URI: + worldClass.getURI(); 411、Working with OWL ModelsThe Protg-OWL API is centered around a collection of J

26、ava interfaces These interfaces provide access to the OWL model and its elements like classes, properties, and individuals. OWLModel is The most important model interface provides access to the top-level container of the resources in the ontology. create, query, and delete resources of various types

27、 and then use the objects returned by the OWLModel to do specific operations. Create OWLModel class ProtegeOWL provides the mothds for creating various modelOWLModel owlModel = ProtegeOWL.createJenaOWLModel();OWLNamedClass worldClass = owlModel.createOWLNamedClass(World);System.out.println(Class URI

28、: + worldClass.getURI(); 42Creating Named ClassesThe Protg-OWL API makes a clear distinction between named classes and anonymous classes. Named classes are used to create individuals, anonymous classes are used to specify logical characteristics (restrictions) of named classes. Creating Named Classe

29、s OWL model provide mothdes for creating named class OWLNamedClass OWLModel.createOWLNamedClass(class name) for example: OWLNamedClass personClass = owlModel.createOWLNamedClass(Person); 43Creating Class HierarchyCreate subclass for Class Hierarchy create subclass, then add its superclass OWLNamedCl

30、ass.addSuperclass(superclass name) create subclass and insert it into class hierarch at sane time OWLModel.createOWLNamedSubclass(class name,superclass name) for example: OWLNamedClass brotherClass = owlModel.createOWLNamedClass(Brother); brotherClass.addSuperclass(personClass); OWLNamedClass sister

31、Class = owlModel.createOWLNamedSubclass(Sister, personClass);44Creating IndividualsNamed classes can be used to generate individuals. OWLIndividual OWLNamedClass.createOWLIndividual(Individual name) ie. OWLIndividual individual = brotherClass.createOWLIndividual(Hans); Query instances of a class Col

32、lection OWLNamedClass.getInstances(Boolean) ture: direct and indirect instance of the class false: direct instance of the classie. Collection brothers = brotherClass.getInstances(false);Other methods delete, remove, and so on45Creating Datatype PropertiesCreate an owl:DatatypeProperty OWLModel.creat

33、eOWLDatatypeProperty(String name) OWLDatatypeProperty property = owlModel.createOWLDatatypeProperty(name);Datatype : datatype properties can take any datatype value such as strings and integers XML Schema datatypes RDFSLiteral Java data types OWL model provide methods for getting or converting datat

34、ype OWLModel.getXSDstring() getRDFSDatatypeByName () .46Creating Object PropertiesObjectProperties are used to represent properties to establish relations between individuals. OWL model provides methods for creating and setting object propertyOWLObjectProperty OWLModel.createOWLObjectProperty(name)O

35、WLObjectProperty.setDomain(class name)OWLObjectProperty. addUnionDomainClass(class name)OWLObjectProperty.setRange(class name)OWLObjectProperty.setTransitive(Boolean)OWLObjectProperty.setFunctional(Boolean) the API can be used to assign property values for individuals OWLIndividual.setPropertyValue(

36、Propertyname, value)47Creating Object Properties / create opeject property OWLNamedClass personClass = owlModel.createOWLNamedClass(Person); OWLObjectProperty childrenProperty = owlModel.createOWLObjectProperty(children); / set domain and range childrenProperty.setDomain(personClass); childrenProper

37、ty.setRange(personClass); / set property characteristics OWLObjectProperty ancestorProperty = owlModel.createOWLObjectProperty(ancestor); ancestorProperty.setTransitive(true);48Setting Properties 49Setting Properties /create property and set its domain to union of two class OWLNamedClass personClass

38、 = owlModel.createOWLNamedClass(Person); OWLObjectProperty childrenProperty = owlModel.createOWLObjectProperty(children); childrenProperty.setDomain(personClass); OWLNamedClass animalClass = owlModel.createOWLNamedClass(Animal); childrenProperty.addUnionDomainClass(animalClass);502、Advanced Class De

39、finitions The Protg-OWL API distinguishes between named classes (RDFSNamedClass and its subinterface OWLNamedClass) and anonymous classes (OWLAnonymousClass and its subinterfaces). Anonymous classes can be used to describe named classes. describe properties in some places 51 Anonymous class interfac

40、es RDFSClass OWLClass OWLAnonymousClass OWLRestriction OWLQuantifierRestriction OWLAllValuesFrom OWLSomeValuesFrom OWLHasValue OWLCardinalityBase OWLCardinality OWLMinCardinality OWLMaxCardinality OWLEnumeratedClass OWLLogicalClass OWLComplementClass OWLNAryLogicalClass OWLIntersectionClass OWLUnion

41、Class 52Restrictions OWLRestriction are used to define restrictions on property values OWLModel provide methods for creating various restrictions OWLAllValuesFrom OWLModel.createOWLAllValuesFrom()OWLSomeValuesFrom OWLModel.createOWLSomeValuesFrom() OWLHasValue OWLModel.createOWLHasValue() OWLCardina

42、lity OWLModel.createOWLCardinality() OWLMinCardinality OWLModel.createOWLMinCardinality() OWLManCardinality OWLModel.createOWLManCardinality() OWLModel provide methods for quering various restrictions Collection restrictions = OWLNamedClass .getRestrictions(Boolean); 53Restrictions 1 . 54Restriction

43、s OWLNamedClass personClass = owlModel.createOWLNamedClass(Person); OWLObjectProperty hasChildrenProperty = owlModel.createOWLObjectProperty(hasChildren); hasChildrenProperty.setDomain(personClass); OWLNamedClass parentClass = owlModel.createOWLNamedSubclass(Parent, personClass); OWLMinCardinality m

44、inCardinality = owlModel.createOWLMinCardinality(hasChildrenProperty, 1); parentClass.addSuperclass(minCardinality);55Unions, Intersections, Complements Logical class definitions can be used to build complex class expressions. 56Unions, Intersections, Complements OWLNamedClass personClass = owlModel

45、.createOWLNamedClass(Person); manClass = owlModel.createOWLNamedSubclass(Man, personClass); womanClass =owlModel.createOWLNamedSubclass(Woman, personClass); / Create expression (Person & !(Man | Woman) OWLUnionClass unionClass = owlModel.createOWLUnionClass(); unionClass.addOperand(manClass); un

46、ionClass.addOperand(womanClass); OWLComplementClass complementClass = owlModel.createOWLComplementClass(unionClass); OWLIntersectionClass intersectionClass = owlModel.createOWLIntersectionClass(); intersectionClass.addOperand(personClass); intersectionClass.addOperand(complementClass); OWLNamedClass

47、 kidClass = owlModel.createOWLNamedClass(Kid);kidClass.addSuperclass(intersectionClass);57Enumerated Classes An enumerated class is an anonymous class that lists all of its individuals explicitly OWLIndividual red = colorClass.createOWLIndividual(red); OWLIndividual yellow = colorClass.createOWLIndi

48、vidual(yellow); OWLIndividual green = colorClass.createOWLIndividual(green); OWLNamedClass trafficLightColor = owlModel.createOWLNamedClass(TrafficLightColor); OWLEnumeratedClass enum = owlModel.createOWLEnumeratedClass(); enum.addOneOf(red); enum.addOneOf(yellow); enum.addOneOf(green); trafficLight

49、Color.setDefinition(enum);58Creating Defined Classes In OWL, classes can be either primitive or defined. Primitive classes only have necessary conditions, i.e., superclasses. Defined classes have necessary & sufficient conditions, i.e., equivalent classes. 1 59Creating Defined Classes personClas

50、s = owlModel.createOWLNamedClass(Person); hasChildrenProperty = owlModel.createOWLObjectProperty(hasChildren); hasChildrenProperty.setDomain(personClass); OWLNamedClass parentClass = owlModel.createOWLNamedClass(Parent); OWLMinCardinality minCardinality = owlModel.createOWLMinCardinality(hasChildren

51、Property, 1); OWLIntersectionClass intersectionClass = owlModel.createOWLIntersectionClass(); intersectionClass.addOperand(personClass); intersectionClass.addOperand(minCardinality); parentClass.setDefinition(intersectionClass);603、Operate on OntologyQuerying the OWLModelLoading and Saving FilesWork

52、ing with Jena Models.61Querying the OWLModelOWLModel class provides access to all the resources in the model. After you have gained access to the resource objects via the OWLModel, you can call methods to query and traverse the contents of an ontology. OWLModel.getOWLThingClass() OWLModel.getOWLName

53、dClass() OWLModel.getUserDefinedOWLNamedClasses() OWLModel.getOWLObjectProperty() OWLModel.getRDFResourcesWithPropertyValue() .62Loading and Saving FilesThe Protg-OWL API can be used in two storage modes: OWL Files mode (class JenaOWLModel) OWL Database mode (class OWLDatabaseModel) OWL Files mode is based on the JenaOWLModel class. You can use the static methods from the Pro

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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)論