36
Part I

Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Embed Size (px)

Citation preview

Page 1: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Part I

Page 2: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Resource and AAAIn the Semantic Web, anything is a ‘resource’ if

anything can be said about it by anyone for any purpose

The AAA slogan applies to the Semantic Web: “Anyone can say Anything about Any topic”

A resource is anything with identity (URI), and could be physical (rock, river, fault) or digital (image, document, webpage, or a collection of these)

Hence, Resource Description Framework (RDF) is a language that describes resources (e.g., web pages or entire web site), and data, metadata, and other languages (RDFS, OWL)

Page 3: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

URI and URIrefResources are identified on the Web by the URI

(Uniform Resource Identifier),

URI is a character string that identifies an abstract or physical resource on the Web

URI references are used to name all kinds of things in RDF

Unlike URL, URI does not have to have a network location!In RDF, URIrefs are used only to identify things

(they cannot be retrieved on the Web) However, Linked Data uses http to retrieve data

Browsers use URIrefs to retrieve things

Page 4: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

URIrefURIref (URI reference) is a URI with an optional

fragment identifier at the end, that identifies:

An individual http://www.gsu.edu/people/contact#me

A type (class)http://www.gsu.edu/GEOS/structure#Fault

A propertyhttp://www.gsu.edu/GEOS/Structure/Fault#attitude

A property valuehttp://www.gsu.edu/GEOS/Structure/Fault/attitude/030,45SE

Page 5: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Absolute and relative URIrefAbsolute URIref identifies a resource independently of the

context in which the URIref appears, for example:http://www.gsu.edu/~geohab/index.htm

The absolute URIref for the rdf:description Qname is:http://www.w3.org/1999/02/22-rdf-syntax ns#description

Relative URIref is a shorthand form of the absolute URIref in which the prefix is missing. Therefore it requires information from the context to fill in the omitted prefix.

For example, the relative URIref geol4123_6123.htm when it appears in the resource

http://www.gsu.edu/~geohab/Babaie/pages/Geol4123_6123, would be filled out to the following absolute URIref:

http://www.gsu.edu/~geohab/Babaie/pages/Geol4123_6123/geol4123_6123.htm

Page 6: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Qualified names (Qname)A namespace, or vocabulary, is a collection of

names, identified by URIrefs. For example, the namespace for rdf is:http://www.w3.org/1999/02/22-rdf-syntax-ns#

These names may be qualified names (Qnames), which are identifiers of the ‘prefix:name’ form, given by a namespace prefix (e.g., rdf, rdfs), followed by a colon (:), followed by a local part (e.g., type, description)

For example

rdf:type, rdf:description

Page 7: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Resource Description FrameworkRDF is an ontology language for the

representation of information and metadata about resources and objects on the Web

RDF is a namespace or vocabulary, with the rdf prefix

RDF has three notations: RDF triplesRDF graphRDF/XML

Page 8: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF triple statementAn RDF statement is a triple (S, P, O), where:

S is a URIref, called subject; it may not be a literalP is a URIref, called property (predicate); may

not be a literalO is either a URIref or a literal value, called an

object

A subject resource, S, may have a property P with value from O (a class), or a P property with value O (a literal)

Depending on whether the object is a class or a literal, the rdf statements can be of either of the following two forms: <S> <P> <O> or <S> <P> “O”

Page 9: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF is a vocabularyA vocabulary, made of RDF statements, is a

set of unique URIrefs, which can be specified by either:

qualified names (e.g., rdf : type, rdf : about, rdf : resource, dc : title, dc : creater, dc : date), which are used as properties of the rdf statements NOTE: dc is the prefix for the Dublin Core vocabulary

that describes document metadata, and is reused in many ontologies

fragment identifiers, which are used to denote

subjects or objects of the rdf statements, e.g., <http:/www.Mineralogy.org/Minerals#mica>

Page 10: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF graphRDF triples can be denoted with nodes,

representing subjects and objects, and directed arcs or edges (from S to O), representing predicates (properties)

A node may be identified by a URIref or it can be a litteral or blank node

An arc is identified by a URIrefOnly absolute URIrefs are used as labels of the nodes

and arcsURIrefs are shown with ellipsesLiterals are shown with boxesProperties are labeled with character strings

Page 11: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF graph - examplehttp://www.gsu.edu/~geohab/Babaie/index.html has

creation date of September 1, 2000 and is written in English

