980e4b0e42dc740d9966c11f550df5b8.ppt
- Количество слайдов: 73
Applying Semantic Web Technologies to Web Services Vadim Eisenberg December 2008 Seminar in Databases (236826)
Outline Ø Introduction l l Semantic Web Services Ø Applying Semantic Web technologies to Web Services l l 2 “Composing Web Services on the Semantic Web”, B. Medjahed et. al. , VLDB Journal 2003 “Software Framework for Matchmaking Based on Semantic Web Technology”, L. Li et. al. , International Journal of Electronic Commerce 2004
SEMANTIC WEB 3
Semantic Web Ø Today, the data on the Web is “understandable” only by humans l or custom-developed software applications Ø The vision behind the Semantic Web is that the data on the Web should be processed and “understood” by computers l 4 “. . . the day-to-day mechanisms of trade, bureaucracy and our daily lives will be handled by machines talking to machines. ” Tim Berners-Lee, 1999
Example - Analyzing Financial Data on the Web Ø The need: a software application, which will analyze data about financial products from different investment companies Ø For example, data about ETFs l 5 ETF (Exchange-Traded Fund) is a low-cost investment scheme , which holds assets as stocks or bonds. Usually tracks indices.
Example: the Setting Ø Several Israeli investment companies provide ETF products Ø The differences l l l 6 the tracked index/indices the management fee the dividend distribution policy the base currency (NIS or other) the ranking of the product
Example: the Goal Ø Our application must find the most suitable ETF l l 7 more ambitious goal would be enabling this application to buy ETFs such software applications, which act on behalf of the user are called software agents
Example: the Data on the Web 8
The Data 9
The data: the Problems Ø The data is poorly structured l l html binary formats - pdf Ø The content and the layout are mixed Ø There is no common structure for different the investment companies Ø Different terminology for the same entities 10
The Problems Ø Writing an ETF analyzing application is a hard and tedious task l l l Custom parsers for every page must be written The parsers will be broken once the pages change The need for developing custom rules and taxonomy regarding the ETFs • modeling information about stocks, bonds, currencies, states etc. • custom reasoning rules/query engines must be developed for the application 11
A Step to a More Computer. Friendly Web: XML Ø A universal format for structured data XML l easy for parsing • • l easy for automatic validation • • l XML schema, DTD the tools automatically validate the data easy for querying • 12 strict rules a tree representation several query languages exist - XPath, XQuery
A Step to a More Computer. Friendly Web: XML l easy for transformations to other formats • l plenty of free tools/software packages/APIs for all the above exist • • 13 XSLT APIs for Programming Languages : JAXP of Java, XLINQ of C# easy application development
XML Examples <ETF> <Title> Kesem Nikkei </Title> <Base. Index> Nikkei 225 </Base. Index> <Base. Currency> NIS </Base. Currency> <Security. Number> 1099464</Security. Number> <Dividend. Distribution. Policy> coefficient T = 2. 2% added to the value of the ETF </ Dividend. Distribution. Policy > <Anual. Management. Fee> 0% </Anual. Management. Fee> </ETF> <ETF Security. Number=“ 1095736” > <Title> Tachlit Nikkei </Title> <Tracked. Index> Nikkei 225 </Base. Index> <Base. Currency> NIS </Base. Currency> <Dividend. Policy units=“%” > 100 </Dividend. Policy> <Management. Fee period=“year” units=“%” > 0. 65 </Management. Fee> </ETF> 14
XML + XSLT: Separation of Content from Layout Ø XML documents can store an information about how to display them - references to XSL stylesheets l l this enables separation of data proper from the way to display data the XML data can be processed conveniently machines • and by humans l 15 the XML data can be displayed to humans in a convenient way using XSL stylesheets
Example of XSLT: the Stylesheet <? xml version="1. 0" encoding="ISO-8859 -1"? > <xsl: stylesheet version="1. 0" xmlns: xsl="http: //www. w 3. org/1999/XSL/Transform"> <xsl: template match="ETF"> <html> <head><title><xsl: value-of select="Title"/></title></head> <body> <TABLE> <TBODY> <TR> <TD>Security Name: <SPAN STYLE="color: blue"><b><xsl: value-of select="Title"/></b></SPAN></TD></TR> <TD>Based on Index: <SPAN STYLE="color: red"><b><xsl: value-of select="Base. Index"/></b></SPAN></TD></TR> <TD>Security Number: <SPAN STYLE="color: blue"><b><xsl: value-of select="Security. Number"/></b></SPAN></TD></TR> <TD>Dividend Distribution Policy: <SPAN STYLE="color: blue"><i><xsl: value-of select="Dividend. Distribution. Policy"/></i></SPAN></TD></TR> <TD>Anual Management Fee: <SPAN STYLE="color: blue"><b><i><xsl: value-of select="Anual. Management. Fee"/></i></b></SPAN></TD></TR> </TBODY></TABLE> </body> </html> </xsl: template> </xsl: stylesheet> 16
Example of XSLT: the produced html 17
XML + XSL Web Browser with XSLT support Web. Site XML 18 XSL stylesheet
XML Representation - the Problems Lack of common unique terms Ø Lack of common structure (e. g. attributes vs. elements) Ø Lack of semantics Ø l 19 it is not clear from the document that ETF is a kind of security, as trust funds, stocks and bonds
The Next Step to a More Computer-Friendly Web: RDF Ø Adding semantics to documents: l RDF - Resource Description Framework • Resource is anything that has URI • URI - Uniform Resource Identifier Ø Unique terms - using URIs. l For example: http: //www. isa. gov. il/ETF#Base. Currency http: //www. isa. gov. il/ETF#Management. Fee http: //www. isa. gov. il/Securities#Security. Number not necessarily related to Web pages ! 20
RDF Ø RDF Data Model is based on triples : (subject, predicate, object) Ø subjects and predicates must be URIs Ø object can also be URI 21
RDF Examples ( http: //www. xnes. co. il/ETF#Kesem. Nikkei, http: //ww. isa. gov. il/Securities#Security. Numb er, 1099464) ( http: //www. xnes. co. il/ETF#Kesem. Nikkei, http: //www. isa. gov. il/ETF#Management. Fee, 0) ( http: //www. xnes. co. il/ETF#Kesem. Nikkei, http: //www. isa. gov. il/ETF#Base. Currency, http: //www. currencies. com/NIS) 22
RDF Formats Ø RDF could be represented in XML Ø XML is not the only 23 format ! format
RDF/XML Example < rdf: RDF xmlns: rdf=“http: //www. w 3. org/1999/02/22 -rdf-syntax -ns#“ xmlns=“http: //www. xnes. co. il/ETF” xmlns: isa=“http: //www. isa. gov. il/ETF” xmlns: cur=“http: //www. currencies. com”> <rdf: Description rdf: about=“Kesem. Nikkei”> <isa: Security. Number> 1099464</isa: Security. Number> <isa: Management. Fee> 0 </isa: Management. Fee> <isa: Base. Currency rdf: resourse=“&cur; NIS” /> </rdf: Description> 24
Integrating RDF with the Current Web Ø Embedding metadata in HTML l l Ø 25 Embedding RDF directly (RDFa) Embedding metadata (Microformats) which could be transformed to RDF (GRDDL) Publishing RDF + XSL
Publishing HTML with RDF embedded Web Browser with XSLT support Web. Site HTML 26
Embedding RDF in HTML <html> <head><title>Kesem Nikkei</title></head> <body> <div xmlns: isa="http: //www. isa. gov. il/ETF" xmlns: cur="http: //www. currencies. com" about="http: //www. xnes. co. il/ETF/Kesem. Nikkei"> <TABLE> <TBODY> <TR> <TD>Security Name: <SPAN STYLE="color: blue"><b>Kesem Nikkei</b></SPAN></TD></TR> <TD>Based on Index: <SPAN STYLE="color: red"><b>Nikkei 225</b></SPAN></TD></TR> <TD>Security Number: <SPAN STYLE="color: blue" ><b> <SPAN property="isa: Security. Number">1099464</SPAN></b></SPAN></TD></TR> <TD>Anual Management Fee: <SPAN STYLE="color: blue"><b><i> <SPAN property="isa: Management. Fee">0% </SPAN></i></b></SPAN></TD></TR> <TD>Based On Currency<SPAN STYLE="color: blue"><b><i> <SPAN property="isa: Currency"> NIS </SPAN></i></b></SPAN></TD></TR> </TBODY></TABLE> </div> </body> </html> 27
Publishing RDF + XSL Web Browser with XSLT support Web. Site RDF/ XML 28 XSL stylesheet
RDF: a Graph Representation isa: Base. Currency xnes: Kesem Nikkei cur: state cur: NIS geo: continent geo: Israel geo: Europe isa: Management. Fee 0 isa: Base. Index stocks: Nikkei 225 isa: Base. Index tih: Tachlit Nikkei cur: Yen isa: Base. Currency 0. 65 29 isa: Management. Fee geo: Asia geo: Japan cur: state geo: continent
SPARQL - a Query Language for RDF Ø Ø Ø SPARQL - Simple Protocol and RDF Query Language Executes queries over RDF graph Basic query structure - SELECT. . . WHERE. . . Uses URIs Data integration “integrated” in the language : l Ø Query Language with web protocol l 30 queries over multiple graphs web service specification
SPARQL Example Suppose we want to find all ETFs, which are based on NIS and have management fee less than 0. 5 %. We want the query to return security numbers of the ETFs. Ø SPARQL query: Ø PREFIX isa: <http: //www. isa. gov. il/ETF#> PREFIX cur: < http: //www. currency. com/#> SELECT ? etf. Number WHERE { ? etf isa: Security. Number ? etf. Number ; isa: Base. Currency cur: NIS ; isa: Management. Fee ? fee. FILTER (? fee < 0. 5) } 31
Additional SPARQL Example Suppose we want to find all ETFs, which are based on currencies of Asian states. We want the query to return the security numbers of the ETFs and the currencies they are based on. Ø SPARQL query: Ø PREFIX isa: <http: //www. isa. gov. il/ETF#> PREFIX cur: <http: //www. currency. com/#> PREFIX geo: <http: //www. geoinfo. com/#”> SELECT ? etf. Number ? currency WHERE { ? etf isa: Security. Number ? etf. Number ; isa: Base. Currency ? currency cur: state ? state geo: continent geo: Asia. } 32
RDF: the problem Ø Suppose, we want to write a query about all the securities (ETFs, trust funds, stocks and bonds) which are based on Japan economy? Ø We need a some way for the query language to “understand” that ETF is a Security 33
The Next Step of the Semantic Web - Ontologies Ø Ontology in computer science - a formal representation of a set of concepts within a domain and the relationships between those concepts. (From http: //en. wikipedia. org/wiki/Ontology_(com puter_science) 34
The Next Step of the Semantic Web - Ontologies Ø For example, an ontology can state that any entity that has a property (the predicate in the triple subject-predicateobject) belongs to some class l l 35 the subject of isa: Security. Number is a member of isa: Security (the domain of the property) the object of isa: Base. Currency is cur: Currency (the range of the property)
The Next Step of the Semantic Web - Ontologies Ø Stating subclass relationships l l similar to inheritance in OOP For example • isa: ETF and isa: Mutual. Fund is a subclass of isa: Security • isa: Base. Currency and isa: Base. Index a subproperty of isa: Based. On 36
The Semantic Web Ontology Languages Ø There is a number of ontology languages developed for Semantic Web l Ø The standard ontology languages (from more primitive to more expressive) : l l Ø 37 are built on RDF Schema (RDFS) OWL Lite OWL DL OWL Full The more expressive the ontology language, the more computationally expensive is to process it
OWL Ø In OWL it is possible to state in addition to range, domain, sub. Class and sub. Property information: l boolean combination of classes • e. g. Person is either Male or Female l disjointness of classes • e. g. Male and Female are disjoint classes 38
OWL l cardinality of the objects • e. g. every person has one mother, two parents, four grandparents l characteristics of properties • e. g. is. Sibling. Of is a symmetric and transitive property l and some other. . . Ø An example ontology - http: //www. owldl. com/ontologies/family. owl 39
OWL Ø OWL is based on Description Logics l l l 40 a formalism for representing concepts (classes), roles (properties) and relationships between them has a formally defined semantics several reasoning tools exist less expressive than First Order Predicate Logic a compromise between expressiveness and computational efficiency
OWL Reasoning Example Ø Suppose we have the following ontology: l l 41 domain of the property X has. Sister Y is Person range of the property X has. Sister Y is Female X has. Sister Y is a sub property of X has. Sibling Y is a symmetric and transitive property
OWL Reasoning Example Ø 42 From a fact “John” has. Sister “Mary” and the ontology follows l “John” is a Person l “Mary” is a Female l “Mary” is a sibling of “John” l “John” is a sibling of “Mary”
OWL Reasoning Example Ø From an additional fact “Mary” has. Sibling “Bob” l “John” has. Sibling “Bob” l “Bob” has. Sibling “Mary” l “Bob” has. Sibling “John” 43
Description Logic - Limitations Ø It is impossible to define a rule for an “uncle”, as in First Order Predicate logic l 44 Parent(X, Y), Brother(X, Z) → Uncle(Z, Y)
The Logic Reasoning in the Semantic Web Ø The logic reasoning is used in the context of the Semantic Web for: l l 45 checking the consistency of ontologies checking the consistency of data with regard to the ontologies automatic classification of instances of data discovering implied relationships between instances of data
The Semantic Web: an Optimistic Scenario Ø All the data in the world is described by RDF or could be converted automatically to an RDF representation l l 46 semantic markup converters to RDF
The Semantic Web: an Optimistic Scenario Ø All the data could be queried by one query language (e. g. SPARQL) Ø All the world knowledge about any domain could be formalized in ontologies which will appear on the Web l 47 for example, ontologies about securities, currencies, geographic information etc.
The Semantic Web: an Optimistic Scenario* Software Applications SPARQL** engine OWL ontologies RDF Data 48 RDF extractors/ converters Documents- XML, HTML, Text. . . SQL-SPARQL “bridge” Databases * Influenced by http: //www. w 3. org/2007/Talks/0223 -Bangalore-IH/Slides. html#(36) ** OWL enabled SPARQL or another query language
The Semantic Web: Applications Ø Data Integration Ø Knowledge Management Ø Semantic Search Ø Management of multimedia data Ø Ontology-oriented software development Ø and others. . . 49
The Semantic Web: Applications Ø Corporate Semantic Web - a high-impact technology according to Gartner 2006 l 50 mainstream adoption in 5 -10 years
WEB SERVICES 51
Web Services Ø The initial problem: writing a software application for analysis of financial products Ø A possible solution: l l each company publishes on the Web a set of callable “functions” which return the data about the products the functions are called by the application (as in regular programming languages) • • 52 ETFInfo. get. Management. Fee(“Kesem. Nikkei”) ETFInfo. get. Base. Currency(“Kesem. Nikkei”)
Web Services Ø Web Services - the standard way to call “functions” over the Web Ø Set of standard protocols for invocation, publishing and locating software applications across the Web l Based on HTTP and XML Ø The protocols : l l l 53 SOAP - invocation WSDL - publishing UDDI - discovery
Publishing RDF + XSL + Web Services Web Browser with XSLT support XML messages Web. Site Web Services 54 RDF/ XML XSL stylesheet
SOAP - Simple Object Access Protocol Ø Applications are invoked by sending an XML message (request) in the SOAP format over HTTP to a specific service l identified by a URL Ø The request contains specifications of the requested operation and of the parameters to it Ø An XML message (response) with the result is sent back by the Web Service 55
SOAP Example Ø abstraction over calling a function: l float management. Fee = get. Management. Fee(“Kesem Nikkei”); Ø a request with the name of the operation “get. Management. Fee” and the string paremeter “Kesem Nikkei” is sent to the service Ø a response with the float return value is sent back 56
SOAP Example Ø A SOAP request <? xml version="1. 0" encoding="UTF-8"? > <soapenv: Envelope xmlns: soapenv="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance"> <soapenv: Body> <get. Management. Fee soapenv: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/" > <Title xsi: type="xsd: string"> Kesem Nikkei </Title> </get. Management. Fee > </soapenv: Body> </soapenv: Envelope> 57
SOAP Example Ø A SOAP response <? xml version="1. 0" encoding="UTF-8"? > <soapenv: Envelope xmlns: soapenv="http: //schemas. xmlsoap. org/soap/envelope/" xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" xmlns: xsi="http: //www. w 3. org/2001/XMLSchema-instance"> <soapenv: Body> <get. Management. Fee. Response soapenv: encoding. Style="http: //schemas. xmlsoap. org/soap/encoding/" > <Management. Fee xsi: type="xsd: float"> 0 </ Management. Fee > </get. Management. Fee. Response > </soapenv: Body> </soapenv: Envelope> 58
WSDL - Web Services Description Language Ø Written in XML Ø Defines l functionality the Web Service provides • • • l l operations types of the parameters types of the return values data encoding and communication protocols location of the service Ø Formal description makes possible automatic generation of code stubs on the client and the server sides 59
WSDL Example Ø An abstraction of a Java interface : interface ETFInfo { float get. Management. Fee(String title); String get. Base. Currency(String title); } 60
WSDL Example <? xml version="1. 0" encoding="UTF-8"? > <description xmlns="http: //www. w 3. org/ns/wsdl" > <types> <xsd: schema xmlns: xsd="http: //www. w 3. org/2001/XMLSchema" xmlns: t="http: //www. xnes. co. il" > <xsd: element name="Title" type="xsd: string"/> <xsd: element name=“Management. Fee" type="xsd: float"/>. . . </types> <interface name="ETFInfo"> <operation name="get. Management. Fee" pattern="http: //www. w 3. org/ns/wsdl/in-out"> <input message. Label="In" element="t: Title"/> <output message. Label="Out" element="t: Management. Fee"/> </operation> <operation name="get. Base. Currency" pattern="http: //www. w 3. org/ns/wsdl/in-out"> <input message. Label="In" element="t: Title"/> <output message. Label="Out" element="t: Base. Currency"/> </operation>. . . </interface> <!-- protocols, Web. Service location, etc. -->. . . </description> 61
Web Services - the Problem Ø The problem is with automatic composition of Web Services l different companies provide different Web Services • different operation names • different parameter names l Web Services descriptions is syntactic • parameters/return values l l l 62 types are specified the semantics is not specified Currently, the composition and discovery of Web Services is done manually
The solution - Semantic Markup of Web Services Ø The Web Services descriptions can be tagged by RDF statements l l l 63 operations parameters return values preconditions postconditions
The solution - Semantic Markup of Web Services Ø Using ontologies for reasoning about l l parameters, return values, preconditions etc. about Web Services themselves Ø Semantic Reasoning can be applied to the Web Service RDF descriptions and ontologies l l l 64 integrating information from different Web Services composing Web Services matchmaking between consumers and producers of Web Services
“COMPOSING WEB SERVICES ON THE SEMANTIC WEB”, B. MEDJAHED ET. AL. , VLDB JOURNAL 2003 65
Web Services Composition Bank Web Service Stock Exchange Web Service 66 ETF information Web Service ETF purchase composite Web Service Securities Ranking Web Service
“Composing Web Services on the Semantic Web” Ø An ontology for Web Services Ø A custom web services description language l based on XML Ø Using URIs and existing taxonomies for providing semantics to the descriptions of operations and their parameters Ø A custom algorithm for composing web services 67
“Composing Web Services on the Semantic Web”: Weaknesses Ø The ontology - using DAML-OIL (an alternative to OWL). However, the authors did not describe how exactly they used the ontology Ø Custom matching algorithm - not using standard technologies the authors missed the opportunity to use existing tools for logical reasoning 68
“Composing Web Services on the Semantic Web”: Weaknesses Ø Using URIs of terms in existing taxonomies on the Web. However, the authors missed the opportunity to reuse l existing ontologies • specifying synonyms for parameter types • specifying sub-class relationships between parameter types l RDF related tools • query languages 69
70 “SOFTWARE FRAMEWORK FOR MATCHMAKING BASED ON SEMANTIC WEB TECHNOLOGY”, L. LI ET. AL. , INTERNATIONAL JOURNAL OF ELECTRONIC COMMERCE 2004
Web Services Matchmaking Advertisement 1 (Management Fee = 0. 3 %, Dividend = 80 %) Request (Management Fee < 0. 5 %, Dividend > 70 %) Matchmaking System Advertisement 2 (Management Fee = 0. 6 %, Dividend = 100 %) Advertisement 3 (Management Fee = 0 %, Dividend = 30 %) 71
“Software Framework for Matchmaking Based on Semantic Web Technology”, L. Li et. al. , 2004 Ø The requests and advertisements are expressed in an ontology language l in particular, constraints on the operation parameters Ø The matchmaking is done by an existing Description Logic reasoning tool Ø The experiments showed that Description Logic reasoning technology can be used in large scale e-commerce applications (the performance is reasonable) 72
Bibliography Ø Ø Ø Ø 73 “A Semantic Web Primer”, G. Antoniou and F. van Harmelen, 2004 “State of the Semantic Web”, I. Herman, 2008 “SPARQL tutorial”, Jena - A Semantic Web Framework for Java “Description Logics course” , E. Franconi “Gartner's 2006 Emerging Technologies Hype Cycle Highlights Key Technology Themes”, Gartner, Inc. , 2006 “Composing Web Services on the Semantic Web”, B. Medjahed et. al. , VLDB Journal 2003 “Software Framework For Matchmaking Based on Semantic Web Technology”, L. Li et. al. , International Journal of Electronic Commerce 2004
980e4b0e42dc740d9966c11f550df5b8.ppt