turtle教程 |
您所在的位置:网站首页 › 怎么样忍住不哭 › turtle教程 |
Turtle格式介绍 在网上找了很久,就是没有介绍turtle格式标准的中文教程。 所以就照着英文版的turtle格式说明,加上自己的理解,写了这篇blog. 一般是用RDF(Resource Description Framework)模型,对知识图谱进行描述。 目前有普遍的三种序列化RDF的标准RDF/XML,Turtle,N-Triples Turtle由于简单易读,易于编写,成为常见的序列化RDF数据模型的标准 下面将详细介绍Turtle的格式要求(阅读本文前,建议先学习RDF/XML格式标准) URI用 描述 前缀缩写(类似于RDF/XML的命名空间) 第二行定义了缺省前缀,之后应用可以用**:a**相当于 < http://example.org/ns1#a > @prefix foo: @prefix : :a :b :c字面量 一行或者多行, @en限定其语言, ^^xsd:decimal限定其数据类型 "string" """ many lines of string many lines of string many lines of string """ "chat"@en "chat"@fr "10"^^xsd:decimal空节点(RDF模型可能会存在未命名的空节点) _:me,_a1234分别代表一个空节点 _:me _:a1234base URI(这个感觉有点难理解) base URI定义后,接下来的URI, 前缀缩写,qualified names 和base URI都要受其作用。 # this is a complete turtle document @base . # base URIs 是 http://example.org/ns/ @base . # base URI 是 http://example.org/ns/foo/ @prefix : . :a4 :b4 :c4.对三元组进行缩写 :a :b :c, :d. #the last triple is :a :b :d. :a :b :c; :d :e. #the last triple is :a :d :e.整数,单精度,双精度,科学计数法,布尔值都能被直接表示 -5 0 +1 1.3e2 -12.001 true false集合的缩写2 (Subject为主语, predicate为谓语) @prefix : . # the value of this triple is the RDF collection blank node :subject :predicate ( :a : b : c ) . # an empty collection value - rdf:nil :subject :predicate2 () .一个简单的完整turtle标准文件 下图是一个知识图谱的rdf描述模型 对rdf graph进行turtle标准的序列化 @prefix info: @prefix rel: @prefix person: person:Tom info:name "Tom"; info:job "worker"; info:age 56; rel:fatherof person:Jim. person:Jim info:name "Jim"; info:job "programmer"; info:age 28; rel:fatherof person:Cherry. person:Cherry info:name "Cherry"; info:age 8; |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |