« | August 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | | | | |
| 公告 |

|
Blog信息 |
blog名称:彼岸·花 日志总数:39 评论数量:115 留言数量:-16 访问次数:402588 建立时间:2005年8月6日 |

| |
[一路前行]protege3.1.x基础篇-入门  文章收藏, 网上资源
子轩 发表于 2006/11/24 14:57:36 |
此新手入门对应protege3.1.x版本。通过制作一个简单的动物本体,来使大家了解protege建立owl的基础用法。步骤1 建立新的项目。打开protege,然后会出现对话框,点击Create New Project...,出现Create New Project对话框后,选择OWL Flies(.owl or .rdf)后,点击Finish,而不选Next。500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
步骤2 建立类。protege的主页面中会出现,OWL Classes(OWL类),Properties(属性),Forms(表单),Individuals(个体),Metedata(元类)这几个标签。我们选择OWL Classes来编辑。在Asserted Hierarchy(添加阶层)中,会有所有类的超类owl:Thing上点击Asserted Hierarchy旁边的Create subclass或者在OWL:Thing,点击右键选择Create subclass。会出现protege自动定义名为Class_1的类。在右边的CLASS EDITOR(类编辑器)的Name选项中,输入Animal来替换自动定义的名字。(建议使用英文,因为下面会用到OWLViz来生成关系图,中文的话会容易出现问题。)
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
步骤3 建立Animal的子类,在Animal点击上右键,选择Create subclass,并按照上述方法将其名字变为Herbivore(素食动物)。
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
步骤4然后按照上面的方法,建立OWL:Thing的另一个子类Plant(植物),然后建立Plant的子类Tree(树)。状态如下图 500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
步骤5 因为动物和植物是不同的事物,也就是说它们互相具有排他性(owl:disjointWith),我们来定义这个关系。在选中Animal的状态下,点击右下角的Disjoints的第三个按钮,在出现的Add sibling to disjoints(将互为兄弟节点的类设为排他)对话框中,选择Mutually between all siblings。这样动物和植物就有互相排斥的属性了。 500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤6 建立属性。新建一个ObjectProperty(注意不是DataProperty)选择Properties标签,Name改为is_part_of,然后在右下角Transitive前面打上对号,说明这是一个传递性属性。然后建立一个对象属性(owl:ObjectProperty)eat(吃),在Domain(定义域)中定义该属性的主体的类是Animal。最后再建立一个属性eated(被吃),它是属性eat的逆关系(owl:inverseOf),在右下角Inverser框中选择eat属性。(参照图) 500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤7 建立一个owl:Plant的子类Branch(树枝),并附加限制条件。在选择Branch的状态下,点击中下方的Asserted Conditions(添加条件)中的第二个按钮(Create restrition )。在弹出的对话框中,选择Restrition中的allValuesFrom,然后点击下方的Insert class...。最后选择Tree,这样我们就定义了类Branch,它是树(Tree)的一部分(is_part_of)。 500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤8 和步骤7一样,建立owl:Plant的子类Leaf(树叶)类。在Asserted Conditions选择is_part_of属性,并在Restrition中的选择allValuesFrom,最后选择属性类Branch(树枝)。这样我们就定义了树叶是树枝的一部分。
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤9 定义草食动物。素食动物是动物的子类,而且只吃植物或是植物的一部分(植物和一部分植物的并集,也就是植物)。和步骤7一样Create Restrition对话框中添加如下图的式子。500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤10 定义类Giraffe(长颈鹿),它是素食动物,只吃树叶。按照上面的步骤定义,如下图 。
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤11 查看关系图,在菜单中选择Project–>Configure在出现的对话框中,在OWLVizTab前打上对号,就会出新OWLViz的标签。如果在这里出现DOT error的话请参照错误提示的解决办法,然后点击OWLViz标签,选择Show all classes,就可以看到关系图。500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">步骤12 保存项目。点击这里下载并保存该项目。解压后用菜单中的File–>Open Project–>解压路经中的Animal.ppjr即可。
500)this.width=500'>此主题相关图片如下:500)this.width=500'>screen.width-333)this.width=screen.width-333" border=0 dypop="按此在新窗口浏览图片">
新手入门的帖子至此结束,接下来请继续学习:如何在动物本体中建立狮子类(Lion)和肉食动物类(Carnivore),并通过推理得到狮子是肉食动物。通过实例来简单了解推理机Racer的用法。 |
|
|