Semantic web2

79
Semantic Web

description

aan

Transcript of Semantic web2

Page 1: Semantic web2

Semantic Web

Page 2: Semantic web2

Little Known Facts

• Harrison Ford Played Hans Solo• Harrison Ford Played in Rolling Stones• Harrison Ford Played Duke Nukem

Page 3: Semantic web2

Little Known Facts

• Harrison Ford Played Hans Solo• Harrison Ford Played in Rolling Stones• Harrison Ford Played Duke Nukem

Page 4: Semantic web2

Harrison Ford Played Hans Solo

Page 5: Semantic web2

Little Known Facts

• Harrison Ford Played Hans Solo• Harrison Ford Played in Rolling Stones• Harrison Ford Played Duke Nukem

Page 6: Semantic web2

Harrison Ford Played in Rolling Stones

Harrison Ford

Page 7: Semantic web2

Harrison Ford Played Hans Solo

Page 8: Semantic web2

Harrison Ford Played in Rolling Stones

Page 9: Semantic web2
Page 10: Semantic web2

Rolling Stones ?

Page 11: Semantic web2

Little Known Facts

• Harrison Ford Played Hans Solo• Harrison Ford Played in Rolling Stones• Harrison Ford Played Duke Nukem

Page 12: Semantic web2

Harrison Ford Played Duke Nukem

Movie and Character

Video Game

Page 13: Semantic web2

/browse/played/?s=t&def=22

/browse/played/?s=t&def=27

/browse/played/?s=t&def=36

Http://Dictionary.reference.com

http://Dictionary.reference.com

Http://Dictionary.reference.com

PLAYED

/browse/played/?s=t&def=26http://Dictionary.reference.com

Page 14: Semantic web2

Harrison Ford Played Hans Solo(triple)

Page 15: Semantic web2

Harrison Ford Played in Rolling Stones(Triple)

26

Page 16: Semantic web2

Harrison Ford Played Duke Nukem (triple)

27

Page 17: Semantic web2

Lets eliminate the duplicate data

27

wikp:

dict:

ibdb:

26

Page 18: Semantic web2

26

wikp:

dict:

ibdb:

wikp:Harrison_fordwikp:Hans_Solowikp:Harrison_ford_(silent_film_actor)wikp:Duke_Nukem

dict:played?s=t&def=22dict:played?s=t&def=26dict:played?s=t&def=27

ibdb:7057

22

Long Name Short Name

wikp = en.wikipedia.org/wikidict = dictionary.reference.com/browse/Ibdb = www.ibdb.com/production.php?id=

27

Page 19: Semantic web2

Harrison Ford Played Hans Solo

Harrison Ford Played in Rolling Stones

Harrison Ford Played Duke Nukem

wikp:Harrison_ford wikp:Hans_Solodict:played?s=t&def=22

wikp:Harrison_ford_(silent_film_actor) dict:played?s=t&def=26 ibdb:7057

wikp:Harrison_ford dict:played?s=t&def=27 wikp:Duke_Nukem

wikp = en.wikipedia.org/wikidict = dictionary.reference.com/browse/Ibdb = www.ibdb.com/production.php?id=

Page 20: Semantic web2

Resource Description Framework

“This is admittedly a pretty odd use of the word resource, but alternatives like entity or thing, which might be more accurate, Have their own issues. In any case, resource is the word used In semantics

-Semantic web for the working ontologist Jim Hendler and Dean Allemang

a framework for describing data through the “subject > predicate > object” relationships. Where the “predicate” and “Object” can be subsequent “Subjects” of more detailed descriptions (RDF is the idea of “triples”). All Subject, Predicates, and Objects are defined by either URI or Literals

- Me

a framework for representing information in the Web.- W3C

Page 21: Semantic web2

“Played in” verses “Played”/browse/played/?s=t&def=26http://Dictionary.reference.com

“Played”

“Played In”

Nothing in Dictionary.com for “Played in”

wikp:Rollingstone,_Minnesota

“Portrayed an character in”

Page 22: Semantic web2

RDFS = Resource Definition Framework

Schema Language

Page 23: Semantic web2

Make one uphttp://Art-Nicewicks-URL-Used-To-Globally-Define-Terms.com\PlayedIn

Ipaddress 111.222.333.444 = Art-Nicewicks-URL-Used-To-Globally-Define-Terms.com111.222.333.444\Playin

