Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 5 1COMP9321, 15s2, Week.

Similar presentations


Presentation on theme: "COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 5 1COMP9321, 15s2, Week."— Presentation transcript:

1 COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 5 1COMP9321, 15s2, Week 5 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411

2 Semantic Web 2COMP9321, 15s2, Week 5 standard technologies Web of Data It is a collection of standard technologies to realize a Web of Data! RDF, OWL, SPARQL, etc. DataDocuments Web of Data beyond the Web of Documents! Machine Readable Human Readable The amount of information is growing exponentially.

3 W3C's "Semantic Web Vision“ 3COMP9321, 15s2, Week 5 1.Web information has exact meaning! e.g. automatic airline reservation Knows about your preferences: builds up a knowledge-base using your past activities Combines the local knowledge with remote services: social networks airline preferences Hospital Information Systems dietary requirements Linkedin Jobs and Calendaring information …

4 W3C's "Semantic Web Vision“ 4COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers Provide a common way to describe information: so it can be read and understood by computer applications e.g. Describing : properties for publications, such as Author and Title information about web pages such as content, author, and creation date content and rating for web pictures content for search engines electronic libraries …

5 W3C's "Semantic Web Vision“ 5COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers Provide a common way to describe information: so it can be read and understood by computer applications e.g. Describing : properties for publications, such as Author and Title information about web pages such as content, author, and creation date content and rating for web pictures content for search engines electronic libraries …  Data should be available for machines for further processing: It is important as tasks often require to combine data on the Web: hotel and travel information may come from different sites searches in different digital libraries …  Information should easily be exchanged between different platforms.

6 W3C's "Semantic Web Vision“ 6COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers 3.Computers can integrate information from the web A. Map the various data onto an abstract data representation B. Merge the resulting representations C. Start making queries on the whole!  queries that could not have been done on the individual data sets

7 W3C's "Semantic Web Vision“ 7COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers 3.Computers can integrate information from the web A. Map the various data onto an abstract data representation B. Merge the resulting representations C. Start making queries on the whole!  queries that could not have been done on the individual data sets

8 3A. Map the various data onto an abstract data representation 8COMP9321, 15s2, Week 5 Example: A simplified bookstore data (dataset “A”) IDAuthor-idTitlePublisher-idYear ISBN-13: 978-0307455871 id-BHOThe Audacity of Hope id-1954 2008 IDAuthor-NameHome Page id-BHOBarack Obamahttps://www.barackobama.com/ IDPub-NameHeadquarter Location id-1954Vintage BooksNew York

9 3A. Map the various data onto an abstract data representation 9COMP9321, 15s2, Week 5 Example: A simplified bookstore data (dataset “A”) ISBN-13: 978- 0307455871 The Audacity of Hope 2008 A:Title A:Year Vintage Books New York Barack Obama https://www.barackobama.com/ A:Pub-Name A:hq-Location A:Publisher A: Author A: Author-Name A: Homepage

10 3A. Map the various data onto an abstract data representation 10COMP9321, 15s2, Week 5 Example: A simplified Knowledge Base (dataset “B”) A knowledge base (KB) typically consists of a set of concepts organized into a taxonomy, instances for each concept, and relationships among the concepts. Examples: Freebase, DBpedia, YAGO, Wikidata ~ Chai, Xiaoyong, et al. "Social Media Analytics: The Kosmix Story." IEEE Data Eng. Bull. 36.3 (2013): 4-12.

11 3A. Map the various data onto an abstract data representation 11COMP9321, 15s2, Week 5 Example: A simplified Knowledge Base (dataset “B”) Barak Obama Hawaii 1961-08-04 B: BirthPlace B: BirthDate B: Spouse Michelle Obama Lawyer B: Name B: Profession Harvard Law School B: GraduateFrom

12 3A. Map the various data onto an abstract data representation 12COMP9321, 15s2, Week 5 Example: A simplified Knowledge Base (dataset “B”) same-as

13 W3C's "Semantic Web Vision“ 13COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers 3.Computers can integrate information from the web A. Map the various data onto an abstract data representation B. Merge the resulting representations C. Start making queries on the whole!  queries that could not have been done on the individual data sets

