程序代写代做代考 scheme AI discrete mathematics Lecture 2 Chapter 3 Describing Web Resources in RDF

Lecture 2 Chapter 3 Describing Web Resources in RDF

Lecture 2

Chapter 3
Describing Web Resources in RDF
https://www.w3.org/RDF
https://www.w3.org/TR/rdf-syntax-grammar/

A Semantic Web Primer
Chapter 3
1

RDF stands for Resource Description Framework
RDF is a framework for describing resources on the web
RDF is designed to be read and understood by computers
RDF is not designed for being displayed to people
RDF is written in XML
RDF is a part of the W3C’s Semantic Web Activity
RDF is a W3C Recommendation

Chapter 1
A Semantic Web Primer
2
What’s RDF?

RDF documents are written in XML. The XML language used by RDF is called RDF/XML.
By using XML, RDF information can easily be exchanged between different types of computers using different types of operating systems and application languages.

Chapter 1
A Semantic Web Primer
3
What’s RDF?

Lecture Outline
Basic Ideas of RDF
XML-based Syntax of RDF
RDF Graph Visualization
Chapter 3

A Semantic Web Primer
4

Drawback of XML

XML does not provide any means of talking about the semantics (meaning) of data.
E.g., there is no intended meaning associated with the nesting of tags. It is up to each application to interpret the nesting.

Chapter 3
A Semantic Web Primer
5

5

Chapter 3
A Semantic Web Primer
6
Nesting of Tags in XML
David Billington is a lecturer of Discrete Maths


David Billington


Discrete Maths

Opposite nesting, same information!

Chapter 3
A Semantic Web Primer
7
Basic Ideas of RDF

Triple (statement) object-attribute-value
Triple (statement) subject-predicator-object

David Billington is a lecturer of Discrete Maths

RDF has been given a syntax in XML
This syntax inherits the benefits of XML
Other syntactic representations of RDF possible

Chapter 3
A Semantic Web Primer
8
Basic Ideas of RDF (2)
The fundamental concepts of RDF are:
resources
properties
statements

Chapter 3
A Semantic Web Primer
9
Resources

Resource: a “thing” we want to talk about.
E.g. authors, books, publishers, places, people, hotels
Every resource has a URI (Universal Resource Identifier)
A URI can be
a URL (Uniform Resource Locator), Web address, or
some other kind of unique identifier

Which one is correct?

every URL is a URI
every URI is a URL
Chapter 2
A Semantic Web Primer
10

Chapter 3
A Semantic Web Primer
11
Properties
Special kind of resources
They describe relations between resources
E.g. “written-by”, “age”, “title”, etc.
Also identified by URIs
Two main advantages of using URIs:
providing a global, worldwide, unique naming scheme
reducing the homonym problem of distributed data representation

homonym problem
Chapter 1
12

Chapter 3
A Semantic Web Primer
13
Statements

Statements assert the properties of resources
A statement is an object-attribute-value triple
It consists of a resource, a property, and a value
Values can be resources or literals
Literals are atomic values (strings)
If instead of an attribute we use a verb, then we have
subject-predicate-object
Hence, both
object-attribute-value and
subject-predicate-object
as statements are correct.

What feature can be borrowed from XML to uniquely identify the resources and properties?
Chapter 2
A Semantic Web Primer
14

Chapter 3
A Semantic Web Primer
15
The Three Views of a Statement
in RDF:
An RDF statement:
A triple
A piece of a graph
A piece of XML code

An RDF document :
A set of triples
A graph (semantic net)
An XML document

Chapter 3
A Semantic Web Primer
16
Statements as Triples
The triple (x,P,y) can be considered as a logical formula, shown with P(x,y) in which the binary predicate P relates object x to object y.
RDF offers only binary predicates (properties)

Chapter 3
A Semantic Web Primer
17
XML Vocabularies

A directed graph with labeled nodes and arcs
from the resource (the subject of the statement)
to the value (the object of the statement)
Known in AI as a semantic net
The value of a statement may be a resource
Ιt may be linked to other resources

Chapter 3
A Semantic Web Primer
18
A Set of Triples as a Semantic Net

How many statements?
Chapter 2
A Semantic Web Primer
19

Chapter 3
A Semantic Web Primer
20
Statements in XML




rdf:about sets the object URI of a statement, rdf:resource sets the value URI of a statement.
# in “#David Billington” indicates an ID defined in the same document

Chapter 3
A Semantic Web Primer
21
Statements in XML
An RDF document is represented by an XML element with the tag rdf:RDF
The content of this element is a number of descriptions, which use rdf:Description tags.
Every description makes a statement about a resource, identified in 3 ways:
an about attribute, referencing an existing resource
an ID attribute, creating a new resource
without a name, creating an anonymous resource