http://www.gsu.edu/~geohab/Babaie/index.html

Hassan Babaie

enSeptember 1, 2000

http://purl.org/dc/elements/1.1/language

http://purl.org/dc/elements/1.1/creater

http://www.example.org/terms/creation-date

Page 12: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

http://www.gsu.edu/Geosciences/contact#Faculty

http://www.gsu.edu/Geosciences/contact#me

http://www.w3.org/1999/02/22-rdf-syntax-ns#type

http://www.gsu.edu/Geosciences/contact#fullName

http://www.gsu.edu/Geosciences/contact#email

http://www.gsu.edu/Geosciences/contact#title

Hassan Babaie

[email protected]

Associate Professor

Page 13: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Porosity

HydraulicPropertyAquifer

test

HydraulicConductivity

Hydrogeologist

has

ConfinedAquifer UnconfinedAquifer

A Graph represents multiple statements

S

O

P

S OP

Page 14: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

latitude

42.834

Location

Sample

longitude

takes

110.2345

Geochemist

hasLocationAffiliation

has

has

Image

A Graph represents multiple statements

Page 15: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Examples of SPOMinerals: mica Minerals: identified-by Geologist:G1234

<http:/www.Mineralogy.org/Minerals#mica>

<http://www.Mineralogy.org/Minerals#identified-by>

<http://www.Mineralogy.org/Geologist#G1234>

Minerals:mica Minerals:cleavage “one direction”

<http:/www.Mineralogy.org/Minerals#mica>

<http://www.Mineralogy.org/Minerals#cleavage>

“One direction”

Minerals:Habit Minerals:habit “flaky”

<http:/www.Mineralogy.org/Minerals#Habit>

<http://www.Mineralogy.org/Minerals#habit

“flaky”

Page 16: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

http://www.Mineralogy.org/Minerals#identified-by

RDF graph for the example

http://www.Mineralogy.org/Minerals#mica

http://www.Mineralogy.org/Geologist#G1234

“one direction” “Flaky”

http://www.Mineralogy.org/Minerals#cleavage

http://www.Mineralogy.org/Minerals#habit

Minerals: mica Minerals: identified-by Geologist:G1234

Minerals:mica Minerals:cleavage “one direction” Minerals:Habit Minerals:habit “flaky”

Page 17: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF/XML notation of the example<?xml version=“1.0” encoding=“utf-8”?>

<rdf : RDF

xml : base = “http://www.Mineralogy.org/Minerals”

xmlns : rdf = “http://www.w3.org/1999/02/22-rdf-syntax-ns#”

xmlns : dc = “http://purl.org/dc/elements/1.1”

xmlns : min = “http://www.Mineralogy.org/Minerals”> <! - - assume name space exists - - >

<rdf : Description>

<rdf : about =“#mica”> <! - - This is the subject, S -->

<min : identified-by> < ! - - Predicate, P - - >

<rdf : resource=“#G1234”> < ! - - This is the object, O - - >

</rdf : Description>

<rdf : Description>

<rdf : about =“#mica”> <! - - This is the subject, S -->

<min : cleavage> one-direction </min:cleavage> <! - - cleavage is P; “one direction” is O-->

</rdf : Description>

<rdf : Description>

<rdf : about =“#mica”> <! - - This is the subject, S -->

<min : habit>flaky </min : habit> <! - - habit is P; “flaky” is O -->

</rdf : Description>

</rdf : RDF>

Page 18: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Notes for the previous codeQualified names (e.g., dc : date, min : cleavage) are used to

abbreviate the URIrefs

rdf statement is nested in the rdf : Description qualified nameThe rdf : about specifies the subject of each rdf statementThe rdf : resource specifies the object of the rdf statement

