Semantic Web for the Working Ontologist Dean Allemang Jim Hendler SNU IDB laboratory
Semantic Web for the Working OntologistDean Allemang, Jim Hendler Working Ontology Contents 2 ■ Chapter 1 What is the Semantic Web? ■ Chapter 2 Semantic Modeling ■ Chapter 3 RDF-The Basis of the semantic Web ■ Chapter 4 Semantic Web Application Architecture ■ Chapter 5 RDF and Inferencing ■ Chapter 6 RDF Schema ■ Chapter 7 RDFS-Plus ■ Chapter 8 Using RDFS-Plus in the Wild ■ Chapter 9 Basic OWL ■ Chapter 10 Counting and Sets in OWL ■ Chapter 11 Using OWL in the Wild ■ Chapter 12 Good and Bad Modeling Practices ■ Chapter 13 OWL Levels and Logic
Semantic Web for the Working OntologistDean Allemang, Jim Hendler Chapter 4 Semantic Web Application Architecture ■ 1. RDF Parser/Serializer ■ 2. RDF Store 2.1 RDF Data Standards and Interoperability of RDF Stores 2.2 RDF Query Engines and SPARQL 2.3 Comparison to Relational Queries ■ 3. Application code ■ 4. Data Federation 3
Semantic Web for the Working OntologistDean Allemang, Jim Hendler Introduction (1/2) How RDF can represent data in a distributed way across the web To build some application that takes advantage of information distributed over the Web The components that make up a Semantic Web deployment & How they fit together ★ So far, modeling ★ In this chapter, 4
Semantic Web for the Working OntologistDean Allemang, Jim Hendler Introduction (2/2) Text in RDF formats Triples in the RDF data model RDF Parser RDF Serializer Application RDF Store (merge) Query Engine ■ RDF Parser/Serializer ■ RDF Store, RDF Query Engine, Application Database Retrieve information from an RDF store Analysis, User interaction, Archiving, … 5
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 1. RDF Parser/ Serializer How does an RDF-based system get started? Where do the triples come from? We can find *.rdf files. Are these files useful? 6
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ RDF Parser A program can read files with extension.rdf ■ RDF Serializer Triples could be serialized back out, either in the same text form or in other text form 7 1. RDF Parser/ Serializer RDF format RDF Triple RDF Parser RDF format RDF Triple RDF Serializer
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 1. RDF Parser/Serializer - Other Data Sources ■ Converter For many common data formats, It is easy to convert into RDF triples 8 ShakespeareKing Lear wrote SubjectPredicateObject lit:Shakespearelit:wrotelit:KingLear Database Converter Table Spreadsheet Triple
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ Scrapper Reads a source that was intended for human reading Produces from it an RDF representation of that data ■ Solvent Early scraper system 9 1. RDF Parser/Serializer - Other Data Sources HTML page Provide a way to describe the selected data Highlight all the items on the page Select an item on the webpage
Semantic Web for the Working OntologistDean Allemang, Jim Hendler RDF Parser/Serializer - Other Data Sources Allen Station 395 N. Allen Av. Pasadena Chinatown Station 901 N. Spring St. Los Angeles Parking coming in 2008 Del Mar Station 230 S. Raymond Av. Pasadena Park/Ride Lot Spaces Metro:item0 rdf:type metro:Metro; dc:title “Allen Station”; simile:address “395 N. Allen Av., Pasadena 91106”. Metro:item1 rdf:type metro:Metro; dc:title “Chinatown Station”; simile:address “901 N. Spring St., LosAngeles ”. Metro:item2 rdf:type metro:Metro; dc:title “Del Mar Station”; simile:address “230 S. Raymond Av., Pasadena ”. (etc.)
Semantic Web for the Working OntologistDean Allemang, Jim Hendler RDF Parser/Serializer - Other Data Sources ■ Microformat A standard vocabulary is developed for commonly used items on a webpage ■ GRDDL (Gleaning Resource Descriptions from Dialects of Languages) RDFa : use the attribute tags in HTML to embed information that can be parsed into RDF. Some webpage authors might be willing to put some structured information into their webpage to express its intended structure It provides a standard way to express a mapping from a microformat, or other structured markup, to RDF W3C
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 12 ■ Two advantages over scrapers and converters 1. RDF Parser/Serializer - Other Data Sources RDF Easier to harvest the RDF data from pages RDF 〓 Ensure that the interpretation of the information in the document matches the intended meaning of the document The sprit of the word semantic in the Semantic Web
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 2. RDF Store 13 ■ RDF data are kept in a system “RDF store” ■ RDF store includes as a fundamental capability the ability to merge two data sets together ■ The simplest relation implementation of a triple store is as a single table with three columns RDF Store (merge) Query Engine SubjectPredicateObject metro:item0rdf:typemetro:Metro metro:item0dc:title“Allen Station” metro:item0simile:address“395 N. Allen Av., Pasadena metro:item1rdf:typemetro:Metro metro:item1dc:title“Chinatown Station” metro:item1simile:address“901 N. Spring St., Los Angeles ……… This fits in a RDB representation, it can be accessed using SQL
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 2. RDF Store - RDF Data Standards and Interoperability of RDF Stores ■ RDF stores bear considerable similarity to relational stores Distinction of RDF stores ▶ Standardization of the RDF data model ▶ RDF/XML serialization syntax 14 Relational data stores These are based on the relational algebra There is NO standard serialization language RDF data model is shared by all of these products, all of them can import and export their data sets in the RDF/XML format : Result of Standardization
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 2. RDF Store - RDF Query Engines and SPARQLE ■ SPARQL W3C has undertaken the process of standardizing an RDF query language from the common features of query languages 15 England UK Stratford ShakespeareAnneHathaway NorthernIreland ChannelIsland Wales IsleOfMan Scotland KingLear TheTempest HenryV WintersTale Othello Hamlet MeasureForMeasure LovesLaboursLost AsYouLikeIt TwelfthNight partOf isIn livedIn married wrote
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 16 ■ The basic building block of a SPARQL query is the triple pattern Looks like a triple, but it can have variables in place of resources in any of the three positions ▶ Variables: indicated as sybols preceded by the “?” character ▶ ?w lit:wrote lit:KingLear. Lit:Shakespeare ?r lit:KingLear. Lit:Shakespeare lit:wrote ?p. 2. RDF Store - RDF Query Engines and SPARQLE
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ Graph pattern Specified as a set of triple patterns A list of triple patterns enclosed within brace Any variable that appears in two or more triple patterns must match the same resource in the graph 17 {?person bio:married ?s. ?person lit:wrote lit:KingLear.} {?person bio:livedIn ?place. ?place geo:isIn geo:England. ?person lit:wrote lit:KingLear.} ?s?person lit:KingLear lit:wrote bio:married ?place?person lit:KingLear lit:wrote bio:livedIn geo:England geo:isIn 2. RDF Store - RDF Query Engines and SPARQLE
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ SPARQL also includes a facility such as OR (UNION) Graph PatternSPARQL Result {?person bio:married ?s. ?person lit:wrote lit:KingLear.} No results {?person bio:livedIn ?place. ?place geo:isIn geo:England. ?person lit:wrote lit:KingLear.} ?person = Shakespeare ?place = Stratford Graph PatternSPARQL Result {{{?spouse1 bio:married ?spouse2} UNION {?spouse2 bio:married ?spouse1}} {?spouse1 lit:wrote lit:KingLear}} ?spouse1 = Shakespeare ?spouse2 = AnneHathaway RDF Store - RDF Query Engines and SPARQLE
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ SELECT form in SPARQL Can be thought of as converting a graph to a table ■ CONSTRUCT form Uses two graph patterns and produces a new graph built from the matches in the input graph Variable bindings in both graph patterns must match the same resources in the graph 19 CONSTRUCT {?s ?p ?o} WHERE {?r rdf:subject ?s. ?r rdf:predicate ?p. ?r rdf:object ?o. web:Wikipedia m:says ?r.} Construct the graph made up of all the statements that Wikipedia asserts. 2. RDF Store - RDF Query Engines and SPARQLE
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ RDF query engine is intimately tied to the RDF store To solve a query, the engine relies on the indices and internal representations of the RDF store ■ An information source other than a triple store can be queried in SPARQL Some procedural code is generally used Makes it possible for data resources in formats other than RDF to provide information to the Semantic Web RDF Store - RDF Query Engines and SPARQLE
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ Comparison to relational queries ■ Oracle provides its own RDF-based graph query language extension to its version of SQL, optimized for graph queries 21 Relational queriesRDF queries Based on the relational algebra of joins and foreign key Look more like statements in predicate calculus Unification variables are used to express constraints between the patterns Describes a new data table that is formed by combining two or more source tables Describe a new graph that is formed by describing a subset of a source RDF graph 2. RDF Store - Comparison to Relational Queries
Semantic Web for the Working OntologistDean Allemang, Jim Hendler ■ Database application include some application code performs some analysis on or displays some information from the DB ■ RDF application has a similar architecture Includes the RDF parser/serializer, scrapers, converters, RDF merge functionality, RDF query engine Application RDF Files Analytics Interface … Converters and Scrapers Parser and Serializer RDF Store (merge) Query Engine 22 Application Analytics Interface … DB Query Engine DB Application Architecture 3. Application code
Semantic Web for the Working OntologistDean Allemang, Jim Hendler 4. Data federation ■ The RDF data model was designed with data federation Converts information from multiple sources into a single format and then combines all the information into a single store 23 Application RDF Files Analytics Interface … Converters and Scrapers Parser and Serializer RDF Store (merge) Query Engine Triple SubjectPredicateObject lit:Shakespearelit:wrotelit:KingLear Database Table