知识图谱表示

本章关注:

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
2
3
4
5
6
7
8
usc:isi schema:address usc:isi-address .

usc:isi-address
schema:addressCountryUSA” ;
schema:addressRegionCA”;
schema:addressLocalityMarina del Rey” ;
schema:postalCode “90292” ;
schema:streetAddress “4676 Admiralty Way” .

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
2
3
4
5
6
7
8
usc:isi schema:address _:isi-address .

_:isi-address .
schema:addressCountryUSA” ;
schema:addressRegionCA”;
schema:addressLocalityMarina del Rey” ;
schema:postalCode “90292” ;
schema:streetAddress “4676 Admiralty Way” .

字面值的类型(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
2
3
4
5
6
7
_:s rdf:type        rdf:Statement .
_:s rdf:subject <http://szekelys.com/family#sam> .
_:s rdf:predicate foaf:mbox .
_:s rdf:object <Sam@gmail.com>

_:s dcterms:date “2012-06-19”^^xsd:date .
_:s dcterms:creator <http://uniandes.edu.co/faculty#claudiaj> .

RDF syntax in turtle

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 协议 ,转载请注明出处!