Because the xml : base URIref: (http://www.Mineralogy.org/Minerals) is defined, the absolute URIref is given by the concatenation of the local URIref (fragment identifier), i.e., the base URIref and #mica

The prefix namespace for the Mineralogy vocabulary (i.e., min) is given by the xmlns : min = “http://www.Mineralogy.org/Minerals”

The prefix for the Dublin Core namespace is given by 'dc‘ whose URIref is given at the top of the code

Page 19: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF Ordered List using N3 syntaxAn ordered list of the periods in the Mesozoic era can

be given in the Notation 3 (N3) format as SPO:

time : Mesozoic time : dividedInto (time : Triassic time : Jurassic time : Cretaceous).

Note: N3 (notation 3) is an RDF serialization format which uses qname (qualified name)

N3 first requires defining local qnames by binding a prefix to the global URI

For example, binding the ‘strat’ and ‘time’ prefixes to the Stratigraphy and Time ontologies is done as follows:

@prefix strat : <http://www.geoinformatics/ontologies/Stratigraphy.rdf#>@prefix time : <http://www.geoinformatics/ontologies/Time.rdf#>

Page 20: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Using Prefixes

Now we can use the prefixes to define an RDF triple

For example: we can say that Triassic precedes Jurassic (notice the period at the end of the N3 statement):

time : Triassic time : precedes time: Jurassic.

Page 21: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

One subject with n properties and objectsWe can even make a list of predicates and objects

for a single subject in one N3 statement. These are separated with a semicolon

We can list the data for the Asmari Formation as follows (note: Asmari is the subject):

strat : Asmari rdf : type strat : Formation;

strat : FormationThickness “200 m”;strat : FormationLithology “limestone”;strat : FormationAge “Oligo-Miocene”;strat : FormationFacies “Shallow Marine”;strat : FormationFossil “Foraminifera, algae, bryozoa,

echinoid”;…

Page 22: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Use comma to separate objectsIf several triples share the same subject and predicate,

we use a comma to separate the objects

The fact that the Mesozoic Era has three periods: Triassic, Jurassic, and Cretaceous, can be stated in one (instead of three) RDF statement in the N3 format:

Mesozoic has periods Triassic, Jurassic, and Cretaceous

time : Mesozoic time : period time : Triassic , time : Jurassic , time : Cretaceous .

Page 23: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

‘a’ for ‘rdf:type’In N3, we use the letter ‘a’ to substitute for ‘rdf:type’

So, we can make statements such as ‘sulfide is a mineral’ (defined in mineralogy ontology, prefix: ‘min’) or ‘rhyolite is a felsic volcanic rock’ (defined in the Petrology ontology, prefix: ‘petr’).

min : Sulfide rdf : type min : Mineral ormin : Sulfide a min : Mineral

petr : Rhyolite rdf : type FelsicVolcanicRock orpetr : Rhyolite a FelsicVolcanicRock

Page 24: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF vocabularyIn RDF, an individual resource is assigned as an

instance of another resource (class) with the rdf : type predicate

“Idaho pluton is a pluton” is written in RDF triple as:petr: IdahoPluton rdf : type petr : pluton

The rdf : Property is the class of all property resources, and allows defining all the attributes that describe the resource (e.g., can define color and cleavage for Mineral)

e.g., define ‘deforms’ to be a property:struc : deforms rdf : type rdf : Property

Page 25: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

rdf : Description, rdf : about, rdf : resourceBecause RDF is resource description framework, the

rdf : Description begins the description of an RDF statement

rdf : about is an attribute of the rdf : Description, and indicates the subject of the rdf statement

rdf : resource is an attribute of the property, and indicates the object of the RDF statement

<rdf : Description>

<rdf : about =“#mineral122”>

<min : identified-by>

<rdf : resource=“#G1234”>

</rdf : Description>

Page 26: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

rdf : ID property rdf : datatype propertyrdf : ID is an attribute of the rdf : DescriptionIt indicates the subject of the RDF statement

<rdf : Description rdf : ID “structuralGeology.htm”>

</rdf : Description>

rdf : datatype is an attribute of the property element, and has XSD datatype as value; allows defining the type of literals to the property

Statement: Fault fault:length “20 “ is written as:

<rdf : Description rdf:about="http://www.geology.org/Fault">

<fault:length rdf:datatype=“http://www.w3.org/2001/XMLSchema#int>20</fault:length>

</rdf : Description>

Page 27: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

RDF containersRDF has three constructs to be used as

collections of resources:

rdf : BagFor grouping of resources without order

rdf : SeqFor grouping of resources with order

rdf : AltIs a special type of rdf: Bag

used for describing a set of equivalent alternatives

Page 28: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

rdf:_n predicates, rdf : BagRDF has a set of special predicates: rdf:_1, rdf:_2, …,

rdf:_n, to associate a container as the subject with a resource it contains as the object

@prefix min: <http://www.mineralogy.org/>.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.

Group plagioclase (resources) without ordermin: Plagioclase rdf : type rdf : Bag;

rdf:_1 min : albite;

rdf:_2 min : anorthite;

rdf:_3 min : oligoclase;

rdf:_4 min : andesine;

rdf:_5 min : labradorite;

rdf:_6 min : bytownite. <! – now say: gabbro has mineral plag. - - >

petr : gabbro min:mineral min:Plagioclase.

Page 29: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Rdf : Seq@prefix planet: <http://www.planetaryGeology.org/>.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.

planet: Planets rdf : type rdf : Seq;

rdf:_1 planet : Mercury;

rdf:_2 planet : Venus;

rdf:_3 planet : Earth;

rdf:_4 planet : Mars;

rdf:_5 planet : Jupiter;

rdf:_6 planet : Saturn;

rdf:_7 planet : Uranus;

rdf:_8 planet : Neptune.

planet: Sun planets planet : Planets.

Page 30: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

rdf : Alt@prefix gsu: <http://www.gsu.edu>.@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefix foaf: <http://xmlns.com/foaf/0.1>.@prefix people: <http://www.geoinformatics.net/people>.

gsu : webpage rdf : type rdf : Alt;

rdf:_1 <http://www.gsu.edu>;

rdf:_2 <http://www2.gsu.edu>.

people: Babaie foaf : homepage gsu : webpage.

Page 31: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Blank or anonymous node (bnode)Sometimes, we want to say something about an individual

with certain properties, but we do not want to name that node, i.e., identify it with a URI (or we don’t have the URI), but want to use the node as a structured entity, i.e., an abstract template.

For example, the social networks do not issue a URI to members; the data about the members are connected to the blank node

In many-valued relationships, we may need to introduce auxiliary nodes, to connect many objects to one subject

Blank nodes are used for existential variables (e.g., someone), representing subject or object, for which we want to make assertions but cannot address a URI (someone know someone else) Since they do not have a URI, bnodes cannot be

referenced globally; they can only be referred to locally

Page 32: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

bnode …Let’s assume that we want to say

something about some geologist who has made a map, and this someone has name Babaie, and has email: [email protected]

http://www.geology.org/Maps/map1

nameemail

[email protected]

mapped_by

Page 33: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

bnode …bnodes can only be used for a subject or an object,

not for a predicate, which always needs a URIFor example, we may have information about a

subject (someone) but do not care to identify itIn this case, we use bnode and put the predicate and

object in a square bracket set []

Let’s say that we know that there is an outcrop of basalt, and that it is located in Nevada. We state the two statements (with bnode as subject) as follows:

[ rdf : type petr: outcrop;

geog: located-in geog : Nevada ]

rdf : typegeog : located_in

petr : Outcropgeog : Nevada

Page 34: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Why bnode?RDF only supports binary predicates in one

statement, i.e., relations between two resources

We cannot say, for example, that Geologist studies Mineral and geologist images Microstructures in one statement

In such a case, the solution is to create an auxiliary node (resource), that represents say study, and associate the new node to the geologist, and then link the node to the Mineral and Microstructure This is similar to a university which, through a

blank node representing address, connects to a series of address attributes (see image above)

Atlanta

“30303”

GSU

GA

Page 35: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Referring to a bnode Here is how to write: “geochemical sample N22

was taken in an outcrop which is located in Nevada”:

geochem : SampleN22 geochem : takenIn [ a petr: Outcrop geog: locatedIn : Nevada ].

 Notice that we are using ‘a’ for ‘rdf:type’, and

that geochemistry ontology defines the Sample class and takenIn property

rdf : typegeog : located_in

petr : Outcropgeog : Nevada

http://www.geochem.org/Sample/N22

geochem : taken-in

Page 36: Part I. Resource and AAA In the Semantic Web, anything is a ‘resource’ if anything can be said about it by anyone for any purpose The AAA slogan applies

Using bnodes with rdf : nodeIDbnodes can be referred to by assigning node ids to them,

using the rdf : nodeID qualified name

The serialization of the previous rdf graph is:<rdf : Description rdf : about = “http://www.geochem.org/Sample/N22”>

<geochem : taken-in rdf : nodeID =”id1”/>

</rdf : Description>

<rdf : Description rdf : nodeID =”id1”>

<geog : located-in> Nevada</geog : located-in>

<petr: Outcrop> Outcrop1 </petr : Outcrop>

</rdf : Description>

rdf : typegeog :

located_in

petr : Outcropgeog : Nevada

http://www.geochem.org/Sample/N22

geochem : taken-in