14 3B. Merge the resulting representations 14COMP9321, 15s2, Week 5 Example: A simplified Knowledge Base (dataset “B”) A: Author A: Author-Name A: Homepage

15 W3C's "Semantic Web Vision“ 15COMP9321, 15s2, Week 5 1.Web information has exact meaning 2.Web information can be understood and processed by computers 3.Computers can integrate information from the web A. Map the various data onto an abstract data representation B. Merge the resulting representations C. Start making queries on the whole!  queries that could not have been done on the individual data sets

16 3C. Start making queries on the whole! 16COMP9321, 15s2, Week 5 Queries that could not have been done on the individual data sets : Give me list of the books whose : author was born in Hawaii. author was born in 1961. author is married. author’s spouse was graduated from Harvard … More? We could add extra knowledge to the merged datasets, e.g.:  Full classification of various types of library data;  Geographical information, maps;  Images;  Social Media Accounts;  …

17 3C. Start making queries on the whole! 17COMP9321, 15s2, Week 5 Queries that could not have been done on the individual data sets : Give me list of the books whose : author was born in Hawaii. author was born in 1961. author is married. author’s spouse was graduated from Harvard … More? We could add extra knowledge to the merged datasets, e.g.:  Full classification of various types of library data;  Geographical information, maps;  Images;  Social Media Accounts;  … Even more powerful queries can be asked as a result

18 Semantic Web 18COMP9321, 15s2, Week 5 standard technologies Web of Data It is a collection of standard technologies to realize a Web of Data! RDF RDF, OWL, SPARQL, etc.

19 Resource Description Framework (RDF) 19COMP9321, 15s2, Week 5 resources RDF is a framework for describing resources on the web. Publishing such descriptions on the Web creates the Semantic Web. URI RDF uses Web identifiers (URIs) to identify resources. Web documents concepts from the real world (e.g. people, organisations, topics, things) e.g. URIs (Uniform Resource Identifiers) are very important, providing both the core of the framework itself and the link between RDF and the Web.

20 Resource Description Framework (RDF) 20COMP9321, 15s2, Week 5 On the Semantic Web, URIs identify not just Web documents, but also real-world objects like people and cars. Example (Web Documents): The company “Example Inc.” has a Web site at http://www.example.com/. Part of the site is a white-pages service listing the names and contact details of the employees. Alice and Bob both work at Example Inc. The structure of the Web site might thus be: http://www.w3.org/TR/2008/NOTE-cooluris-20081203/ each of the pages mentioned above are Web documents.

21 Resource Description Framework (RDF) 21COMP9321, 15s2, Week 5 On the Semantic Web, URIs identify not just Web documents, but also real-world objects like people and cars. Example (objects): The company “Example Inc.” wants to publish contact data of their employees on the Semantic Web. Business partners can import this data into their address books. http://www.w3.org/TR/2008/NOTE-cooluris-20081203/ FOAF (an acronym of Friend of a friend) is a machine-readable ontology describing persons, their activities and their relations to other people and objects. Hash URIs 303 URIs

22 RDF Resource, Property, and Property Value 22COMP9321, 15s2, Week 5 Resource: anything that can have a URI e.g. http://www.Vintage.com/isbn13/978-0307455871 Property: a Resource that has a name, such as “author”… Property Value: the value of a Property, such as “Barack Obama" a property value can be another resource Barack Obama https://www.barackobama.com/

23 RDF Resource, Property, and Property Value 23COMP9321, 15s2, Week 5 The combination of a Resource, a Property, and a Property value forms a Statement. known as the subject, predicate and object Example: Statement: The author of “http://www.Vintage.com/isbn13/978-0307455871” is Barack Obama. Subject: http://www.Vintage.com/isbn13/978-0307455871 Predicate: author Object: Barack Obama Subject Predicate Object

24 RDF (DBLP Example) 24COMP9321, 15s2, Week 5 <rdf:RDF xmlns:dblp="http://dblp.uni-trier.de/rdf/schema-2015-01-26#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> Web Services - Concepts, Architectures and Applications Data-Centric Systems and Applications 2004 Springer 978-3-540-44008-6