Is there a easy way for me to say what this term “Playedin” means, without Having to put up a website? … Is there some way I could just say a little Data about the data …. Hmm … Metadata …

Note: Tim Berneers –lee wants all URI\URL assigned

Page 24: Semantic web2

RDF schemaRDF Schema – Metadata about the data

MyTerm:playedIn rdfs:Label “Portrayed an character in”

myTerm = Art-Nicewicks-URL-Used-To-Globally-Define-Terms.com

There is a schema definition vocabulary for triples at “www.w3.org/TR/rdf-schema/#ch_”rdfs = www.w3.org/TR/rdf-schema/#ch_”

Page 25: Semantic web2

Lets also use RDFS:Label to make it more readable

I’d like to say “dict:played?s=t&def=22” RDFS:label “Acted”

“dict:played?s=t&def=27” “Played a Game”

“ibdb:7057” “The 1918 play called Rolling Stones”

“wikp:Duke_Nukem” “Duke Nukem the Video Game”

•dict:played?s=t&def=22•dict:played?s=t&def=26•dict:played?s=t&def=27•ibdb:7057•wikp:Duke_Nukem

RDFS:label

RDFS:label

RDFS:label

Page 26: Semantic web2

Our Triple Store(Ambiguous)

• Harrison Ford Played Hans Solo• Harrison Ford Played in Rolling Stones• Harrison Ford Played Duke Nukem

Subject Predicate Object

Page 27: Semantic web2

dict:played?s=t&def=22 Rdfs:label “Acted ”

dict:played?s=t&def=27 Rdfs:label “Played a Game”

ibdb:7057 Rdfs:label “The 1918 play called Rolling Stones”

wikp:Duke_Nukem” Rdfs:label “Duke Nukem the Video Game”

wikp:Harrison_ford wikp:Hans_Solodict:played?s=t&def=22

wikp:Harrison_ford_(silent_film_actor) myTerm:PlayedIn ibdb:7057

wikp:Harrison_ford dict:played?s=t&def=27 wikp:Duke_Nukem

wikp = en.wikipedia.org/wikidict = dictionary.reference.com/browse/Ibdb = www.ibdb.com/production.php?id=rdfs = www.w3.org/TR/rdf-schema/#ch_”myTerm = Art-Nicewicks-URL-Used-To-Globally-Define-Terms.com

Our Triple Store(Not Ambiguous)Subject Predicate Object

myTerm:PlayedIn Rdfs:label “Portrayed an character in”

Page 28: Semantic web2

myTerm:PlayedIn Rdfs:label “Portrayed an character in”

dict:played?s=t&def=27 Rdfs:label “Played a Game”

ibdb:7057 Rdfs:label “The 1918 play called Rolling Stones”

wikp:Duke_Nukem” Rdfs:label “Duke Nukem the Video Game”

wikp:Harrison_ford wikp:Hans_Solodict:played?s=t&def=22

myTerm:PlayedIn ibdb:7057

wikp:Harrison_ford dict:played?s=t&def=27 wikp:Duke_Nukem

Our Triple Store(Not Ambiguous)

Subject Predicate Object

wikp:Harrison_ford_(silent_film_actor)

The 1918 play called “Rolling Stones”

wikp:Harrison_ford_(silent_film_actor)

Rdfs:label “Harrison Ford of silent movies”

Harrison Ford of the silent movies portrayed an character in

Page 29: Semantic web2

- http://www.w3.org/TR/rdf-concepts/

GRAPH

Page 30: Semantic web2

Triples and Graphs

Topics to cover: Blank Node, Literal, Property, Graph

Page 31: Semantic web2

W3C (Everything is a Resource)

Page 32: Semantic web2

Our Graph

Subject

Predicate

Object“Hans Solo”

Harrison Ford

Played

wikp:Harrison_ford wikp:Hans_Solodict:played?s=t&def=22Triple

AKA: Property

Page 33: Semantic web2

RDF:Type = “is a”

Page 34: Semantic web2

Lets collect a little more info (“is a”) Harrison Ford is a Male Actor

Harrison Ford is a Male Actor

is a Video Game

is a Play

Page 35: Semantic web2

Creating Classes (Rdf:type)

ibdb:7057

wikp:Duke_Nukem”

wikp:Harrison_ford_(silent_film_actor)

wikp:Harrison_ford

rdf:Type

rdf:Type (AKA “is a” or “a”)

rdf:Type

rdf:Type