Chapter 3
A Semantic Web Primer
22
Statements in XML
The rdf:Description element makes a statement about the resource http://www.cit.gu.edu.au/~db
Within the description
the property is used as a tag
the content is the value of the property

Chapter 3
A Semantic Web Primer
23
Data Types
In RDF, typed literals are used, if necessary
The main data types predefined by XML Schema are (i) booleans, (ii) integers, (iii) floating-point numbers, (iv) times, and (v)dates.




123

Write an RDF/XML representation for the following:

X is the referee in a chess game between players Y and Z

Chapter 2
A Semantic Web Primer
24

Chapter 3
A Semantic Web Primer
25
A Critical View of RDF: Binary Predicates
RDF uses only binary properties
This is a restriction because often we use predicates with more than 2 arguments
But binary predicates can simulate these

Example: Referee(X,Y,Z)
X is the referee in a chess game between players Y and Z

Chapter 3
A Semantic Web Primer
26
A Critical View of RDF: Binary Predicates
We introduce:
a new auxiliary resource chessGame
the binary predicates ref, player1, and player2
We can represent referee(X,Y,Z) as:

Chapter 3
A Semantic Web Primer
27
Reification
In RDF it is possible to make statements about statements
Grigoris believes that David Billington is the creator of http://www.cit.gu.edu.au/~db

Such statements can be used to describe belief or trust in other statements
The solution is to assign a unique identifier to each statement
It can be used to refer to the statement

Chapter 3
A Semantic Web Primer
28
Reification
Introduce an auxiliary object (e.g. belief1)
relate it to each of the 3 parts of the original statement through the properties subject, predicate and object
In the preceding example
subject of belief1 is David Billington
predicate of belief1 is creator
object of belief1 is http://www.cit.gu.edu.au/~db

Chapter 3
A Semantic Web Primer
29
A Critical View of RDF: Reification
The reification mechanism is quite powerful
It appears misplaced in a simple language like RDF
Making statements about statements introduces a level of complexity that is not necessary for a basic layer of the Semantic Web
Instead, it would have appeared more natural to include it in more powerful layers, which provide richer representational capabilities

Chapter 3
A Semantic Web Primer
30
A Critical View of RDF: Summary
RDF is not an optimal modeling language but
It is already a de facto standard
It has sufficient expressive power
At least as for more layers to build on top
It offers the benefit that information maps unambiguously to a model

Lecture Outline
Basic Ideas of RDF
XML-based Syntax of RDF
RDF Graph Visualization

Chapter 3

A Semantic Web Primer
31

Chapter 3
A Semantic Web Primer
32
XML-Based Syntax of RDF
An RDF document consists of an rdf:RDF element
The content of that element is a number of descriptions
A namespace mechanism is used
Disambiguation
Namespaces are expected to be RDF documents defining resources that can be reused

Chapter 3
A Semantic Web Primer
33



David Billington
Associate Professor
27


Discrete Maths
David Billington


Programming III
Michael Maher

Chapter 3
A Semantic Web Primer
34

Note that “CIT1111“, like its all similar resources, has been used for the simplicity purposes and in fact should be “http://www.mydomain.org/uni-ns/#CIT1111”

Take a break 
35

Chapter 3
A Semantic Web Primer
36
rdf:about versus rdf:ID
An element rdf:Description has
an rdf:about attribute indicating that the resource has been “defined” elsewhere
An rdf:ID attribute indicating that the resource is defined now

Chapter 3
A Semantic Web Primer
37
Property Elements
Content of rdf:Description elements

Knowledge Representation
Grigoris Antoniou

uni:courseName and uni:isTaughtBy define two property-value pairs for CIT3116 (two RDF statements)
read conjunctively

Chapter 3
A Semantic Web Primer
38
Data Types
The attribute rdf:datatype=”&xsd:integer” is used to indicate the data type of the value of the age property

David Billington
Associate Professor
27

Chapter 3
A Semantic Web Primer
39
Data Types (2)
The age property has been defined to have “&xsd:integer” as its range
It is still required to indicate the type of the value of this property each time it is used
This is to ensure that an RDF processor can assign the correct type of the property value even if it has not “seen” the corresponding RDF Schema definition before

Chapter 3
A Semantic Web Primer
40
The rdf:resource Attribute
The relationships between courses and lecturers (in the example) were not formally defined but existed implicitly through the use of the same name
The use of the same name may just be a coincidence for a machine
We can denote that two entities are the same using the rdf:resource attribute

Chapter 3
A Semantic Web Primer
41
The rdf:resource Attribute

Discrete Mathematics


David Billington
Associate Professor