25 RDF (DBLP Example) 25COMP9321, 15s2, Week 5 <rdf:RDF xmlns:dblp="http://dblp.uni-trier.de/rdf/schema-2015-01-26#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> Web Services - Concepts, Architectures and Applications Data-Centric Systems and Applications 2004 Springer 978-3-540-44008-6 The xmlns:rdf namespace, specifies that elements with the rdf prefix are from the namespace http://www.w3.org/1999/02/22-rdf-syntax-ns# The xmlns:dblp namespace, specifies that elements with the cd prefix are from the namespace http://dblp.uni-trier.de/rdf/schema-2015-01-26# The element contains the description of the resource identified by the rdf:about attribute. Other elements are the properties of the resource. The xmlns:rdf namespace, specifies that elements with the rdf prefix are from the namespace http://www.w3.org/1999/02/22-rdf-syntax-ns# The xmlns:dblp namespace, specifies that elements with the cd prefix are from the namespace http://dblp.uni-trier.de/rdf/schema-2015-01-26# The element contains the description of the resource identified by the rdf:about attribute. Other elements are the properties of the resource.

26 RDF (DBLP Example) 26COMP9321, 15s2, Week 5 <rdf:RDF xmlns:dblp="http://dblp.uni-trier.de/rdf/schema-2015-01-26#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> Web Services - Concepts, Architectures and Applications Data-Centric Systems and Applications 2004 Springer 978-3-540-44008-6 Properties as Attributes Properties as Resources

27 RDF Schema (RDFS) 27COMP9321, 15s2, Week 5 RDF Schema provides a data-modelling vocabulary for RDF data. RDF Schema is an extension of the basic RDF vocabulary. RDF Schema provides the framework to describe application-specific classes and properties. Classes in RDF Schema are much like classes in object oriented programming languages. “classes” are also resources, but… they are also a collection of possible resources

28 RDF Schema (RDFS) 28COMP9321, 15s2, Week 5 RDF Schema provides a data-modelling vocabulary for RDF data. RDF Schema is an extension of the basic RDF vocabulary. RDF Schema provides the framework to describe application-specific classes and properties. Classes in RDF Schema are much like classes in object oriented programming languages. “classes” are also resources, but… they are also a collection of possible resources Dublin Core Metadata Initiative (DCMI) is an open organization supporting innovation in metadata design and best practices across the metadata ecology. DCMI has created some predefined properties for describing documents. http://dublincore.org/

29 Web Ontology Language (OWL) 29COMP9321, 15s2, Week 5 Ontology is about the exact description of things (web information) and their relationships. OWL was designed to provide a common way to process the content of web information OWL and RDF are much of the same thing, but OWL is a stronger language with greater machine interpretability than RDF. OWL provides additional vocabulary along with a formal semantics OWL making it easier for machines to automatically process and integrate information available on the Web. OWL has three sublanguages OWL Lite OWL DL OWL Full OWL is complex: OWL is a large set of additional terms http://www.w3.org/TR/owl-features/

30 OWL: OWL: Term equivalences 30COMP9321, 15s2, Week 5 For classes: owl:equivalentClass: two classes have the same individuals owl:disjointWith: no individuals in common For properties: owl:equivalentProperty owl:propertyDisjointWith For individuals: owl:sameAs: two URIs refer to the same concept (“individual”) owl:differentFrom: negation of owl:sameAs http://www.w3.org/TR/owl-features/

31 OWL: OWL: Term equivalences 31COMP9321, 15s2, Week 5 For classes: owl:equivalentClass: two classes have the same individuals owl:disjointWith: no individuals in common For properties: owl:equivalentProperty owl:propertyDisjointWith For individuals: owl:sameAs: two URIs refer to the same concept (“individual”) owl:differentFrom: negation of owl:sameAs http://www.w3.org/TR/owl-features/ Example: Connecting to French…

32 OWL: Ontology development 32COMP9321, 15s2, Week 5 The hard work is to create the ontologies requires a good knowledge of the area to be described OWL is just a tool to formalize ontologies large scale ontologies are often developed in a community process Ontologies should be shared and reused can be via the simple namespace mechanisms… …or via explicit import http://www.w3.org/TR/owl-features/

33 Ontologies Examples 33COMP9321, 15s2, Week 5 eClassOwl: eBusiness ontology for products and services, 75,000 classes and 5,500 properties National Cancer Institute’s ontology: about 58,000 classes Open Biomedical Ontologies Foundry: a collection of ontologies, including the Gene Ontology to describe gene and gene product attributes in any organism or protein sequence and annotation terminology and data (UniProt) BioPAX: for biological pathway data http://www.w3.org/TR/owl-features/