Rdfs:label

“The 1918 play called Rolling Stones”

wikp:Actor

wikp:Video_game

wikp:Play_theator

Page 36: Semantic web2

Type = Class ~= TableActor Table

Primary Key Name BirthDate BirthPlace

wikp:Harrison_ford

wikp:Harrison_ford_(silent_film_actor)

wikp:Brad_Pitt

Harrison Ford

Harrison Ford

William Brad Pitt

7/13/1942

3/18/1884

12/18/1963

Illinois

Kansas

Oklahoma

dbpedia2:birthPlace "Shawnee, Oklahoma, U.S."@en<wikp:Brad_Pitt>

dbpedia2:dateOfBirth "1963-12-18"^^xsd:date<wikp:Brad_Pitt>

"Pitt, William Bradley"@endbpedia2:name <wikp:Brad_Pitt>

"1942-07-13"^^xsd:date

"Ford, Harrison"@en

"Chicago, Illinois, U.S."@endbpedia2:birthPlace

dbpedia2:dateOfBirth

dbpedia2:name

<wikp:Harrison_Ford>

<wikp:Harrison_Ford>

<wikp:Harrison_Ford>

"Ford, Harrison"@endbpedia2:name <wikp:Harrison_Ford(Silent_File_Actor)>. . .

Rdf:Type Actor<wikp:Brad_Pitt>

Rdf:Type Actor<wikp:Harrison_Ford>

Rdf:Type Actor<wikp:Harrison_Ford(Silent_File_Actor)>

Subject Predicate Object Triple

Page 37: Semantic web2

Named Graph

Page 38: Semantic web2

What about the other “Rolling Stones”Rolling Stones is a Music Group

Rdf:Type

Predicate (AKA: Property)

“Table Columns ? ”

Page 39: Semantic web2

Rolling Stones has 29 rdf:type

Dbpedia.org ??schema.org ??

Page 40: Semantic web2

Lets collect a little more info (“is a”)

Hans Solo is a fictional character

Hans Solo is a character in the movie “star wars”

“Played” is a type of pretending

Star Wars is a http://dbpedia.org/ontology/Film

is a character in is a participation

Page 41: Semantic web2

Our Graph (now we can infer)

Is a

Is a type of

Is a

Played In

A character In

Inference

Is a

PropertiesHave classes

“Participation”

Is a type of

Page 42: Semantic web2

Rdfs:subClassOf

Rdfs:subPropertyOf

Properties and Classes

“Acting”

“Pretending”

“Film”

“Show”

Page 43: Semantic web2

“Movie”“Movie Star”

“Performs In”

Range

“Rdfs:Type” “Rdfs:Type”

“values of a property” 

“property Instance of class” 

Domain

“Performs In”

StarWars

MovieStars

PerformedIn

Rdfs:Domain

<wikp:Harrison_Ford>

PerformedIn

Subject Predicate Object Triple

StarWarsRdfs:RangePerformedIn

(Property)

(Subject)

Page 45: Semantic web2

Rdf:type Rdfs:DataTypeXsd:Date

rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://example.org/item01"> <ex:prop rdf:parseType="Literal" xmlns:a="http://example.org/a#"><a:Box required="true"> <a:widget size="10" /> <a:grommit id="23" /></a:Box> </ex:prop> </rdf:Description> </rdf:RDF>

Page 46: Semantic web2

Rdfs:subClassOf Rdfs:subClassOf

Movie StarExtra

Actor

Page 47: Semantic web2

RDF:Type = “is a”

Page 48: Semantic web2

A break, to tell you what I don’twant to talk about

URI vs IRI vs URI

N3 vs RDF\XML vs Turtle

Page 49: Semantic web2
Page 50: Semantic web2
Page 51: Semantic web2

InfoBlox

Page 52: Semantic web2

http://journal.webscience.org/475/1/98_paper.pdf

Page 53: Semantic web2
Page 54: Semantic web2

Lets look at Dbpedia – First we need A Query … SPARQL ~ SQL

