知识图谱表示
本章关注:
Web信息表达
编码规范
Unicode: a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world’s writing systems.
Web资源地址
URL(Uniform Resource Locator):A reference to an Internet resource
URL vs URI
URI = URL + URN
为什么使用URI?
URIs look cool;
Precisely identify resources(Avoid confusion among different subjects);
Precisely identify properties;
Provide information about properties;
Look them up on the web
RDF (Resource Description Framework)
The Resource Description Framework (RDF) is a language for representing information about resources in the World Wide Web
Intention: Intended for representing metadata about Web resources, such as the title, author, and modification date of a Web document(为了描述web中资源的元数据信息)
=> also be used to represent information about things that can be identified on the Web, even when they cannot be directly retrieved on the Web
Triples
Represent Information as Triples, (Subject,Predicate,Object)
Subject: The resource being described
Predicate: A property of the resource
Object: The value of the property
通过三元组的形式,很自然的形成了一条有向边的表达方式。
Namespaces
命名空间,用于简化URI的书写,其中存储了一系列subject或者predicate的信息
http://xmlns.com/foaf/0.1/firstName => foaf:firstName
RDF Syntaxes
XML, N3 Turtle, N-Triples, RDFa, JSON-LD
Represent nested structures
usc:isi schema:address “4676 Admiralty Way, Marina del Rey, CA 90292” .
问题: In what city is USC/ISI located?
使用嵌套节点
1 |
|
We minted a URI for USC/ISI’s address, but sometimes we don’t want to mint URIs => BNode
在这里可以发现嵌套节点usc:isi-address也有具体的URI来表示,但是该节点的URI没有什么其他的作用,所以使用空节点来表示, 前缀为_
1 |
|
字面值的类型(Typed Literals)
在object后面添加类型信息。
example: weather:date ”2012-06-18”^^xsd:date ;
Reification
RDF applications sometimes need to describe other RDF statements using RDF, for instance, to record information about when statements were made, who made them, or other similar information (this is sometimes referred to as “provenance” information).
举个例子: 他说了xxx
“On June 19 2012, Claudia said that Sam’s email address is Sam@gmail.com”
1 |
|
RDF syntax in turtle
URIs are in <>
Prefix:
@prefix foo: http://example.org/ns# .
@prefix : http://other.example.org/ns# . <- 空命名空间
foo:bar foo: : . 等价于
http://example.org/ns#bar http://example.org/ns http://other.example.org/ns.Turtle Literals
1
2
3
4
5
6
7
8Type of literals:
untyped (“London” equivalent to “London”^^xsd:string)
language tag
data type (with a URI)
Example:
Strings in “”
Language tag: "That Seventies Show"@en
Data type: "10"^^xsd:decimalBlank Node
_:a
[]Turtle Base URI ????
常用缩写
rdf:type = a
“-5”^^xsd:integer
“true”^^xds:boolean
“1.3e2”^^xsd:double
RDF Schema
RDF Schema is the language for defining RDF vocabularies.
It specifies the RDF inference rules: the triples that are implied by the triples you have.
常用rdfs:
All things described by RDF are called resources, and are instances of the class rdfs:Resource
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!