ImageVerifierCode 换一换
格式:PPTX , 页数:69 ,大小:615.74KB ,
资源ID:1726873      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1726873.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(语义网简明教程SW6-OWL-Jena.pptx)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

语义网简明教程SW6-OWL-Jena.pptx

1、,语义网开发工具:Jena,1,Jena,Jena由 HP Labs(http:/)开发的Java开发工具包用于开发语义网的应用系统Jena的功能解析RDF模型提供对RDFS、OWL、DAML+OIL等本体的操作支持基于本体的规则的推理和验证,2,Jena,Jena includes:A RDF APIReading and writing RDF in RDF/XML,N3 and N-TriplesAn OWL APIIn-memory and persistent storageSPARQL query enginea rule-based inference engine,3,一、解析

2、RDF模型,Jena定义了许多接口来访问和处理RDF陈述RDF图称为模型,用Model接口表示陈述用Statement接口表示资源用Resource接口表示属性用Property接口表示常量用Literal接口表示提供了一个RDFNode接口作为Resource、Property、Literal的超 接口通过接口操作RDF创建资源、属性等RDF元素添加、删除模型中的陈述查询RDF模型以XML/RDF、三元组格式读写RDF文档,4,创建简单 RDF 模型,创建描述一组虚构家庭成员之间关系的模型,使用来自“关系”词汇表(http:/purl.org/vocab/relationship)的属性si

3、blingOf、spouseOf、parentOf 和 childOf 来描述家庭成员之间关 系。家庭成员用来自虚构名称空间的 URI(http:/family/)进行标识,5,1、创建模型,模型是RDF图在Jena中的表示形式模型由一组RDF陈述组成通过模型可以创建资源、属性、常量增加、删除陈述可进行查询模型创建模型ModelFactory 类用于创建不同类型的模型ModelFactory.createDefaultModel():创建一个空的、内存模型,返回 Model 实例例:Model model=ModelFactory.createDefaultModel();,6,2、创建属性,

4、使用 Model.createProperty创建属性Property createProperty(String nameSpace,String localName)nameSpace:命名空间localName:属性局部名称/Namespace declarationsString familyUri=http:/family/;String relationshipUri=http:/purl.org/vocab/relationship/;/Create the types of Property to describe relationships in the modelPrope

5、rty childOf=model.createProperty(relationshipUri,childOf);Property parentOf=model.createProperty(relationshipUri,parentOf);Property siblingOf=model.createProperty(relationshipUri,siblingOf);Property spouseOf=model.createProperty(relationshipUri,spouseOf);,7,3、创建资源,使用Model.createResource创建资源 Resource

6、 createResource(String uri)uri:资源的URI/Create resources representing the people in our model Resource adam=model.createResource(familyUri+adam);Resource beth=model.createResource(familyUri+beth);Resource chuck=model.createResource(familyUri+chuck);Resource dotty=model.createResource(familyUri+dotty);

7、Resource edward=model.createResource(familyUri+edward);Resource fran=model.createResource(familyUri+fran);Resource greg=model.createResource(familyUri+greg);Resource harriet=model.createResource(familyUri+harriet);,8,4、添加陈述,使用Resource.addProperty添加关于资源的陈述到模型Resource addProperty(Property p,RDFNode o)

8、p:陈述的谓词,o:陈述的客体,本资源为主体/Add properties to describing the relationships between them adam.addProperty(siblingOf,beth);adam.addProperty(spouseOf,dotty);adam.addProperty(parentOf,edward);adam.addProperty(parentOf,fran);beth.addProperty(siblingOf,adam);beth.addProperty(spouseOf,chuck);chuck.addProperty(s

9、pouseOf,beth);dotty.addProperty(spouseOf,adam);dotty.addProperty(parentOf,edward);dotty.addProperty(parentOf,fran);,9,4、添加陈述(续),也可使用Model.createStatement创建陈述Statement createStatement(Resource s,Property p,RDFNode o)Model add(Statement stmt)/Statements can also be directly created.Statement statement

10、1=model.createStatement(edward,childOf,adam);Statement statement2=model.createStatement(edward,childOf,dotty);Statement statement3=model.createStatement(edward,siblingOf,fran);/.then added to the model:model.add(statement1);model.add(statement2);model.add(statement3);,10,4、添加陈述(续),/Arrays of Stateme

11、nts can also be added to a Model:Statement statements=new Statement5;statements0=model.createStatement(fran,childOf,adam);statements1=model.createStatement(fran,childOf,dotty);statements2=model.createStatement(fran,siblingOf,edward);statements3=model.createStatement(fran,spouseOf,greg);statements4=m

12、odel.createStatement(fran,parentOf,harriet);model.add(statements);/A List of Statements can also be added List list=new ArrayList();list.add(model.createStatement(greg,spouseOf,fran);list.add(model.createStatement(greg,parentOf,harriet);list.add(model.createStatement(harriet,childOf,fran);list.add(m

13、odel.createStatement(harriet,childOf,greg);model.add(list);,11,5、查询RDF模型,Model接口提供对模型中的资源、属性、陈述等的查询listStatements():List all statementslistStatements(Resource s,Property p,RDFNode o):Find all the statements matching a pattern.listSubjects():List all resources which are subjects of statements.listSub

14、jectsWithProperty(Property p):List all subjects with a given propertylistObjects():List all objects in a model.listObjectsOfProperty(Property p):List all objects of a given property,12,5、查询RDF模型(续),列出陈述StmtIterator listStatements()列出所有陈述结果存放在陈述迭代器中StmtIterator listStatements(Resource s,Property p,RD

15、FNode o)查找满足给定模式的陈述s:查找的资源,p:查找的谓词,o:查找的客体参数可为null,表示匹配任何值例如:/Find the exact statement adam is a spouse of dotty model.listStatements(adam,spouseOf,dotty);,13,5、查询RDF模型(续),例:/Find any statements made about adamStmtIterator iter=model.listStatements(adam,null,(RDFNode)null);/print out the predicate,s

16、ubject and object of each statementwhile(iter.hasNext(),14,/get next statement/get the subject/get the predicate/get the object,Statement stmt=iter.nextStatement();Resource subject=stmt.getSubject();Property predicate=stmt.getPredicate();RDFNodeobject=stmt.getObject();System.out.print(subject.toString();,System.out.print(+predicate.toString()+);if(object instanceof Resource)System.out.print(object.toString();else/object is a literalSystem.out.print(+object.toString()+);System.out.println(.);,5、查

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1