Programming the Semantic Web with Java. Taylor Cowan Travelocity 8982



Similar documents
Semantic Modeling with RDF. DBTech ExtWorkshop on Database Modeling and Semantic Modeling Lili Aunimo

13 RDFS and SPARQL. Internet Technology. MSc in Communication Sciences Program in Technologies for Human Communication.

Semantic Interoperability

Performance Analysis, Data Sharing, Tools Integration: New Approach based on Ontology

RDF Resource Description Framework

Grids, Logs, and the Resource Description Framework

Introduction to Ontologies

A Semantic web approach for e-learning platforms

Developing Web 3.0. Nova Spivak & Lew Tucker Tim Boudreau

Federated Data Management and Query Optimization for Linked Open Data

Scalable and Reactive Programming for Semantic Web Developers

12 The Semantic Web and RDF

Best practices for Linked Data

We have big data, but we need big knowledge

Extending the Linked Data API with RDFa

Lecture 2: Storing and querying RDF data

SPARQL UniProt.RDF. Get these slides! Tutorial plan. Everyone has had some introduction slash knowledge of RDF.

Proceedings of the SPDECE Ninth nultidisciplinary symposium on the design and evaluation of digital content for education

SPARQL By Example: The Cheat Sheet

Taming Big Data Variety with Semantic Graph Databases. Evren Sirin CTO Complexible

Publishing Linked Data Requires More than Just Using a Tool

RDF Support in Oracle Oracle USA Inc.

New Generation of Social Networks Based on Semantic Web Technologies: the Importance of Social Data Portability

Logic and Reasoning in the Semantic Web (part I RDF/RDFS)

Semantic Web Tool Landscape

RDF y SPARQL: Dos componentes básicos para la Web de datos

How to Publish Linked Data on the Web

LINKED DATA EXPERIENCE AT MACMILLAN Building discovery services for scientific and scholarly content on top of a semantic data model

Publishing Relational Databases as Linked Data

Semantic Stored Procedures Programming Environment and performance analysis

Getting Started Guide

Analyzing Linked Data tools for SHARK

TopBraid Application Development Quickstart Guide. Version 3.3

Towards the Integration of a Research Group Website into the Web of Data

Drupal.

Chapter 2 AN INTRODUCTION TO THE OWL WEB ONTOLOGY LANGUAGE 1. INTRODUCTION. Jeff Heflin Lehigh University

OWL: Path to Massive Deployment. Dean Allemang Chief Scien0st, TopQuadrant Inc.

Application of OASIS Integrated Collaboration Object Model (ICOM) with Oracle Database 11g Semantic Technologies

A collaborative platform for knowledge management

ARC: appmosphere RDF Classes for PHP Developers

Network Graph Databases, RDF, SPARQL, and SNA

Design and Implementation of a Semantic Web Solution for Real-time Reservoir Management

DISTRIBUTED RDF QUERY PROCESSING AND REASONING FOR BIG DATA / LINKED DATA. A THESIS IN Computer Science

Practical Semantic Web and Linked Data Applications

How To Use An Orgode Database With A Graph Graph (Robert Kramer)

How To Create A Federation Of A Federation In A Microsoft Microsoft System (R)

Big Data, Fast Data, Complex Data. Jans Aasman Franz Inc

DISCOVERING RESUME INFORMATION USING LINKED DATA

Deep Integration of Python with Semantic Web Technologies

The Ontology and Architecture for an Academic Social Network

excellent graph matching capabilities with global graph analytic operations, via an interface that researchers can use to plug in their own

OSLC Primer Learning the concepts of OSLC

Open Data Integration Using SPARQL and SPIN

Programming the Semantic Web

Graph Database Performance: An Oracle Perspective

LinkZoo: A linked data platform for collaborative management of heterogeneous resources

ELIS Multimedia Lab. Linked Open Data. Sam Coppens MMLab IBBT - UGent

