architecture patterns for semantic web applications

61
NONOSQL Architecture Patterns for Semantic Web Applications Brian Panulla Penn State Web 2011 Conference

Upload: bpanulla

Post on 11-May-2015

1.626 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Architecture Patterns for Semantic Web Applications

NONOSQL Architecture Patterns for Semantic Web Applications

Brian Panulla

Penn State Web 2011 Conference

Page 2: Architecture Patterns for Semantic Web Applications

Twitter: @bpanulla

(c)2010 Google, Imagery (c)2010 TerraMetrics, NASA, Map data (c)2010 Europa Technologies, Google, INEGI, AND

Page 3: Architecture Patterns for Semantic Web Applications

Three things the Semantic Web is not(mostly)

Page 4: Architecture Patterns for Semantic Web Applications

1. Semantic HTML

Page 5: Architecture Patterns for Semantic Web Applications

2. Warmed-over AI

http://www.movieprop.com/tvandmovie/terminator/t3endoskeletons1.jpg

Page 6: Architecture Patterns for Semantic Web Applications

3. Magic

http://bostonist.com/attachments/Anna%20Edwards/109-gob-magic2.jpg

Page 7: Architecture Patterns for Semantic Web Applications

Who cares?

Page 8: Architecture Patterns for Semantic Web Applications

http://xkcd.com/773/

SemanticWeb

Page 9: Architecture Patterns for Semantic Web Applications

On NoSQL...

Page 10: Architecture Patterns for Semantic Web Applications
Page 11: Architecture Patterns for Semantic Web Applications

NoSQL: Key/Value and Graphs

Page 12: Architecture Patterns for Semantic Web Applications

On Linked Data...

Page 13: Architecture Patterns for Semantic Web Applications
Page 14: Architecture Patterns for Semantic Web Applications

When things go wrong

Page 15: Architecture Patterns for Semantic Web Applications

Linked Data - 2008

http://richard.cyganiak.de/2007/10/lod/

Page 16: Architecture Patterns for Semantic Web Applications

Linked Data - 2008

http://richard.cyganiak.de/2007/10/lod/ Last updated: 2010-09-22

Page 17: Architecture Patterns for Semantic Web Applications

Technology Primer

Page 18: Architecture Patterns for Semantic Web Applications

RDF: Framework for knowledge representation

Declares resources

Specifies properties of resources

W3C standard since 1999

http://www.w3.org/RDF/

Page 19: Architecture Patterns for Semantic Web Applications

What is a Resource?

Everything on the web (or not) is a resource.

Uniform

Resource

Locator

Page 20: Architecture Patterns for Semantic Web Applications

RDF is not XML

...but occasionally dresses up like it

XML N-Triples N3 Turtle JSON RDFa

in HTML ...

Page 21: Architecture Patterns for Semantic Web Applications

URIs

Resources are identified by a Uniform Resource Identifier (URI)

Can be found in your XHTML DTD and html tag’s xmlns attribute:

Page 22: Architecture Patterns for Semantic Web Applications

URIs

... Are not necessarily URLs

http://webconference.psu.edu

http://brian.panul.la

http://alumni.psu.edu/brian.panulla

Page 23: Architecture Patterns for Semantic Web Applications

Triples