34 Rules Rule Interchange Format (RIF) 34COMP9321, 15s2, Week 5

35 Rules 35COMP9321, 15s2, Week 5 There is a long history of rule languages and rule-based systems eg: logic programming (Prolog), production rules Lots of small and large rule systems E.g. from mail filters to expert systems Why rules on the Semantic Web? There are conditions that ontologies (ie, OWL) cannot express a well known example is Horn rules: (P1 ∧ P2 ∧ …) → C http://www.w3.org/TR/rif-overview/

36 Rules 36COMP9321, 15s2, Week 5 Example a novel with over 500 pages and costing less than $5 is a cheap book. http://www.w3.org/TR/rif-overview/ If { ?x rdf:type p:Novel; p:page_number ?p; p:price rdf:value ?z ?p > "500"^^xsd:integer. ?z < "5.0"^^xsd:double. } then { ?x rdf:type p:CheapBook }

37 A new requirement: exchange of rules 37COMP9321, 15s2, Week 5 Applications may want to exchange their rules: e.g. negotiate eBusiness contracts across platforms e.g. describe privacy requirements and policies Rule Interchange Format (RIF): Goals: expresses the rules a bit like a rule language can be used to exchange rules among engines Challenges: Rule based systems can be very different different rule semantics A universal exchange format is not feasible http://www.w3.org/TR/rif-overview/

38 A new requirement: exchange of rules 38COMP9321, 15s2, Week 5 Rule Interchange Format (RIF): The idea is to define “cores” for a family of languages with “variants” Introduction to the Semantic Web (tutorial), Ivan Herman, W3C

39 A new requirement: exchange of rules 39COMP9321, 15s2, Week 5 Rule Interchange Format (RIF): The idea is to define “cores” for a family of languages with “variants” Introduction to the Semantic Web (tutorial), Ivan Herman, W3C Possible dialects: F-logic, production rules, fuzzy or probabilistic logic, …

40 A new requirement: exchange of rules 40COMP9321, 15s2, Week 5 Rule Interchange Format (RIF): The idea is to define “cores” for a family of languages with “variants” Introduction to the Semantic Web (tutorial), Ivan Herman, W3C

41 Rules vs OWL? 41COMP9321, 15s2, Week 5 In a SW application, should I use RIF, OWL, or both? The two approaches are complimentary there are things that rules cannot really express or infer eg, inferencing complex relationships among classes there are things that ontologies cannot really express or in only a very complicated manner eg, complex Horn rules Often, applications require both Interesting paper: Paul Suganthan, G. C., et al. "Why Big Data Industrial Systems Need Rules and What We Can Do About It." (SIGMOD’2015). Introduction to the Semantic Web (tutorial), Ivan Herman, W3C

42 Linking Open Data (LOD) 42COMP9321, 15s2, Week 5

43 Linking Open Data (LOD) 43COMP9321, 15s2, Week 5 - Goal: “expose” open datasets in RDF - Set RDF links among the data items from different datasets - Set up query endpoints - Result: billions of triples and millions of links… - The important point here is that : the data becomes available to the World via a unified format (ie, RDF). the various datasets are interlinked together e.g. DBpedia project

44 Linking Open Data (LOD) 44COMP9321, 15s2, Week 5 http://linkeddata.org/

45 Linking Open Data (LOD) 45COMP9321, 15s2, Week 5 http://linkeddata.org/ Linked Data: … exposing, sharing, and connecting pieces of data, information, and knowledge on the Semantic Web using URIs and RDF

46 More? 46COMP9321, 15s2, Week 5 The Google Knowledge Graph is a system that Google launched in May 2012 that understands facts about people, places and things and how these entities are all connected. https://www.youtube.com/watch?v=mmQl6VGvX-c https://www.wikidata.org

47 Query RDF Data (SPARQL) 47COMP9321, 15s2, Week 5

48 Query RDF Data (SPARQL) 48COMP9321, 15s2, Week 5 RDF is a directed, labelled graph data format for representing information in the Web. http://www.justanswer.com/