Storage and Retrieval of Large RDF Graph Using Hadoop and MapReduce

Andreas Harth, Katja Hose, Ralf Schenkel (eds.) Linked Data Management: Principles and Techniques

High Performance Descriptive Semantic Analysis of Semantic Graph Databases

Server based signature service. Overview

The use of Semantic Web Technologies in Spatial Decision Support Systems

Ontology-Based Discovery of Workflow Activity Patterns

Ampersand and the Semantic Web

Benchmarking the Performance of Storage Systems that expose SPARQL Endpoints

Comparison of Triple Stores

- a Humanities Asset Management System. Georg Vogeler & Martina Semlak

Managing enterprise applications as dynamic resources in corporate semantic webs an application scenario for semantic web services.

Exposing Domain Models as Linked Data

Transcription:

Programming the Semantic Web with Java Taylor Cowan Travelocity 8982

AGENDA 2 > Semant ic Web Introduct ion > RDF basics > Coding Towards Jena s Semantic Web Framework API > Java to Model Binding with JenaBean > Open Source tools for Java Developers

State of the Semantic Web 3 > Consumers Search Monkey (Yahoo) Rich Snippets (Google) > Producers UK Civil Service (http:/ / www.civilservice.gov.uk) BackstageBBC Geonames.org DBPedia FreeBase New York Times

4

5

Why Not Microformats? <xsl:choose> <xsl:when test="(false() = not((.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalize-space(@class),' '),' fn ') and (local-name() = 'img' or local-name() = 'area')]/@alt) and (string-length(normalize-space(.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalize-space(@class),' '),' fn ') and (local-name() = 'img' or local-name() = 'area')]/@alt)) = string-length(translate(normalize-space(.//*[not(ancestor-orself::*[local-name() = 'del']) = true() and contains(concat(' ',normalize-space(@class),' '),' fn ') and (local-name() = 'img' or local-name() = 'area')]/@alt),' ',''))))) or (false() = not((.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalizespace(@class),' '),' fn ') and (local-name() = 'abbr')]/@title) and (string-length(normalizespace(.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalizespace(@class),' '),' fn ') and (local-name() = 'abbr')]/@title)) = string-length(translate(normalizespace(.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalizespace(@class),' '),' fn ') and (local-name() = 'abbr')]/@title),' ',''))))) or (false() = not((.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalizespace(@class),' '),' fn ') and not(local-name() = 'abbr' or local-name() = 'img')]) and (stringlength(normalize-space(.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalize-space(@class),' '),' fn ') and not(local-name() = 'abbr' or localname() = 'img' or local-name() = 'area')][1])) = string-length(translate(normalizespace(.//*[not(ancestor-or-self::*[local-name() = 'del']) = true() and contains(concat(' ',normalizespace(@class),' '),' fn ') and not(local-name() = 'abbr' or local-name() = 'img')][1]),' ','')))))"> 6 http://suda.co.uk/projects/microformats/hcard/xhtml2vcard.xsl

Semantic Web Basics 7 > Everything is identified by a URI > All data as canonical RDF > RDFS provides a schema > OWL provides additional meaning > SPARQL queries semantic web data > RDFa encodes RDF within XHTML > We share vocabularies when possible (FOAF, SIOC, SKOS) Web content that is meaningful to computers

RDF Triple Store VS Relational DB 8 Triples 1. Data Oriented 2. Semi- structured 3. Add, Remove 4. Everything is indexed 5. All relationships are many to many RDBMS 1. Schema Oriented 2. All data must fit schema 3. Insert, Update, Delete 4. Explicit indexing 5. Best with many to one

Combining Datasets with OWL 9 owl:sameas

Combining Datasets 10 owl:sameas

RDF!= XML 11 The site at http:/ / www.travelocity.com, also known as Travelocity, is an online travel agency competing with expedia.com

Concepts as a Directed Graph 12

