CS代考 CIT1111"> – cscodehelp代写

Lecture 2 Chapter 3 Describing Web Resources in RDF

Describing Web Resources in RDF

Copyright By cscodehelp代写 加微信 cscodehelp

https://www.w3.org/RDF
https://www.w3.org/TR/rdf-syntax-grammar/

A Semantic Web Primer

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

A Semantic Web Primer
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.

A Semantic Web Primer
What’s RDF?

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

A Semantic Web Primer

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.

A Semantic Web Primer

A Semantic Web Primer
Nesting of Tags in XML
is a lecturer of Discrete Maths



Discrete Maths

Opposite nesting, same information!

A Semantic Web Primer
Basic Ideas of RDF

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

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

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

A Semantic Web Primer

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
A Semantic Web Primer

A Semantic Web Primer
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

A Semantic Web Primer
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?
A Semantic Web Primer

A Semantic Web Primer
The Three Views of a Statement
An RDF statement:
A piece of a graph
A piece of XML code

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

A Semantic Web Primer
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)

A Semantic Web Primer
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

A Semantic Web Primer
A Set of Triples as a Semantic Net

How many statements?
A Semantic Web Primer

A Semantic Web Primer
Statements in XML
xmlns:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:mydomain=”http://www.mydomain.org/my-rdf-ns”>



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

A Semantic Web Primer
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

A Semantic Web Primer
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

A Semantic Web Primer
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

A Semantic Web Primer

A Semantic Web Primer
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

A Semantic Web Primer
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:

A Semantic Web Primer
Reification
In RDF it is possible to make statements about statements
Grigoris believes that 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

A Semantic Web Primer
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
predicate of belief1 is creator
object of belief1 is http://www.cit.gu.edu.au/~db

A Semantic Web Primer
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

A Semantic Web Primer
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

A Semantic Web Primer

A Semantic Web Primer
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

A Semantic Web Primer

xmlns:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema#”
xmlns:uni=”http://www.mydomain.org/uni-ns”>


Associate Professor
27


Discrete Maths



Programming III


A Semantic Web Primer

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 

A Semantic Web Primer
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

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

Knowledge Representation

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

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


Associate Professor
27

A Semantic Web Primer
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

A Semantic Web Primer
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

A Semantic Web Primer
The rdf:resource Attribute

Discrete Mathematics



Associate Professor

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

A Semantic Web Primer
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

A Semantic Web Primer
Nested Descriptions: Example

Discrete Maths



Associate Professor



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

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


Discrete Maths





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 #

A Semantic Web Primer
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.
A Semantic Web Primer
https://www.w3.org/RDF/Validator/





Discrete Maths





Associate Professor


A Semantic Web Primer

Application of First Simplification Rule











A Semantic Web Primer

Application of Second Simplification Rule









A Semantic Web Primer

A Semantic Web Primer
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

A Semantic Web Primer
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

A Semantic Web Primer
Example for a Bag






A Semantic Web Primer
Example for Alternative






A Semantic Web Primer
Rdf:ID Attribute for Container Elements







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







A Semantic Web Primer
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

A Semantic Web Primer
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.

A Semantic Web Primer
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:

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







A Semantic Web Primer









A Semantic Web Primer

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

A Semantic Web Primer

RDF Graph Visualization

A Semantic Web Primer

Example, RDF/XML




Discrete Maths



CS代考 加微信: cscodehelp QQ: 2235208643 Email: kyit630461@163.com

Leave a Reply

Your email address will not be published. Required fields are marked *