As you notice, T949318 is for the simplicity purposes and in fact should be
“http://www.mydomain.org/uni-ns/# T949318 ”

Chapter 3
A Semantic Web Primer
42
Referencing Externally Defined Resources
E.g., to refer the externally defined resource CIT1111:
http://www.w3.org/1999/02/22-rdf-syntax-ns#CIT1111
as the value of rdf:about
http://www.w3.org/1999/02/22-rdf-syntax-ns is the URI where the definition of CIT1111 is found
A description with an ID defines a fragment URI, which can be used to reference the defined description

Chapter 3
A Semantic Web Primer
43
Nested Descriptions: Example

Discrete Maths


David Billington
Associate Professor



Note:
rfd:ID attribute for creating a new resource
rfd:about attribute for referencing an existing attribute

Chapter 3
A Semantic Web Primer
44
Introducing some Structure to RDF Documents using the rdf:type Element


Discrete Maths




David Billington
Associate Professor

Because 949318 has been defined in the same document, we have used #.
Otherwise we needed to write the name of the document followed by #

Chapter 3
A Semantic Web Primer
45
Abbreviated Syntax
Simplification rules:
Childless property elements within description elements may be replaced by XML attributes
For description elements with a typing element we can use the name specified in the rdf:type element instead of rdf:Description

These two rules create syntactic variations of the same RDF statement.

Applying the two simplification rules you learned, convert the following RDF to its abbreviated syntax.
Chapter 2
A Semantic Web Primer
46
https://www.w3.org/RDF/Validator/





Discrete Maths




David Billington
Associate Professor


Chapter 1
A Semantic Web Primer
47

Application of First Simplification Rule











Chapter 1
A Semantic Web Primer
48

Application of Second Simplification Rule









Chapter 1
A Semantic Web Primer
49

Chapter 3
A Semantic Web Primer
50
Container Elements
Collect a number of resources or attributes about which we want to make statements as a whole
E.g., we may wish to talk about the courses given by a particular lecturer
The content of container elements are named rdf:_1, rdf:_2, etc.
Alternatively rdf:li

Chapter 3
A Semantic Web Primer
51
Three Types of Container Elements
rdf:Bag an unordered container, allowing multiple occurrences
E.g. members of the faculty board, documents in a folder
rdf:Seq an ordered container, which may contain multiple occurrences
E.g. modules of a course, items on an agenda, an alphabetized list of staff members (order is imposed)
rdf:Alt a set of alternatives
E.g. translations of a document in various languages

Chapter 3
A Semantic Web Primer
52
Example for a Bag







Chapter 3
A Semantic Web Primer
53
Example for Alternative







Chapter 3
A Semantic Web Primer
54
Rdf:ID Attribute for Container Elements







Chapter 3
A Semantic Web Primer
55
RDF Collections
Shorthand syntax:
“Collection” value for the rdf:parseType attribute:







Chapter 3
A Semantic Web Primer
56
RDF Collections
A limitation of these containers is that there is no way to close them
“these are all the members of the container”
RDF provides support for describing groups containing only the specified members, in the form of RDF collections
list structure in the RDF graph
constructed using a predefined collection vocabulary: rdf:List, rdf:first, rdf:rest and rdf:nil

Chapter 3
A Semantic Web Primer
57
Reification
As mentioned sometimes we wish to make statements about other statements
We must be able to refer to a statement using an identifier
RDF allows such reference through a reification mechanism, which turns a statement into a resource.

Chapter 3
A Semantic Web Primer
58
Reification
rdf:subject, rdf:predicate and rdf:object allow us to access the parts of a statement
The ID of the statement can be used to refer to it, as can be done for any description
We write an rdf:Description if we don’t want to talk about a statement further
We write an rdf:Statement if we wish to refer to a statement

Perform reification on the following statement and give it the ID of
StatementAbout949352.

Validate your answer here:

Chapter 2
A Semantic Web Primer
59
https://www.w3.org/RDF/Validator/




Grigoris Antoniou


Chapter 1
A Semantic Web Primer
60

Reified





Grigoris Antoniou


Chapter 1
A Semantic Web Primer
61

Lecture Outline
Basic Ideas of RDF
XML-based Syntax of RDF
RDF Graph Visualization
Chapter 3

A Semantic Web Primer
62

RDF Graph Visualization

Chapter 1
A Semantic Web Primer
63

Example, RDF/XML




Discrete Maths




David Billington
Associate Professor


64

Example, Graph of the Data Model
Chapter 1
65

Join via this link:
https://discord.gg/te85ePs

Or scan the QR code!
Join the EIS Discord Server
Connect with your peers, join study groups and share with other students!

Note, the image is editable, simply right click it and select ‘replace picture’.
66

/docProps/thumbnail.jpeg