语义WEB关于RDF学习总结
【摘要】 语义WEB关于RDF学习总结
RDF的研究和实现
主要内容:
1.编写一个符合逻辑的rdf文件。
2.利用rdf文件配合Protege软件转化文件格式为OWL
3.编写一个软件实现sparql语句对rdf的查询。
实现过程:
1.接上次xml格式写出长陵定陵的rdf。
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:mausoleum="https://www.mingshisanling.com/"
>
<rdf:Description
rdf:about="https://www.mingshisanling.com/mausoleum.html?c_id=1">
<mausoleum:artist>Chang Ling</mausoleum:artist>
<mausoleum:country>China</mausoleum:country>
<mausoleum:city>Beijing</mausoleum:city>
<mausoleum:price>45</mausoleum:price>
<mausoleum:year>2022</mausoleum:year>
</rdf:Description>
<rdf:Description
rdf:about="https://www.mingshisanling.com/mausoleum.html?c_id=2">
<mausoleum:artist>Ding Ling</mausoleum:artist>
<mausoleum:country>China</mausoleum:country>
<mausoleum:city>Beijing</mausoleum:city>
<mausoleum:price>60</mausoleum:price>
<mausoleum:year>2022</mausoleum:year>
</rdf:Description>
</rdf:RDF>
2.利用rdf文件配合Protege软件转化文件格式为OWL
Protege解压可用文件下载地址:
链接:https://pan.baidu.com/s/12goO-I2-XaashpU-zRUPwA?pwd=2zhy
提取码:2zhy
成功获取rdf的owl文件:
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://www.w3.org/2002/07/owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<Prefix name="owl" IRI="http://www.w3.org/2002/07/owl#"/>
<Prefix name="rdf" IRI="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/>
<Prefix name="xml" IRI="http://www.w3.org/XML/1998/namespace"/>
<Prefix name="xsd" IRI="http://www.w3.org/2001/XMLSchema#"/>
<Prefix name="rdfs" IRI="http://www.w3.org/2000/01/rdf-schema#"/>
<Prefix name="mausoleum" IRI="https://www.mingshisanling.com/"/>
<Declaration>
<AnnotationProperty abbreviatedIRI="mausoleum:country"/>
</Declaration>
<Declaration>
<AnnotationProperty abbreviatedIRI="mausoleum:year"/>
</Declaration>
<Declaration>
<AnnotationProperty abbreviatedIRI="mausoleum:artist"/>
</Declaration>
<Declaration>
<AnnotationProperty abbreviatedIRI="mausoleum:city"/>
</Declaration>
<Declaration>
<AnnotationProperty abbreviatedIRI="mausoleum:price"/>
</Declaration>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:artist"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=1</IRI>
<Literal>Chang Ling</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:city"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=1</IRI>
<Literal>Beijing</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:country"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=1</IRI>
<Literal>China</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:price"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=1</IRI>
<Literal>45</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:year"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=1</IRI>
<Literal>2022</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:artist"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=2</IRI>
<Literal>Ding Ling</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:city"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=2</IRI>
<Literal>Beijing</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:country"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=2</IRI>
<Literal>China</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:price"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=2</IRI>
<Literal>60</Literal>
</AnnotationAssertion>
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="mausoleum:year"/>
<IRI>https://www.mingshisanling.com/mausoleum.html?c_id=2</IRI>
<Literal>2022</Literal>
</AnnotationAssertion>
</Ontology>
<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->
3.编写一个软件实现sparql语句对rdf的查询。
程序源码下载地址
链接:https://pan.baidu.com/s/1L6XW0zQy3Hmj7NhYt-JFmA?pwd=2zhy
提取码:2zhy
【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
作者其他文章
评论(0)