49 Query RDF Data (SPARQL) 49COMP9321, 15s2, Week 5 SPARQL Protocol And RDF Query Language, is an RDF query language. This specification defines the syntax and semantics of the SPARQL query language for RDF. SPARQL can be used to express queries across diverse data sources. SPARQL contains capabilities for querying required and optional graph patterns The results of SPARQL queries can be results sets or RDF graphs. http://www.justanswer.com/

50 Query RDF Data (SPARQL) 50COMP9321, 15s2, Week 5 The (subject,?p,?o) is a pattern for what we are looking for with ?p and ?o as “unknowns” SELECT ?p ?o WHERE { subject ?p ?o } SELECT ?p ?o WHERE { subject ?p ?o } The triples in WHERE define the graph pattern The query returns all p,o pairs SPARQL query:

51 SPARQL: Simple Query 51COMP9321, 15s2, Week 5 Data : Query : Result : http://www.w3.org/TR/rdf-sparql-query/

52 SPARQL: Simple Query 52COMP9321, 15s2, Week 5 Data : Query : Result : http://www.w3.org/TR/rdf-sparql-query/ SPARQL is not based on XML Names beginning with a ? or a $ are variables. Graph patterns are given as a list of triple patterns enclosed within braces {} The variables named after the SELECT keyword are the variables that will be returned as results.

53 SPARQL: Multiple Matches 53COMP9321, 15s2, Week 5 Data : Query : Result : http://www.w3.org/TR/rdf-sparql-query/

54 SPARQL: SPARQL: Constraints 54COMP9321, 15s2, Week 5 Data : Query : Result : http://www.w3.org/TR/rdf-sparql-query/ SPARQL FILTER functions like regex can test RDF literals.

55 SPARQL: SPARQL: Constraints 55COMP9321, 15s2, Week 5 Data : Query : Result : http://www.w3.org/TR/rdf-sparql-query/ SPARQL FILTERs can restrict on arithmetic expressions.

56 SPARQL usage in practice SPARQL usage in practice 56COMP9321, 15s2, Week 5 SPARQL is usually used over the network separate documents define the protocol and the result format SPARQL Protocol for RDF with HTTP and SOAP bindings SPARQL results in XML or JSON formats Big datasets usually offer “SPARQL endpoints” using this protocol typical example: SPARQL endpoint to DBpedia

57 SPARQL usage in practice SPARQL usage in practice 57COMP9321, 15s2, Week 5 SPARQL is usually used over the network separate documents define the protocol and the result format SPARQL Protocol for RDF with HTTP and SOAP bindings SPARQL results in XML or JSON formats Big datasets usually offer “SPARQL endpoints” using this protocol typical example: SPARQL endpoint to DBpedia

58 Apache Jena 58COMP9321, 15s2, Week 5 A free and open source Java framework for building Semantic Web and Linked Data applications. The framework is composed of different APIs interacting together to process RDF data. http://www.ibm.com/developerworks/library/j-sparql/ https://jena.apache.org/

59 Apache Jena 59COMP9321, 15s2, Week 5 Main Java packages: oaj -> org.apache.jena

60 Apache Jena 60COMP9321, 15s2, Week 5 ARQ - A SPARQL Processor for Jena ARQ is a query engine for Jena that supports the SPARQL RDF Query language. ARQ - Application API The application API is in the package org.apache.jena.query Key Classes Query - a class that represents the application query. QueryExecution - represents one execution of a query. QueryExecutionFactory - a place to get QueryExecution instances. DatasetFactory - a place to make datasets.

61 Apache Jena 61COMP9321, 15s2, Week 5 SELECT queries: 1. A query is created from a string using the QueryFactory. 2. The query and model or RDF dataset to be queried are then passed to QueryExecutionFactory to produce an instance of a query execution. 3. QueryExecution objects are java.lang.AutoCloseable and can be used in try- resource. 4.Result are handled in a loop and finally the query execution is closed.

62 References 62COMP9321, 15s2, Week 5 http://www.w3.org/ Introduction to the Semantic Web (tutorial), Ivan Herman, W3C https://jena.apache.org/ http://www.ibm.com/developerworks/library/j-sparql/ http://www.w3schools.com/

63 63COMP9321, 15s2, Week 5


Download ppt "COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 5 1COMP9321, 15s2, Week."

Similar presentations


Ads by Google