Semantic web2

Post on 20-Jan-2015

664 views 4 download

Tags:

description

aan

Transcript of Semantic web2

Semantic Web

Little Known Facts

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

Little Known Facts

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

Harrison Ford Played Hans Solo

Little Known Facts

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

Harrison Ford Played in Rolling Stones

Harrison Ford

Harrison Ford Played Hans Solo

Harrison Ford Played in Rolling Stones

Rolling Stones ?

Little Known Facts

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

Harrison Ford Played Duke Nukem

Movie and Character

Video Game

/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

Harrison Ford Played Hans Solo(triple)

Harrison Ford Played in Rolling Stones(Triple)

26

Harrison Ford Played Duke Nukem (triple)

27

Lets eliminate the duplicate data

27

wikp:

dict:

ibdb:

26

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

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=

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

“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”

RDFS = Resource Definition Framework

Schema Language

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

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_”

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

Our Triple Store(Ambiguous)

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

Subject Predicate Object

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”

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

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

GRAPH

Triples and Graphs

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

W3C (Everything is a Resource)

Our Graph

Subject

Predicate

Object“Hans Solo”

Harrison Ford

Played

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

AKA: Property

RDF:Type = “is a”

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

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

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

Named Graph

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

Rdf:Type

Predicate (AKA: Property)

“Table Columns ? ”

Rolling Stones has 29 rdf:type

Dbpedia.org ??schema.org ??

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

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

Rdfs:subClassOf

Rdfs:subPropertyOf

Properties and Classes

“Acting”

“Pretending”

“Film”

“Show”

“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)

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>

Rdfs:subClassOf Rdfs:subClassOf

Movie StarExtra

Actor

RDF:Type = “is a”

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

URI vs IRI vs URI

N3 vs RDF\XML vs Turtle

InfoBlox

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

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

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 ‘%’}

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

SPARQL

SELECT ?Predicate ?Object

WHERE {

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

}

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

Predicate Object

Predicate Object

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

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

Virtuoso online iSparql

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.

Freebase and MQL

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

Logd.tw.rpi.edu/sparql LOGD

RPI Logd results from Sparql Query

Data.gov Sparql service (Types)

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

Drupal (Most popular CMS )*1

*1 Wordpress is much larger, but classified as blog

OWLWeb Ontology Language

OWLWeb Ontology Language