Top Banner
The Semantic Web in Action Kennissystemen, November 2009 Rinke Hoekstra
44

Ks2009 Semanticweb In Action

Jan 19, 2015

Download

Education

Rinke Hoekstra

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ks2009 Semanticweb In Action

The Semantic Web in ActionKennissystemen, November 2009

Rinke Hoekstra

Page 2: Ks2009 Semanticweb In Action

Overview

• The Semantic Web– Languages and Integration– Storage and Querying

• Linked (Open) Data– Scalability issues– Browsing and Viewing

• DEMOs• … if there’s time …

– OWL in Action04/10/2023 2

Page 3: Ks2009 Semanticweb In Action

The Semantic Web Ideology

• Identity is everything• Partial solutions are great too!• Layer cake

04/10/2023 3

OWL

Page 4: Ks2009 Semanticweb In Action

Semantic Web

• Intially• `Metadata’ for web pages

• Since ~2006• `Web of Data’• Semantic web as data source in its own right

• Linked Data

• A ‘Databaseesque’ Web• RDF Triple stores• Query languages

04/10/2023 4

Page 5: Ks2009 Semanticweb In Action

Languages

• Multiple Languages– RDF, RDFS and OWL

• Multiple Syntaxes– RDF/XML, Turtle (Restricted N3), Ntriple– Functional Syntax, Manchester Syntax, OWL XML

• RDF– Triples <subject, predicate,object>– Distributed– Always about something else– ... but can be about other RDF triples as well.

04/10/2023 5

Page 6: Ks2009 Semanticweb In Action

Languages: RDF(S)/XML<rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:rdfs="http://www.w3.org/TR/rdf-schema/" xmlns:owl=“http://www.w3.org/2002/07/owl#” xmlns:uva=“http://www.uva.nl/rdf#” xmlns=“http://www.uva.nl/people”> <rdf:Description rdf:ID=“#radboud”> <rdf:type rdf:resource=“http://www.uva.nl/rdf#AssociateProfessor”/> <uva:name>Radboud Winkels</uva:name> <uva:teaches rdf:resource=“http://www.uva.nl/courses#ks2009”/> </rdf:Description> <uva:Course rdf:about=“http://www.uva.nl/courses#ks2009”/> <rdfs:Class rdf:about=“http://www.uva.nl/rdf#AssociateProfessor”> <rdfs:subClassOf rdf:resource=“http://www.uva.nl/rdf#StaffMember”/> </rdfs:Class> <owl:ObjectProperty rdf:about=“http://www.uva.nl/rdf#teaches”> <rdfs:domain rdf:resource=“http://www.uva.nl/rdf#Professor”/> <rdfs:range rdf:resource=“http://www.uva.nl/rdf#Course”/> </owl:ObjectProperty></rdf:RDF>

04/10/2023 6

Page 7: Ks2009 Semanticweb In Action

Languages: Turtle@prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>.@prefix rdfs:<http://www.w3.org/TR/rdf-schema/>.@prefix owl:<http://www.w3.org/2002/07/owl#>.@prefix uva:<http://www.uva.nl/rdf#>.@prefix courses:<http://www.uva.nl/courses#>.@prefix :<http://www.uva.nl/people#>.

uva:AssociateProfessor a rdfs:Class;rdfs:subClassOf uva:StaffMember.

uva:teaches a owl:ObjectProperty;rdfs:domain uva:AssociateProfessor;rdfs:range uva:Course.

:radboud a uva:AssociateProfessor;uva:name ”Radboud Winkels”^^xsd:string;uva:teaches courses:ks2009.

courses:ks2009 a uva:Course.

04/10/2023 7

Page 8: Ks2009 Semanticweb In Action

Languages: FS

04/10/2023 8