Concepts Serialized as N3 13 :OnlineTravelAgency a owl:class. :hascompetitor a rdf:property. <http://www.travelocity.com> a :OnlineTravelAgency ; rdfs:label "Travelocity"@en ; :hascompetitor <http://www.expedia.com>.

< / OnlineTravelAgency> Concepts Serialized as RDF/ XML 14 < rdf:rdf > < owl:class rdf:about= "http:/ / foo#onlinetravelagency"/ > < rdf:property rdf:about= "http:/ / foo#hascompetitor"/ > < OnlineTravelAgency rdf:about= "http:/ / www.travelocity.com"> < hascompetitor rdf:resource= "http:/ / www.expedia.com"/ > < rdfs:label x ml:lang= "en"> Travelocity< / rdfs:label>

As N- Triples (Most Canonical or Normalized) 15 <hascompetitor> <rdf:type> <rdf:property>. <http://travelocity.com> <hascompetitor> <http://expedia.com>. <http://travelocity.com> <rdfslabel> "Travelocity"@en <http://travelocity.com> <rdf:type> <OnlineTravelAgency>. <OnlineTravelAgency> <rdf:type> <owl:class>. Subject, Verb, Object = a triple

As Java Code, using the Jena API 16 OntModel m = ModelFactory.createOntologyModel(); OntClass ota = m.createclass("onlinetravelagency"); Individual tvly = ota.createindividual("http://www.travelocity.com"); tvly.setlabel("travelocity", "en"); OntProperty p = m.createontproperty("hascompetitor"); tvly.setpropertyvalue(p, m.createresource("http://www.expedia.com"));

Creating a Model 17 1: Model m = ModelFactory.createDefaultModel(); 2: m.setnsprefix("foaf", FOAF.NS); 3: Resource jazoon = m.createresource("http://jazoon.com/"); 4: Resource java = m.createresource( 5: "http://dbpedia.org/resource/java_(software_platform)"); 6: jazoon.addproperty(foaf.primarytopic, java); 7: m.write(system.out, "N3"); <http://jazoon.com/> foaf:primarytopic <http://dbpedia.org/resource/java_(software_platform)>.

Assertion 18 foaf:primarytopic jazoon.co m java

Creating an Inferencing Model 19 OntModel infmodel = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM_MICRO_RULE_INF, m); infmodel.read("http://xmlns.com/foaf/spec/index.rdf"); infmodel.writeall(system.out, "N3",null); In addition to known data, a new triple is inferred <http://dbpedia.org/resource/java_(software_platform)> foaf:isprimarytopicof <http://jazoon.com/>

Knowledge after Inference 20 foaf:document Is a foaf:primarytopic jazoon.com java foaf:isprimarytopicof

The Semantic Web is Property focused 21 > Properties have Classes, not vice versa > Don t read the domain of foaf:knows is a foaf:person, but inst ead anyt hing wit h foaf:knows relat ionship is a foaf:person > Properties can ex tend other properties > Properties can be declared as inverse, symmetric, and transitive, all resulting in new inferences.

List All Classes from an Ontology 22 OntModel model = ModelFactory.createOntologyModel(); model.read("http://xmlns.com/foaf/spec/index.rdf"); ExtendedIterator<OntClass> it = model.listclasses(); while(it.hasnext()) { OntClass cls = it.next(); if (cls.getnamespace().equals(foaf.ns)) System.out.println(cls.getURI()); }

Models Can be Populated from URL, Either Public or Local 23

Models can be Populated from Other Models 24

Some example foaf: 25 <http://www.ibm.com/developerworks/xml/library/j-jena/> a dc:article ; dc:creator "Philip McCarthy"^^xsd:string ; dc:subject "jena, rdf, java, semantic web"^^xsd:string ; dc:title "Introduction to Jena"^^xsd:string.