SELECT Subject , ?Predicate , ?Object FROM Subject_Predicate_Object_TableWHERE { Subject =“<http://dbpedia.org/resource/Harrison_Ford>"and ?Predicate like ‘%’ and ?Object like ‘%’}

Not required in SQL, but we’ll leaveIt here to help showThe differences

Page 55: Semantic web2

1. The “from” is defaulted 2. The position infers the “Subject =“3. No Quotes around URL4. Use “{}” instead of ()

SELECT Subject , ?Predicate , ?Object FROM Subject_Predicate_Object_TableWHERE { Subject =“<http://dbpedia.org/resource/Harrison_Ford>"and ?Predicate like ‘%’ and ?Object like ‘%’}

Page 56: Semantic web2

SELECT Subject , ?Predicate , ?Object FROM Subject_Predicate_Object_TableWHERE { Subject =<http://dbpedia.org/resource/Harrison_Ford>and ?Predicate like ‘%’ and ?Object like ‘%’}

5. Only the positional values with “?” in front are inferred in the select list 6. No comma between items in select list7. The “and” is inferred 8. The “like ‘%’” is inferred

Page 57: Semantic web2

SPARQL

SELECT ?Predicate ?Object

WHERE {

<http://dbpedia.org/resource/Harrison_Ford> ?Predicate ?Object

}

Page 58: Semantic web2

SELECT ?Predicate ?Object WHERE {<http://dbpedia.org/resource/Harrison_Ford> ?Predicate ?Object }

Predicate Object

Page 59: Semantic web2

Predicate Object

SELECT ?Subject ?Predicate WHERE {<http://dbpedia.org/resource/Harrison_Ford> ?Subject ? ?Predicate }

Page 60: Semantic web2

Sparql Queries The movies that were written by one of Harrison Fords wives ?

SELECT ?s ?p ?o WHERE {

{:Harrison_Ford dbpedia2:spouse ?o.?s <http://dbpedia.org/property/writer> ?o }

}order by ?s

s callret-1 o

:E.T._the_Extra-Terrestrial dbpedia2:writer :Melissa_Mathison

:Kundun dbpedia2:writer :Melissa_Mathison

:The_Black_Stallion_%28film%29

dbpedia2:writer :Melissa_Mathison

:The_Escape_Artist dbpedia2:writer :Melissa_Mathison

:Twilight_Zone:_The_Movie dbpedia2:writer :Melissa_Mathison

Page 61: Semantic web2

Virtuoso online iSparql

Page 63: Semantic web2

Freebase or DBPediaBoth extract structured data from Wikipedia and make it available as RDF

Freebase and dbpedia have different schemas, different identifiers, and different goals.

Freebase imports data from a wide variety of sources, not just Wikipedia, whereas DBPedia focuses on just Wikipedia data

DBPedia is funded by grants/sponsorships from various organisations, while Freebase is run by Metaweb, an incorporated company.

DBpedia lets you query its data via a SPARQL end pointFreebase lets you query its data via an MQL API

DBpedia has strong connections to the Semantic Web research community.Freebase has strong connections to the open data / startup community.

DBpedia tools are developed by 3rd parties and the open-source community.Freebase tools are developed by Metaweb and the Freebase community.

Page 64: Semantic web2

Freebase and MQL

Page 65: Semantic web2
Page 67: Semantic web2

RPI Logd http://logd.tw.rpi.edu

Page 68: Semantic web2

Logd.tw.rpi.edu/sparql LOGD

Page 69: Semantic web2

RPI Logd results from Sparql Query

Page 70: Semantic web2

Data.gov Sparql service (Types)

Page 71: Semantic web2
Page 72: Semantic web2
Page 73: Semantic web2
Page 74: Semantic web2

RDFa (Query the web pages)<html> <head> ... </head> <body> ...

Wikinomics <br/>Don Tapscott<br/>2006-10-01<br/>

</body>

<html> <head> ... </head> <body> ...<div xmlns:dc="http://purl.org/dc/elements/1.1/"

xmlns:my=" http://www.myURL.com/" about=“my:Page001”

<p> <span property="dc:title">Wikinomics</span> <br/> <span property="dc:creator">Don Tapscott</span> <span property="dc:date">2006-10-01</span> </div> </body>

exec 'SELECT * WHERE { ?s ?p ?o }' --data ‘www.myURL.com/Page001'

“Wikinomics”<dc:title>My:Page001

Subject Predicate Object Triple

“Don Tapscott”<dc:creator>My:Page001“2006-10-01”<dc:date>My:Page001

Page 75: Semantic web2

Drupal (Most popular CMS )*1

*1 Wordpress is much larger, but classified as blog

Page 76: Semantic web2
Page 77: Semantic web2

OWLWeb Ontology Language

Page 78: Semantic web2

OWLWeb Ontology Language