Applications of XML Web Services RSS RDF. Web Services.
Post on 22-Dec-2015
239 Views
Preview:
Transcript
Applications of XMLApplications of XMLWeb Services • RSS • RDF
Web ServicesWeb Services
HUJI-CSHUJI-CSDBI 2007DBI 2007 3
"Web services are loosely coupled software components
delivered over standard Internet technologies."
"Web services are loosely coupled software components
delivered over standard Internet technologies."
HUJI-CSHUJI-CSDBI 2007DBI 2007 4
Example Scenario: Get Online InformationExample Scenario: Get Online Information
Stock Exchange
Stock Broker
Application
Get Stock Price
Get Stock Price
Return Stock
Price
Return Stock Price
HUJI-CSHUJI-CSDBI 2007DBI 2007 5
Book Store
The Hobbit (5)Price: 25.95
Copies in Stock: 1
The Hobbit (5)Price: 25.95
Copies in Stock: 0
Book Store
The Hobbit (5)Price: 20.95
Copies in Stock: 5
Buy The Hobbit (5)
Buy The Hobbit (5)
How Much?
20.95
Buy it
The Hobbit (5)Price: 20.95
Copies in Stock: 4
The Hobbit (5)Price: 25.95
Copies in Stock: 1
The Hobbit (5)Price: 25.95
Copies in Stock: 0
Example Scenario – Online TradeExample Scenario – Online Trade
HUJI-CSHUJI-CSDBI 2007DBI 2007 6
Example Scenario: Grid Computation Example Scenario: Grid Computation
Grid Computation
Using seamlesslythe combinedresources of many computersthat are connectedto the Internet
HUJI-CSHUJI-CSDBI 2007DBI 2007 7
What is a Web Service?What is a Web Service?
• Self-contained, modular Web application that can be published, located and invoked across the Web
• A Web service can perform functions of varying complexities
• Once deployed, other applications (and other Web services) can discover and invoke the deployed service
HUJI-CSHUJI-CSDBI 2007DBI 2007 8
Calling Remote Functions Could HelpCalling Remote Functions Could Help
• It would help if we could call functions, such as:– Amazon.getPrice(“The Hobbit")
– Amazon.buyBook(“The Hobbit", myId)
getPrice(…)
The Internet
HUJI-CSHUJI-CSDBI 2007DBI 2007 9
Difficulties in Using Remote FunctionsDifficulties in Using Remote Functions
• For each remote function, we need to phrase a call in the specific language that is used for its implementation
• For each remote function, we need to contact the provider in order to find out what exactly the signature (i.e., parameters, return value, inc. the type) is
• On the server side, each remote function needs to listen to a server socket bound to a specific port – Not in line with protection by firewalls
HUJI-CSHUJI-CSDBI 2007DBI 2007 10
The SolutionThe Solution
• Use an agreed interface and a syntax that all applications are familiar with (e.g., XML)– For example, SOAP
• Use HTTP to transfer data through port 80
• Use a standard for publishing methods, their signatures and their usage– For example, WSDL
• Use standard directory structures for publishing available services– For example, UDDI
HUJI-CSHUJI-CSDBI 2007DBI 2007 11
HUJI-CSHUJI-CSDBI 2007DBI 2007 12
Web Services that are Already AvailableWeb Services that are Already Available
• Google search (http://www.google.com/apis)
• Weather reports
• Stock prices
• Currency exchanges
• Sending SMS messages, faxes
• Prices of books in Barnes and Nobles
• Dictionaries
• etc.
HUJI-CSHUJI-CSDBI 2007DBI 2007 13
Implementing Web ServicesImplementing Web Services
• Programmers are given tools that spare the need to directly write SOAP or WSDL documents
• In Java:– JAX-RPC: part of SUN tools for publishing and
deploying Web Services
– AXIS: Apache’s tool for handling Web services in Java
• The combination of standards and management tools (like Axis – next week) makes the invocation of remote methods a very easy operation
HUJI-CSHUJI-CSDBI 2007DBI 2007 14
Programming the ServicesProgramming the Services
• What programming language is used for Web Services?– They are independent from programming language
– HTTP can be implemented in any language
– XML contains data but not object (no methods, etc.)• objects can be represented in XML and vice versa
– SOAP builds on top of XML (Infoset)
• Typical languages:– Java, C#, Perl, PHP, Python, Ruby, …
SOAPSOAP
Simple Object-Access Protocol
HUJI-CSHUJI-CSDBI 2007DBI 2007 16
What is SOAP?What is SOAP?
• SOAP is a protocol for accessing Web Services
• SOAP is XML based– Thus, SOAP provides interoperability
• In SOAP, applications exchange information over HTTP– Thus, SOAP is not restricted by firewalls
• SOAP allows to exchange structured and typed information on the Web– XSchema types are used to add types to XML
• SOAP specification: http://www.w3.org/2000/xp/Group/
HUJI-CSHUJI-CSDBI 2007DBI 2007 17
SOAP CommunicationSOAP Communication
HUJI-CSHUJI-CSDBI 2007DBI 2007 18
Soap StructureSoap Structure Put a message into an envelope and
describe additional features in the header (payment, etc.)SOAP Envelope
SOAP Header
SOAP Body- required
- optional
Fault -optional
HUJI-CSHUJI-CSDBI 2007DBI 2007 19
POST /soap HTTP/1.0SOAPAction: ""Content-Length: 520
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body> <ns1:getRate soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:xmethods-CurrencyExchange">
<country1 xsi:type="xsd:string">Euro</country1> <country2 xsi:type="xsd:string">Israel</country2> </ns1:getRate> </soapenv:Body></soapenv:Envelope>
A request to A request to servicesservices..xmethodsxmethods..net:80net:80
HUJI-CSHUJI-CSDBI 2007DBI 2007 20
HTTP/1.0 200 OKDate: Sat, 07 May 2005 23:26:21 GMTContent-Length: 492Content-Type: text/xml
<?xml version='1.0' encoding='UTF-8'?>
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<soap:Body> <n:getRateResponse xmlns:n='urn:xmethods-CurrencyExchange'>
<Result xsi:type='xsd:float'>5.5825</Result> </n:getRateResponse> </soap:Body></soap:Envelope>
The ResponseThe Response
HUJI-CSHUJI-CSDBI 2007DBI 2007 21
Example - Calling Google SpellingExample - Calling Google Spelling<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP
ENV=“http://schemas.xmlsoap.org/soap/envelope/”
xmlns:xsi=“http://www.w3.org/1999/XMLSchema-instance”
xmlns:xsd=“http://www.w3.org/1999/XMLSchema”>
<SOAP-ENV:Body>
<ns1:doSpellingSuggestion xmlns:ns1=“urn:GoogleSearch” SOAP- ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<key xsi:type="xsd:string">00000000000000000000000000</key>
<phrase xsi:type="xsd:string">britney speers</phrase>
</ns1:doSpellingSuggestion>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HUJI-CSHUJI-CSDBI 2007DBI 2007 22
Example - Google Spelling ResponseExample - Google Spelling Response
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:doSpellingSuggestionResponse xmlns:ns1="urn:GoogleSearch“
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:string">britney spears</return>
</ns1:doSpellingSuggestionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
HUJI-CSHUJI-CSDBI 2007DBI 2007 23
MD5 TransformMD5 Transform
HUJI-CSHUJI-CSDBI 2007DBI 2007 24
Baghdad WeatherBaghdad Weather
HUJI-CSHUJI-CSDBI 2007DBI 2007 25
Baghdad WeatherBaghdad Weather
HUJI-CSHUJI-CSDBI 2007DBI 2007 26
World CitiesWorld Cities
HUJI-CSHUJI-CSDBI 2007DBI 2007 27
World CitiesWorld Cities
HUJI-CSHUJI-CSDBI 2007DBI 2007 28
Messaging PatternsMessaging Patterns
• Synchronous– Remote procedure call
– Standard HTTP request response
• What are the limitations here? ServiceService
AAServiceService
AAClientClientClientClientmessagemessage
replyreply
HUJI-CSHUJI-CSDBI 2007DBI 2007 29
Asynchronous MessagingAsynchronous Messaging• Asynchronous
– A message is sent with directions on where to send the reply when it is ready.
• Generalize the callback model
– Document oriented
– Tolerates long latencies
• Destination of reply may be different from origin
• Message may transit several other services
• Analogy: Mail, Email, … To: From:
ServiceServiceAA
ServiceServiceAA
ClientClientClientClient
messagemessage ServiceServiceBB
ServiceServiceBB
ServiceServicecc
ServiceServicecc
ReplyReplyDest.Dest.ReplyReplyDest.Dest. replyreply
HUJI-CSHUJI-CSDBI 2007DBI 2007 30
The SOAP HeaderThe SOAP Header• A generic mechanism for adding features to a SOAP message
• Contained in the header are header blocks– Some header blocks are marked as mandatory (mustUnderstand=“true”)
the rest can be ignored.
• The header blocks contain answers to questions like– Where to send a reply or fault message
• i.e. how to handle asynchronous messaging
– What are the security requirements of this message
– Other “policy” issues that are involved
– Used by the reliable message protocol
• The header is the place where protocol composability takes place
HUJI-CSHUJI-CSDBI 2007DBI 2007 31
WS-AddressingWS-Addressing• A soap header used to
– Specify the final destination and action of a message
– A unique identifier for the message
– The endpoint of a reply
– The endpoint of a fault message
– The details of an endpoint reference
<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2004/12/addressing"> <S:Header> <wsa:To>http://Z.com/ServiceURI</wsa:To> <wsa:Action>http://Z.com/DoSomething</wsa:Action> <wsa:MessageID> http://example.com/SomeUniqueMessageIdString </wsa:MessageID> <wsa:ReplyTo> <wsa:Address>http://X.com/someClient</wsa:Address> </wsa:ReplyTo> <wsa:FaultTo> <wsa:Address>http://Y.com//ErrorHandler</wsa:Address> </wsa:FaultTo> </S:Header> <S:Body> <!-- The message body of the SOAP request appears here --> </S:Body></S:Envelope>
HUJI-CSHUJI-CSDBI 2007DBI 2007 32
What is an endpoint reference?What is an endpoint reference?• Specifies the complete details about how to get to
and identify a service– My address …
• The simplest form– <wsa:Address>http://X.com/myservice</wsa:Address>
• But more complex forms are possible– For example qualifying a level of service
<wsa:EndpointReference xmlns:wsa="..." xmlns:painter="..."> <wsa:Address>http://housepainting.com</wsa:Address> <wsa:ReferenceProperties> <painter:ServiceLevel>Basic Paint Job</painter:ServiceLevel> </wsa:ReferenceProperties> </wsa:EndpointReference>
Some More Details on SOAPSome More Details on SOAP
HUJI-CSHUJI-CSDBI 2007DBI 2007 34
encodingStyleencodingStyle Attribute Attribute• “The SOAP encodingStyle attribute indicates the encoding
rules used to serialize parts of a SOAP message”– Needed when sending data structures
• This attribute may appear on any SOAP element, and it will apply to that element's content and all child elements
• A SOAP message has no default encoding– Unencoded data may be used in SOAP messages
• The SOAP default XMLSchema for SOAP encoding and data types is:
http://www.w3.org/2002/12/soap-encoding– Other encoding rules may be used
HUJI-CSHUJI-CSDBI 2007DBI 2007 35
SOAP Header ElementSOAP Header Element• The SOAP Header element is optional
• It contains application-specific information (like authentication, payment, etc.) about the SOAP message
• If the Header element is present, it must be the first child element of the Envelope element
• Attributes that the namespace defines:– Role – used to address the Header element to particular
servers (relevant to p2p scenarios where a message can reach several servers)
– mustUnderstand – used to indicate whether a header entry is mandatory or optional for the recipient to process
– encodingStyle – as explained before
HUJI-CSHUJI-CSDBI 2007DBI 2007 36
SOAP Header ElementSOAP Header Element• Example:
<SOAP-ENV:Header> <t:Transaction xmlns:t="some-URI"
SOAP-ENV:mustUnderstand="1">5</t:Transaction>
</SOAP-ENV:Header>
• 5 is the transaction ID of which this method is a part
• In the above example, the SOAP-envelope attribute mustUnderstand is set to 1, which means that the server must either understand and honor the transaction request or must fail to process the message
HUJI-CSHUJI-CSDBI 2007DBI 2007 37
SOAP Response on ErrorSOAP Response on Error
• There can be many errors in processing a SOAP request
• Error in Running Methods: For example, suppose that the "Hello Server" does not allow anyone to say hello on Tuesday
• Error in Processing SOAP Headers: For example, a problem running the method as a part of a transaction
HUJI-CSHUJI-CSDBI 2007DBI 2007 38
The Fault Element May Include the The Fault Element May Include the Following Sub-ElementsFollowing Sub-Elements
• <faultcode> : A code for identifying the fault
• <faultstring> : A human readable explanation of the fault
• <faultactor> : Information about who caused the fault
• <detail> : Holds application-specific error information related to the Body element of the SOAP request
HUJI-CSHUJI-CSDBI 2007DBI 2007 39
SOAP Fault CodesSOAP Fault Codes
• VersionMismatch: Found an invalid namespace for the SOAP Envelope element
• MustUnderstand: An immediate child element of the Header element, with the mustUnderstand attribute set to 1, was not understood
• Client: The message was incorrectly formed or contained incorrect information
• Server: There was a problem with the server so the message could not proceed
HUJI-CSHUJI-CSDBI 2007DBI 2007 40
SOAP Error Response for Method ErrorSOAP Error Response for Method Error
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Server Error</faultstring> <detail> <e:myfaultdetails xmlns:e="Hello"> <message> Sorry, I cannot say hello on Tuesday. </message> <errorcode>1001</errorcode> </e:myfaultdetails> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body></SOAP-ENV:Envelope>
HUJI-CSHUJI-CSDBI 2007DBI 2007 41
SOAP Error Response for Header ErrorSOAP Error Response for Header Error
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:MustUnderstand</faultcode> <faultstring>SOAP Must Understand Error</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body></SOAP-ENV:Envelope>
No detail element may appear when there is an error in processing the Headers of a SOAP request
HUJI-CSHUJI-CSDBI 2007DBI 2007 42
Sending a RequestSending a Request
• The SOAP request does not contain the address to which it should be sent
• Q: Where do we put the URL of the Web Service?
• A: It depends on the protocol used to send the request (usually HTTP, but could also be another protocol, e.g., SMTP)
HUJI-CSHUJI-CSDBI 2007DBI 2007 43
SOAP Request via HTTPSOAP Request via HTTP
POST http://www.Hello.com/HelloApplication HTTP/1.0
Content-Type: text/xml; charset=UTF-8
Content-Length: 587
SOAPAction: urn:helloApp
<SOAP-ENV:Envelope …
Note: There are 2 addresses(1) URL of a SOAP Server (2) URI of an application to run (this needn't
correspond to an actual Internet address)
HUJI-CSHUJI-CSDBI 2007DBI 2007 44
SOAPAction HeaderSOAPAction Header
• Used to indicate the intent of the SOAP HTTP request
• The presence and content of the SOAPAction header field can be used by servers, such as firewalls, to appropriately filter SOAP request messages in HTTP
• The header-field value of an empty string ("") means that the intent of the SOAP message is provided by the URL of the HTTP Request
WSDLWSDL
Web Services Definition Language
HUJI-CSHUJI-CSDBI 2007DBI 2007 46
Describing a Web ServiceDescribing a Web Service
• Need a standard way to describe a Web Service:– the methods available
– their parameters
– etc.
• WSDL is a standard for describing Web services using XML, i.e., it is a language for the green pages of UDDI
• WSDL specification can be found at http://www.w3.org/TR/wsdl
HUJI-CSHUJI-CSDBI 2007DBI 2007 47
The Web Service Definition LanguageThe Web Service Definition Language
• A document used by a client so that it has a formal description of a service
• Client fetches the WSDL for a service from some location
• Client uses the WSDL to properly format the SOAP request and to understand the reply
Service RegistryService Registry
WSDL forWSDL forService XService X
ServiceServiceXX
ServiceServiceXXClientClientClientClient
messagemessage
replyreply
11 22
33
44
HUJI-CSHUJI-CSDBI 2007DBI 2007 48
WSDL Can DescribeWSDL Can Describe
• What a Web service can do
• Where it resides
• How to invoke it
HUJI-CSHUJI-CSDBI 2007DBI 2007 49
The Structure of a WSDL DocumentThe Structure of a WSDL Document<definition>
<type>
definition of a type
</type>
<message>
definition of a message
</message>
<portType>
def. of operations (composed of messages)
</portType>
<binding>
how to translate operations into SOAP
</binding>
<service>
the location of the service
</service>
</definition>
<definition>
<types>
<messages>
<portTypes>
<bindings>
<service>
HUJI-CSHUJI-CSDBI 2007DBI 2007 50
<?xml version="1.0"?>
<definitions name="CurrencyExchangeService" targetNamespace="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:tns="http://www.xmethods.net/sd/CurrencyExchangeService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="getRateRequest"> <part name="country1" type="xsd:string"/> <part name="country2" type="xsd:string"/> </message>
<message name="getRateResponse"> <part name="Result" type="xsd:float"/> </message>
<portType name="CurrencyExchangePortType"> <operation name="getRate"> <input message="tns:getRateRequest" name="getRate"/> <output message="tns:getRateResponse" name="getRateResponse"/> </operation></portType>
HUJI-CSHUJI-CSDBI 2007DBI 2007 51
<binding name="CurrencyExchangeBinding" type="tns:CurrencyExchangePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getRate"> <soap:operation soapAction=""/>
<input name="getRate"> <soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input>
<output name="getRateResponse"> <soap:body use="encoded" namespace="urn:xmethods-CurrencyExchange" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation></binding>
<service name="CurrencyExchangeService"> <documentation>Returns the exchange rate between the two currencies</documentation> <port name="CurrencyExchangePort" binding="tns:CurrencyExchangeBinding"> <soap:address location="http://services.xmethods.net:80/soap"/> </port></service></definitions>
HUJI-CSHUJI-CSDBI 2007DBI 2007 52
• Types – containing XML Schema element and type definitions
• Message – an abstract typed definition of the data being communicated
• Operation – an abstract description of an action supported by the service
• Port Type – an abstract set of operations supported by one or more endpoints
• Binding – a concrete communication protocol and data format specification for a particular port type
• Port – a single endpoint defined as a combination of a binding and a network address
• Service – a collection of named ports, each associated with a binding and a network address
The Elements of WSDL DocumentsThe Elements of WSDL Documents
HUJI-CSHUJI-CSDBI 2007DBI 2007 53
Putting it togetherPutting it together
• A client uses the wsdl to guide the creation of the body of the soap message
• The header of the soap message is primarily used to add additional protocol information – For example, the wsdl does
not tell us where to send the reply
– So far it does not tell us about security or reliability requirements or other policy issues
Service RegistryService Registry
WSDL forWSDL forService XService X
ServiceServiceXX
ServiceServiceXXClientClientClientClient
messagemessage
replyreply
11 22
33
44
RReally S Simple S Syndication
HUJI-CSHUJI-CSDBI 2007DBI 2007 55
What is RSS?What is RSS?
• RSS is used for effectively publishing headlines and frequently updated content
• RSS files (also called RSS feeds) are XML that conform to a very simple schema
• Publishers make the RSS feed available on the Web– ynet: http://www.ynet.co.il/Integration/StoryRss2.xml– cnn: http://rss.cnn.com/rss/cnn_topstories.rss– Intel products: http://rss.intel.com/rss/intel-products.xml
• RSS readers are responsible for being updated– That is, have the most recent copy of the feed
HUJI-CSHUJI-CSDBI 2007DBI 2007 56
So Why RSS?So Why RSS?
• A standard, unified way of distributing headlines– Application readers need only to know the feed URL
– Easy to query (“anything new about the middle east?”) and integrate news from multiple sources
• Efficiency: RSS feeds typically contain a small fragment of text for each news item– Thus, a lot of traffic is saved
– Compare it to downloading the Web page of the publishing company
HUJI-CSHUJI-CSDBI 2007DBI 2007 57
Mozilla’s ReaderMozilla’s Reader
HUJI-CSHUJI-CSDBI 2007DBI 2007 58
Goggle’s ReaderGoggle’s Reader
HUJI-CSHUJI-CSDBI 2007DBI 2007 59
Example: Ynet FeedExample: Ynet Feed<?xml version="1.0" encoding="Windows-1255"?>
<rss version="2.0">
<channel>
<title>ynet - Updates for RSS</title>
<link>http://www.ynetnews.com/home/0,7340,L-3254,00.html</link>
<description></description>
<copyright>Ynet - news and content from Israel (Yedioth Ahronoth web site)</copyright>
<language> en </language>
<pubDate>Sun, 15 Apr 2007 00:03:31 +0200</pubDate>
<lastBuildDate> Sun, 15 Apr 2007 00:03:31 +0200 </lastBuildDate>
<image>
<title>Ynet</title>
<link>http://www.ynetnews.com/home/0,7340,L-3254,00.html</link>
<url>http://www.ynetnews.com/images/ECENTRAL_logo.gif</url>
</image>
HUJI-CSHUJI-CSDBI 2007DBI 2007 60
Example: Ynet Feed (cont’d)Example: Ynet Feed (cont’d)<item>
<category>Updates</category>
<title>Egypt pours cold water on talk of "Negotiations" </title>
<description></description>
<link>http://www.ynetnews.com/articles/0,7340,L-3387877,00.html</link>
<pubDate>Sat, 14 Apr 2007 23:51:24 +0200</pubDate>
<guid>http://www.ynetnews.com/articles/0,7340,L-3387877,00.html</guid>
</item><item>
<category>Updates</category>
<title>US: N. Korea must immediately invite IAEA inspectors</title>
<description></description>
<link>http://www.ynetnews.com/articles/0,7340,L-3387866,00.html</link>
<pubDate>Sat, 14 Apr 2007 22:30:39 +0200</pubDate>
<guid>http://www.ynetnews.com/articles/0,7340,L-3387866,00.html</guid>
</item>
<item> …
HUJI-CSHUJI-CSDBI 2007DBI 2007 61
The The ChannelChannel Element Element
• This element represents the feed itself
• A channel contains item elements and, in addition, other elements that describe the feed
• Three sub-elements are required title, link and description
• The channel of the previous example had also an image and a language sub-elements
HUJI-CSHUJI-CSDBI 2007DBI 2007 62
The The itemitem Element Element
• Each item element defines one news item
• An item has three mandatory sub-elements:– The title of the item
– A description of the item
– A link (usually, points to a Web interface of the item)
• Optional sub-elements:– pubDate – date of publication
– comments – a link to comments about the item
– category
HUJI-CSHUJI-CSDBI 2007DBI 2007 63
Title, Link
Description
RResource D Description F Framework
HUJI-CSHUJI-CSDBI 2007DBI 2007 65
The Semantic Web VisionThe Semantic Web Vision
• The vision of the semantic-Web activity is that Web data will entail the semantics of data in a manner that is understood (and can be processed) automatically by computers– Common formats
– Documents integrate data from diverse resources (rather than invent their own specific objects)
– A language that specifies how the data relates to real-world objects
• Instantiated by developing a variety of languages and specifications (RDF, SPARQL, OWL, …)
HUJI-CSHUJI-CSDBI 2007DBI 2007 66
What is RDF?What is RDF?• A part of the semantic-Web activity
• RDF is a general-purpose language for representing information on the Web– Specifically, objects and relationships
• Designed to allow computer applications to process data based on its semantics– Rather than displaying data to humans (as opposed to
RSS)
• An RDF document is actually a labeled graph that is represented in XML– The specific language is called RDF/XML– W3C recommendation (Feb. 2004)
HUJI-CSHUJI-CSDBI 2007DBI 2007 67
RDF DataRDF Data
Subject Objectpredicate
The basic element: Triple (labeled edge)
Person#845
#1002
address
postalCode
6941Netanya
city
Herzel
street
RDF document: edge-labeled graph
HUJI-CSHUJI-CSDBI 2007DBI 2007 68
The XML Syntax of RDFThe XML Syntax of RDF
page.html
John Smith
John’s Home Page
DC:Creator
DC:Title<?xml version=“1.0”?><rdf:RDF
xmlns:rdf=“http://www.w3.org/TR/WD-rdf-syntax#”xmlns:dc=“http://purl.org/metadata/dublin_core#”>
<rdf:Description about=“page.html”> <dc:Creator>John Smith</dc:Creator> <dc:Title>John’s Home Page</dc:Title> </rdf:Description>
</rdf:RDF>
HUJI-CSHUJI-CSDBI 2007DBI 2007 69
Structured ValuesStructured Values
page.html
John SmithJohn’s Home Page js@corp.com
dc:Title
dc:Creator
Name Email
. . .<Description about=“page.html”> <dc:Creator> <Description> <corp:Name>John Smith</corp:Name> <corp:Email>js@corp.com</corp:Email> </Description> </dc:Creator> <dc:Title>John’s Home Page</dc:Title></Description>
</RDF>
HUJI-CSHUJI-CSDBI 2007DBI 2007 70
• A set of fifteen basic properties for describing generalized Web resources
• The “obvious” mapping of Dublin Core properties into RDF properties has not yet been approved by the Dublin Core initiative, but is generally a good example
Dublin CoreDublin Core
HUJI-CSHUJI-CSDBI 2007DBI 2007 71
• “Title”: the name given to the resource• “Creator”: the person or organization primarily
responsible for the resource• “Subject”: what the resource is about• “Description”: a description of the content• “Publisher”: the person or organization
responsible for making the resource available• “Contributor”: someone who has provided content
to the resource other than the creator• “Date”: date of creation or publication
Dublin CoreDublin Core
HUJI-CSHUJI-CSDBI 2007DBI 2007 72
• “Type”: type of resource, such as home page, technical report, novel, photograph…
• “Format”: data format of the resource• “Identifier”: URL, ISBN number, …• “Source”: another resource that this resource is derived
from• “Language”: the language of the content• “Relation”: another resource and its relationship to this one• “Coverage”: the portion of time or space described by this
resource (atlases, histories, etc.)• “Rights”: the intellectual property rights adhering to this
resource, or a pointer to them
Dublin CoreDublin Core
Concise Introduction to RDF:Concise Introduction to RDF:
Found in www.vanx.org, by
Yuri Khramov, SchemaSoft
HUJI-CSHUJI-CSDBI 2007DBI 2007 74
1. Semantic Web Initiative and Metadata
2. Resource Description Framework (RDF) basics
3. Advanced topics: collections, reification
4. Vocabularies: Dublin Core, RSS,..
5. RDF Schema
6. How to get RDF to work?
7. Conclusion
OutlineOutline
HUJI-CSHUJI-CSDBI 2007DBI 2007 75
The Web was built for human consumption, and although everything on it is machine-readable, this data is not machine-understandable
Semantic Web -- a web of data that can be processed directly or indirectly by machines
The solution proposed here is to use metadata to describe the data contained in the Web
Semantic WebSemantic Web
HUJI-CSHUJI-CSDBI 2007DBI 2007 76
RDF BasicsRDF Basics
• Resources
• Properties that have Values
• Statement: Resource A has property B with Value C
AB
C
HUJI-CSHUJI-CSDBI 2007DBI 2007 77
www.vanx.org/presentations/RDF
Yuri Khramov
Yurik@schemasoft.com
Author
Mail addressName
HUJI-CSHUJI-CSDBI 2007DBI 2007 78
• Containers: bags, sequences, alternatives
• aboutEach, aboutEachPrefix
• Reification (higher order statements)
• Namespaces and Vocabularies
Advanced RDFAdvanced RDF
HUJI-CSHUJI-CSDBI 2007DBI 2007 79
• Defined as Open Metadata
• Usual “Library Catalog” Elements, like Creator, Title, Publisher, Date, Language
• Extended by: Source, Relations,Type (what is it – text, image, software), Format
• URI (Identifier)
• Used for cataloging “Global Web Library”
• Others: RSS (RDF Site Summary) – NetScape,
• PRISM – publishing – Adobe, Quark, ..
• <indecs> - e-business – EU companies
• RDF mappings for P3P, PICS,…
Dublin Core et al.Dublin Core et al.
HUJI-CSHUJI-CSDBI 2007DBI 2007 80
• Not an XML Schema!
• A “companion” specification for RDF spec
• Class, Type, subClassOf,
• domain, range
• Misc: label, comment, isDefinedBy,etc.
RDF SchemaRDF Schema
HUJI-CSHUJI-CSDBI 2007DBI 2007 81
• Manually from HTML or “user domain XML”
• With special assisting tools – like Protégé, Reggie, DC-dot, RDF for XML
• Ideally – with some automated procedure from HTML/XML documents
• Can we use XSLT there?
Creating RDF documentsCreating RDF documents
HUJI-CSHUJI-CSDBI 2007DBI 2007 82
• IBM’s Java Central Station (uses RDF)
• Mozilla’s Aurora (RDF-based)
• MUZE DATAX project
Can we use RDF now?Can we use RDF now?
top related