Equivalent Raw Jena API Client Code 26 String NS = "http://purl.org/dc/elements/1.1/"; OntModel m = ModelFactory.createOntologyModel(); OntClass articlecls = m.createclass(ns +"Article"); Individual i = articlecls.createindividual( "http://www.ibm.com/developerworks/xml/library/j-jena/"); Property title = m.getproperty(ns + "title"); Literal l = m.createtypedliteral("introduction to Jena"); i.setpropertyvalue(title,l); Property creator = m.getproperty(ns + "creator"); l = m.createtypedliteral("philip McCarthy"); i.setpropertyvalue(creator,l); Property subject = m.getproperty(ns + "subject"); l = m.createtypedliteral("jena, rdf, java, semantic web"); i.setpropertyvalue(subject,l); m.write(system.out, "N3");

Pain Points of Raw Jena API Programming 27 > You need to create unique URI s for every entity. > You must specify the type of each primitive value. > Properties must be created for each bean property.

28 Creating The Same Assertions with JenaBean

The JenaBean Project 29 > Hosted at Google code > Bean binding, not code generation > Doesn t use byte code int erweaving > Doesn t require implementing an interface > http:/ / jenabean.googlecode.com

Programming with JenaBean is Simple 30 > Bean2RDF writes object s > RDF2Bean reads object s > 3 Annotations @Id specifies unique field @Namespace provides a domain @RdfProperty maps java properties to RDF properties

The Simplest Possible Example 31 <http://examples.model/person> a <http://www.w3.org/2000/01/rdf-schema#class> ; <http://thewebsemantic.com/javaclass> "examples.model.person". <http://examples.model/person/thewebsemantic@gmail.com> a <http://examples.model/person> ; <http://examples.model/email> "thewebsemantic@gmail.com"^^xsd:string.

Saving an Instance of Person 32 Model m = ModelFactory.createOntologyModel(); Bean2RDF writer = new Bean2RDF(m); Person p = new Person(); p.setemail("person@example.com"); writer.save(p); m.write(system.out, "N3"); <http://example/person> a owl:class ; <http://thewebsemantic.com/javaclass> "example.person". <http://example/person/taylor_cowan@yahoo.com> a <http://example/person> ; <http://example/email> "taylor_cowan@yahoo.com"^^xsd:string.

Overriding the Default Namespace 33 <http://mydomain#person> a <http://www.w3.org/2000/01/rdf-schema#class> ; <http://thewebsemantic.com/javaclass> "examples.model.person". <http://mydomain#person/thewebsemantic@gmail.com> a <http://mydomain#person> ; <http://mydomain#email> "thewebsemantic@gmail.com"^^xsd:string.

Overriding the Default Property Bindings 34 <http://mydomain#person> a <http://www.w3.org/2000/01/rdf-schema#class> ; <http://thewebsemantic.com/javaclass> "examples.model.person". <http://mydomain#person/thewebsemantic@gmail.com> a <http://mydomain#person> ; <http://xmlns.com/foaf/0.1/name> "Taylor Cowan"^^xsd:string.

Extending Person to Support Friendship 35 public Collection<Person> friends = new LinkedList<Person>(); @RdfProperty("http://xmlns.com/foaf/0.1/knows") public Collection<Person> getfriends() { return friends;}

Loading Beans from a Model 36 RDF2Bean reader = new RDF2Bean(m); Person p = reader.load(person.class,"person@example.com"); Collection<Person> allpeople = reader.load(person.class);

Open Source Tools For Java Devs 37 > Java Triple Stores Jena (HP Labs) Sesame OpenRDF (Aduna) Mulgara > Java Binding tools JenaBean (Jena) Jastor (Jena) Owl2Java (Jena) Elmo (Sesame) cc nickjohnson http:/ / flickr.com/ photots/ npj/

Taylor Cowan http:/ / thewebsemantic.com http:/ / twitter.com/ tcowan Travelocity taylor.cowan@travelocity.com