Namespace(=<http://www.uva.nl/people#>)Namespace(owl=<http://www.w3.org/2002/07/owl#>)Namespace(uva=<http://www.uva.nl/rdf#>)Namespace(courses=<http://www.uva.nl/courses#>)

Declaration(Class(uva:Course))Declaration(Class(uva:StaffMember))Declaration(Class(uva:AssociateProfessor))SubClassOf(uva:AssociateProfessor uva:StaffMember)

Declaration(DataProperty(uva:name))Declaration(ObjectProperty(uva:teaches))ObjectPropertyDomain(uva:teaches uva:AssociateProfessor)ObjectPropertyRange(uva2:teaches uva:Course)

Declaration(Individual(courses:ks2009))Declaration(Individual(radboud))ObjectPropertyAssertion(uva:teaches radboud courses:ks2009)DataPropertyAssertion(uva:name radboud "Radboud Winkels")

Page 9: Ks2009 Semanticweb In Action

Integration

• How to add this ‘meta’ to my ‘data’?• Three options:

– Old fashioned HTML:<link rel='meta' type='application/rdf+xml' href='http://www.leibnizcenter.org/~hoekstra/foaf.rdf' title='FOAF'>

– HTTP 303 `see other’http://www.w3.org/TR/swbp-vocab-pub/

– Inline (RDFa/GRDDL)

04/10/2023 9

Page 10: Ks2009 Semanticweb In Action

Integration: 303 See Other (Demo)http://www.metalex.eu/metalex

04/10/2023 10

Page 11: Ks2009 Semanticweb In Action

Integration: Inline

• RDFa– Attributes on XHTML elements– http://www.w3.org/TR/xhtml-rdfa-primer

• GRDDL– Gleaning Resource Descriptions from Dialects of

Languages– Explicit reference to (XSL) transformation– http://www.w3.org/TR/grddl/

04/10/2023 11

Page 12: Ks2009 Semanticweb In Action

Integration: RDFa Example• In XHTML:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"><html xmlns:cal="http://www.w3.org/2002/12/cal/ical#"> <head><title>Jo's Friends and Family Blog</title></head> <body> <p instanceof="cal:Vevent"> I'm holding <span property="cal:summary">one last summer Barbecue</span>, on <span property="cal:dtstart" content="20070916T1600-0500"> September 16th at 4pm. </span> </p> </body></html>

• In RDF:_:blanknode0 rdf:type cal:Vevent; cal:summary ”one last summer Barbecue"; cal:dtstart "20070916T1600-0500" .

04/10/2023 12

Page 13: Ks2009 Semanticweb In Action

Integration: GRDDL• In HTML/XML instance documents:<html xmlns="http://www.w3.org/1999/xhtml" xmlns:grddl='http://www.w3.org/2003/g/data-view#' grddl:transformation="glean_title.xsl

http://www.w3.org/2001/sw/grddl-wg/td/getAuthor.xsl”>

• In XML Schema documents: <xsd:annotation> <xsd:appinfo> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<rdf:Description rdf:about="http://www.metalex.eu/latest"> <grddl:namespaceTransformation rdf:resource=”http://www.metalex.eu/grddl/metalex2owl.xsl" /></rdf:Description>

</rdf:RDF> </xsd:appinfo> </xsd:annotation>

04/10/2023 13

Page 14: Ks2009 Semanticweb In Action

Storage (on the web)

• As documents– .rdf, .n3, .turtle, .html

• RDF triple stores– Sesame, Joseki, 4Store, AllegroGraph, OpenLink

Virtuoso, SDB/TDB, Open Calais, SWI Prolog – Reasoners ‘on top’, or via DIG

• Pellet, OWLIM, etc.

• SPARQL Endpoints– Results as JSON, XML, CSV etc.

04/10/2023 14

Page 15: Ks2009 Semanticweb In Action

Querying

• Originally many languages– SPARQL, nRQL, SeRQL, etc.

• SPARQL: – http://www.w3.org/TR/rdf-sparql-query/

• ExamplePREFIX course: <http://www.uva.nl/courses#>PREFIX uva: <http://www.uva.nl/rdf#>SELECT ?nameWHERE { ?x uva:teaches course:ks2007. ?x uva:name ?name }

?x binds with <http://www.uva.nl/people#radboud> ?name binds with “Radboud Winkels”^^xsd:string

04/10/2023 15

Page 16: Ks2009 Semanticweb In Action

Querying (2)

• SPARQL 1.0– select, construct, from, optional, filter– Negation via unbound variable

• SPARQL 1.1– update, negation, aggregation, subqueries

04/10/2023 16

Page 17: Ks2009 Semanticweb In Action

THE WEB OF DATA… does it exist?

04/10/2023 17

Page 18: Ks2009 Semanticweb In Action

Linked Open Data

04/10/2023 18

Page 19: Ks2009 Semanticweb In Action

04/10/2023 19November 2009: 13.1 Billion triples, 142 Million links

Page 20: Ks2009 Semanticweb In Action

But there’s more

• Late additions…– New York Times archives

• Now 5k names, with 4 references to LOD• Will grow to > 30k

– Reuters– OpenCalais automated tagging

• Soon to come– Data.gov (via RPI)– Whitehouse.gov (via Drupal)– Data.gov.uk (directly)– European Parliament (MetaLex+RDFa)

04/10/2023 20

Page 21: Ks2009 Semanticweb In Action

Scalability

• How to deal with massive amounts of data?

• Consequences for reasoning– Billion Triple Challenge– (864.8 Million Triples)

• Consequences for querying– Table lookups, joins etc.

• … and what about …– Dealing with change, provenance, trust?

04/10/2023 21

Page 22: Ks2009 Semanticweb In Action

A rough idea…

• I can crash a DL reasoner using an ontology of ~15 classes and 5 individuals (honestly)

• What if my ontology contains thousands of classes and billions of individuals?

04/10/2023 22

Page 23: Ks2009 Semanticweb In Action

Reasoning• When?

– Realtime vs. in advance

• Lightweight reasoning (RDFS, OWL 2 RL)– Implementable using forward chaining rules– Still problems with scalability

• Distributed reasoning (DAS-3)– MaRVIN

• ‘SpeedDate’ distrubution of triples across nodes

– MapReduce• Full closure of BTC in 57 minutes• Output: 30B triples

• And what to do with the results?

04/10/2023 23

Page 24: Ks2009 Semanticweb In Action

2 Degrees from Kevin BaconPREFIX p: http://dbpedia.org/property/SELECT ?film1 ?actor1 ?film2 ?actor2WHERE {

?film1 p:starring <http://dbpedia.org/resource/Kevin_Bacon> . ?film1 p:starring ?actor1 . ?film2 p:starring ?actor1 . ?film2 p:starring ?actor2 .}

04/10/2023 24

DBPedia: 150M triples

Page 25: Ks2009 Semanticweb In Action

Rough idea…

• 1 Billion triples in MySQL– Load time

• … a couple of hours

– Simple table lookup (one-variable query)• … about 5 minutes

– Single join (two-variable query)• … a couple of hours

• Better indexes?– Harddisk access times are the bottleneck (9ms)

• More targeted reasoning, querying, federation.

04/10/2023 25

Page 26: Ks2009 Semanticweb In Action

LET’S SUPPOSE THAT ALL WORKSViewing the web of data

04/10/2023 26

Page 27: Ks2009 Semanticweb In Action

Browsing and Viewing

• How to unlock your RDF/OWL to users?– Custom applications (PizzaFinder)– Generic RDF Browsers (Faceted Browsing)

• How to present your RDF/OWL to users?– Custom applications (TopBraid Geo)– Generic RDF Visualisation (Fresnel Lenses)

04/10/2023 27

Page 28: Ks2009 Semanticweb In Action

Browsing: Facets• Multi-dimensional search• User filters available information• Context dependent• Facet

– UI element– Values of a property– Number of results

• Query building

04/10/2023 28

Page 29: Ks2009 Semanticweb In Action

Browsing• MIT Longwell

– http://simile.mit.edu/longwell/demo/libraries• /facet

– http://slashfacet.semanticweb.org• Flamenco• RDFBrowser• Exhibit

– http://simile.mit.edu/exhibit• LENA• OpenAcademia

– http://vu.openacademia.org

04/10/2023 29

Page 30: Ks2009 Semanticweb In Action

Viewing

• Tables are boring!• Different data? Different presentation:

– URI/URL– Images– Strings– Coordinates

• Filtering data• Aggregating data

04/10/2023 30

Page 31: Ks2009 Semanticweb In Action

Viewing: Fresnel

• RDF specification of– What data to present, and– How to present it

• http://www.w3.org/2005/04/fresnel-info

• Lenses– Group information

(class membership, SPARQL result)• Formats

– Specify how property values should be rendered04/10/2023 31

Page 32: Ks2009 Semanticweb In Action

Viewing: Fresnel lens:foafPersonDefaultLens rdf:type fresnel:Lens ; fresnel:purpose fresnel:defaultLens ; fresnel:classLensDomain foaf:Person ; fresnel:group :foafGroup ; fresnel:showProperties ( foaf:name foaf:surname foaf:depiction ) .

:knowsLens rdf:type fresnel:Lens ; fresnel:classLensDomain foaf:Person ; fresnel:group :foafGroup ; fresnel:showProperties ( foaf:name foaf:surname foaf:mbox [ rdf:type fresnel:PropertyDescription ; fresnel:property foaf:knows ; fresnel:sublens :foafPersonDefaultLens ] ) .

04/10/2023 32

Page 33: Ks2009 Semanticweb In Action

Viewing: Fresnel format:foafGroup rdf:type fresnel:Group ; fresnel:stylesheetLink <http://www.example.org/example.css> .

:depictFormat rdf:type fresnel:Format ; fresnel:propertyFormatDomain foaf:depiction ; fresnel:label fresnel:none ; fresnel:value fresnel:image ; fresnel:valueStyle "imageWithThickBorder"^^fresnel:styleClass ; fresnel:group :foafGroup .

:urlFormat rdf:type fresnel:Format ; fresnel:propertyFormatDomain foaf:homepage ; fresnel:propertyFormatDomain foaf:mbox ; fresnel:value fresnel:externalLink ; fresnel:labelStyle "basicLabel"^^fresnel:styleClass ; fresnel:valueStyle "basicUrl"^^fresnel:styleClass ; fresnel:group :foafGroup .

04/10/2023 33

Page 34: Ks2009 Semanticweb In Action

SOME DEMOS

04/10/2023 36

Page 35: Ks2009 Semanticweb In Action

OWL IN ACTION

04/10/2023 37

Page 36: Ks2009 Semanticweb In Action

OWL in Action

• What OWL can do…• Traditional

– Straightforward classification tasks• Extensions

– Explanation & Justification– Probabilistic Reasoning

• Advanced (Law)– Temporal reasoning (Klarman et al., 2008)– Legal reasoning (van de Ven et al., 2008)

04/10/2023 38

Page 37: Ks2009 Semanticweb In Action

Legal assessment• Case input

– Individual case description• Match

– Case is matched against a set of norms• Resolve conflicts

– Where multiple norms apply, the system determines whether and which norms have priority over others

• Final verdict

Page 38: Ks2009 Semanticweb In Action

University library regulationsNorms qualify a situation

1a) Students registered at this university are allowed to check out a book from this library

1b) Students registered at other universities are allowed to check out a book from this library provided that they are enrolled in at least one course given at this university.

1c) Students who have checked out more than five books are not allowed to check out another book.

Expected subsumption hierarchy:• Art1c ⊑ Art1a, Art1c ⊑ Art1b

AmyC {Amy :Student, book_1 :Library_Book, … , book_6 :Library_BookAmy checks_out book_1, … , Amy checks_out book_6}

Page 39: Ks2009 Semanticweb In Action

Norms in LKIF Core

Page 40: Ks2009 Semanticweb In Action

A Default Norm0) Default: Checking out books is disallowed.

Default_GC⊑ Generic_Case⊑ ∃disallowed_by.{defaultnorm}≡ ∃checks_out.Library_Book

Default_Norm

⊑ Prohibition ⊑ ∀disallows.Default_GC≡ {defaultnorm}

Page 41: Ks2009 Semanticweb In Action

Article 1a1a) Students registered at this university are allowed to

check out a book from this library.

Art1a_GC⊑ Generic_Case⊑ ∃allowed_by.art1a≡ Registered_Student ⊓

∃checks_out.Library_Book Art1a_Permission

⊑ Permission⊑ ∀allows.Art1a_GC≡ {art1a}

Page 42: Ks2009 Semanticweb In Action

Article 1c1c) Students who have checked out more than five books are not

allowed to check out another book.

Art1c_GC_F⊑ Generic_Case⊑ ∃disallowed_by.{art1c}≡ Registered_Student ⊓ ≥ 6 checks_out.Library_Book

Art1c_GC_P⊑ Generic_Case⊑ ∃allowed_by.{art1c}≡ Registered_Student ⊓

∃checks_out.Library_Book≤ 5 checks_out.Library_Book

Art1c_Prohibition ⊑ Prohibition⊑ ∀disallows.Art1c_GC_F ⊓ ∀allows.Art1c_GC_P ≡ {art1c}

Page 44: Ks2009 Semanticweb In Action

Resources

• http://www.w3.orgRDF(S), N3, OWL, SPARQL, RDFa, GRDDL, XML, XMLSchema, XSLT, CSS, XPath, fresnel...

• http://www.semanticweb.org/facet, other resources

• http://www.planetrdf.comAggregated RSS feed of the cool & famous

• NEW: OWL 2– http://www.w3.org/TR/owl-overview

04/10/2023 46