RDF is expressed as triples of URIs: subject (“Penn State”) - resource predicate (”is a") - property object (”University”) - resource

PennState

University

Is a

Page 24: Architecture Patterns for Semantic Web Applications

Triples

Another example: subject (“Brian Panulla”) predicate (”presented at") object (”psuweb11”)

BrianPanulla psuweb11

presented At

Page 25: Architecture Patterns for Semantic Web Applications

Triples to Graphs

BrianPanulla

PSUWEB11

pres

ente

d At

PennState

University

Is aattended

PortlandState

Is a

Is in

Is located in

Held At

City ofPortland

Is inState ofOregon

UnitedStates ofAmerica

Is in

NorthAmerica

Is in

Canada

Mem

ber

of

Mem

ber

of

NATO

State ofWashington

Is in

borders

borders

State ofCalifornia

Is in

Page 26: Architecture Patterns for Semantic Web Applications

RDF Schemas

RDFS provides limited Set Theory features subClassOf subPropertyOf Domain Range

Think of classes in RDFS as sets rather than OOP classes

Page 27: Architecture Patterns for Semantic Web Applications

Ontologies

Ontology is the study of being or reality.

A Formal Ontology is a specification of a conceptualization (Gruber, 1995)

Aristotle

Page 28: Architecture Patterns for Semantic Web Applications

Defining an ontology

Web Ontology Language (OWL)

Version 2.0(October

2009)

http://www.w3.org/TR/owl2-overview/

Yes, rly.

Page 29: Architecture Patterns for Semantic Web Applications

Some RDFS/OWL Features Classes

Sub-class Equivalent Classes Disjoint Classes Cardinality

constraints (max/min)

Individuals Same Individual

Properties Sub-property Equivalent Inverse Symmetric Transitive

Page 30: Architecture Patterns for Semantic Web Applications

Protégéhttp://protege.stanford.edu/

Page 31: Architecture Patterns for Semantic Web Applications

Triple Stores

Graph database that knows RDF

Quad Stores: triple store that includes provenance

“where did the data come from?”

Various stores provide Transactional / non-Transactional In-Memory / File system / RDBMS storage

Page 32: Architecture Patterns for Semantic Web Applications

Popular Triple Stores

HP/Apache Jena Pellet Reasoner Storage▪ In memory▪ RDBMS (transactions)▪ Filesystem storage (high performance)

Open Source

Page 33: Architecture Patterns for Semantic Web Applications

Popular Triple Stores

Franz AllegroGraph (server)Virtuoso Universal Server (server)Mulgara (RESTful service, OSS)Redland (C, Obj-C)

New Stardog - Integrated reasoning database RDFa API -

https://github.com/webr3/rdf.js

Page 34: Architecture Patterns for Semantic Web Applications

Semantic Web Architecture

Page 35: Architecture Patterns for Semantic Web Applications

Del.icio.us

Page 36: Architecture Patterns for Semantic Web Applications

OMNOMino.us

Page 37: Architecture Patterns for Semantic Web Applications

Basic Requirements

Information People Bookmarks Tags

Functionality Create an account Add a bookmark Delete a bookmark Browse other users’

bookmarks

Page 38: Architecture Patterns for Semantic Web Applications

Logical Schema

Page 39: Architecture Patterns for Semantic Web Applications

Relational DB - Physical Schema

Page 40: Architecture Patterns for Semantic Web Applications

Modeling in RDF

Minimize artificial entitiesRe-use existing schemas or

ontologies

Page 41: Architecture Patterns for Semantic Web Applications

Useful Schemas

DUBLIN CORE METADATA INITIATIVE (DCMI)

FRIEND-OF-A-FRIEND(FOAF)

Page 42: Architecture Patterns for Semantic Web Applications

DMCI

Page 43: Architecture Patterns for Semantic Web Applications

FOAF

Well-defined ontology for people, organizations, and social networks

Page 44: Architecture Patterns for Semantic Web Applications

FOAF

Page 45: Architecture Patterns for Semantic Web Applications

RDF Data Model - Member foaf:Person

foaf:fullname foaf:nickname foaf:mbox

foaf:openid

Literal (“datataype”)properties

Resource (“object”)property

Page 46: Architecture Patterns for Semantic Web Applications

RDF Data Model - Bookmark foaf:Document

dct:title dct:description dct:created dct:modified

foaf:page foaf:topic

Literal (“datataype”)properties

Resource (“object”)properties

Page 47: Architecture Patterns for Semantic Web Applications

Topics from DBPedia

Semantified Wikipedia

Page 48: Architecture Patterns for Semantic Web Applications

Custom properties and classes

omnom:bookmarkedhttp://omnomino.us/ontology/

om.n3#bookmarked

foaf:Person

foaf:Document

omnom:bookmarked

Page 49: Architecture Patterns for Semantic Web Applications

Custom properties and classes

omnom:Member

foaf:Person

rdfs:subClassOf

omnom:Resource

foaf:Document

rdfs:subClassOf

Page 50: Architecture Patterns for Semantic Web Applications

RDF Data Model

Page 51: Architecture Patterns for Semantic Web Applications

SPARQL

Graph query languageRead-only (1.0)

Safe to expose endpoint to Web SPARQL 1.1 adds updates

Page 52: Architecture Patterns for Semantic Web Applications

A Simple SPARQL Example

SELECT ?subj ?pred ?objWHERE {

?subj ?pred ?obj.}

Demo

Page 53: Architecture Patterns for Semantic Web Applications

SPARQL Query Types

SELECT – Returns tuples matching specified pattern

ASK – yes or no (tests for existence)

CONSTRUCT – Returns a graph

DESCRIBE – Returns a graph determined by the query engine

Page 54: Architecture Patterns for Semantic Web Applications

SPARQL Examples: ASK

ASK {?uri foaf:openid <http://brian.panul.la>.

}

Page 55: Architecture Patterns for Semantic Web Applications

SPARQL Examples: Member

SELECT DISTINCT ?uri ?fullname ?nickname ?emailWHERE {

?uri a omnom:Member.OPTIONAL {

?uri foaf:name ?fullname; foaf:nick ?nickname; foaf:mbox ?email.}

FILTER (?uri = <http://omnomino.us/member/24601>)

Page 56: Architecture Patterns for Semantic Web Applications

SPARQL Example: Bookmarks

Page 57: Architecture Patterns for Semantic Web Applications

Updates via API

Page 58: Architecture Patterns for Semantic Web Applications

The Good:

Domains where schemas/models change rapidly or data is sparse

Semantics of relational model inadequate (e.g. inferencing, inheritance)

Domains emphasizing relationships Social networks Taxonomies

Page 59: Architecture Patterns for Semantic Web Applications

The Bad:

WEAKNESSES

Bad for opaque objects with few relationshps

Large sets of homogenous objects

ALTERNATIVES

RDBMS NoSQL

Document DBs Key/Value Stores Graph databases

Page 60: Architecture Patterns for Semantic Web Applications

Linked Data

Publish/Syndicate complete information sets

Embedded explicit semantics, unique identifiers

Have minimal impact to other Web information publishing

May be static or dynamically generated

Page 61: Architecture Patterns for Semantic Web Applications

Resources

Semantic Web Programming - John Hebeler, Matthew Fisher, Ryan Blace, and Andrew Perez-Lopez

Semantic Web for the Working Ontologist: Effective Modeling in RDFS and OWL -Dean Allemang and James Hendler

Programming the Semantic Web by Toby Segaran, Colin Evans, and Jamie Taylor