1 / 48

XML, Ajax, Web Services, Semantic Web

XML, Ajax, Web Services, Semantic Web. Week 13 INFM 603. Agenda. XML Ajax Web Services Semantic Web. XML. XML  eXtensible Markup Language XML An XML document is a text-based document XML is a language for describing data or for creating markup languages

joshwa
Download Presentation

XML, Ajax, Web Services, Semantic Web

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML, Ajax, Web Services, Semantic Web Week 13 INFM 603

  2. Agenda • XML • Ajax • Web Services • Semantic Web

  3. XML • XML eXtensible Markup Language • XML • An XML document is a text-based document • XML is a language for describing data or for creating markup languages • Allows data to be structured, stored and transmitted in a hierarchical fashion • XML tags (element type names) provide a reader an idea of what data means • XML is human-readable • Goals for XML • Easily adapted to specific tasks (e.g., Rendering Web pages, Encoding metadata, Semantic Web) • Easily created/processed/read • Concise

  4. XML • Example (Providing information about a course) <?xml version="1.0" encoding="ISO-8859-1"?> <semester> <course courseNum=“bio101”> <name>Intro to Biology</name> <instructor>Prof Cell</instructor> </course> </semester>

  5. XML • XML is case sensitive • XML declaration is the first statement • <?xml version="1.0"?> • An XML document is a “tree” • Must contain one root element • Other elements must be properly nested • All start tags must have end tags • Attribute values must have quotation marks • <item id=“33905”> • Certain characters are “reserved” • For example: &lt; is used to represent < • You can generate different types of documents from an XML document (through a process call Transformation). You could generate HTML, CD, DVD, Video, etc.

  6. Some XML Applications • Text Encoding Initiative • For adding annotation to historical manuscripts • http://www.tei-c.org/ • Encoded Archival Description • To enhance automated processing of finding aids • http://www.loc.gov/ead/ • Metadata Encoding and Transmission Standard • Bundles descriptive and administrative metadata • http://www.loc.gov/standards/mets/

  7. The XML Family Tree SMIL VoiceXML RSS XHTML MathML RDF HTML TEI . . . . . . XML SGML

  8. Languages Based on XML • Some languages based on XML • XHTML • SMIL  Demo available at http://www.umiacs.umd.edu/~oard/teaching/603/spring12/slides/13/media.html • SVG  XML application language that replaces many uses of bitmap graphics • RSS • Rich Site Summary or Really Simple Syndication • Format for delivering changing web content • MathML • Used to describe mathematical notations • WAP and WML • For handheld devices

  9. XSLT • Used with XML documents to transform data into a particular context (e.g., HTML, word, pdf, etc.) or another XML document • In order to define the transformation an XSLT stylesheet is defined • The stylesheet is an XML document

  10. XML Example • View “The Song of the Wandering Aengus” • http://www.umiacs.umd.edu/~oard/teaching/603/spring12/slides/13/xml.htm

  11. XML Example <?xml version="1.0"?> <!DOCTYPE POEM SYSTEM "poem01.dtd"> <?xml-stylesheet type="text/xsl" href="poem01.xsl"?> <POEM> <TITLE>The Song of Wandering Aengus</TITLE> <AUTHOR> <FIRSTNAME>W.B.</FIRSTNAME> <LASTNAME>Yeats</LASTNAME> </AUTHOR> <STANZA> <LINE>I went on to the hazel wood,</LINE> <LINEIN>Because a fire was in my head,</LINEIN> <LINE>And cut and peeled a hazel wand,</LINE> </STANZA> </POEM>

  12. Document Type Definition (DTD) <!ELEMENT poem ( (title, author, stanza)* )> <!ELEMENT title (#PCDATA) > <!ELEMENT author (firstname, lastname) > <!ELEMENT firstname (#PCDATA) > <!ELEMENT lastname (#PCDATA) > <!ELEMENT stanza (line+ | linein+) > <!ELEMENT line (#PCDATA) > <!ELEMENT linein (#PCDATA) > #PCDATA span of text a,ba followed by b a|b either a or b a* 0 or more a’s a+ 1 or more a’s

  13. Specifying Appearance: XSL(T) <xsl:template match="POEM"> <HTML> <BODY BGCOLOR="#FFFFCC"> <xsl:apply-templates/> </BODY> </HTML> </xsl:template> <xsl:template match="TITLE"> <H1> <FONT COLOR="Green"> <xsl:value-of/> </FONT> </H1> </xsl:template>

  14. CSS vs XSL • From: • http://www.w3.org/Style/CSS-vs-XSL • We have two different style languages. Which one to use? • CSS when you can • XSL when you must

  15. XML vs. HTML • XML and HTML derive from a meta language called SGML (Standard Generalized Markup Language) • XML  Uses a subset of syntax rules allowed in SGML • XML tags are specific to applications and users know what they mean, while HTML tags have fixed meaning and browsers know what they are • HTML tags are used for display purposes while XML tags are used to describe data and documents

  16. Well-Formed XML Documents • An XML document that follows the XML syntax rules is said to be well-formed • XML Parser/XML Processor  allow us to detect whether a document is well-formed • Two types of Parsers • Non-validating XML Parser  checks whether document satisfies XML syntax rules (well-formed), but does not check for any specific structure of elements/attributes • Validating XML Parser  checks whether document is well-formed and also verifies it satisfies the specific structure of elements/attributes

  17. JSON • JavaScript Object Notation • Text-based standard for data interchange • Light-weight alternative to XML • Derived from JavaScript but it is language independent • JSON Example:http://json.org/example.html

  18. Synchronized Multimedia Integration Language (SMIL) • SMIL  Enables simple authoring of interactive audiovisual presentations • Utilized for rich media/multimedia presentations that integrate streaming audio and video with images, text or any other media type • Window controls (in <head>) • Controlling layout: <region>, <root-layout> • Timeline controls (in <body>) • Sequence control: <seq>, <excl>, <par> • Timing control: <begin>, <end>, <dur> • Content types (in <body>) • <audio>, <video>, <img>, <ref> • http://www.w3.org/AudioVideo/ • Example: • http://www.umiacs.umd.edu/~oard/teaching/603/spring12/slides/13/media.html

  19. Ajax • Traditional interaction with web server • Nothing happens until we submit data • We must wait until the server request is processed (cannot do anything with the page) • A page must be completed loaded even if most of the content identical to previous page • Compare with a desktop application • Can we do better? Can the page be updated without requiring a page load? • Ajax is the answer • Example (AjaxExamples): • directoryLookup.html, directory.php, processMemo.php in TypicalASynchronous folder

  20. Ajax

  21. Ajax

  22. Ajax • Ajax  Asynchronous JavaScript and XML • Combination of technologies • Adds a layer between the browser and the web server, handling server requests and processing the results • Layer Name  Ajax Framework/Ajax Engine • The requests are not synchronized with user actions (e.g., clicking on links, buttons, etc.). User can continue interacting with the browser while request is being processed

  23. Ajax • In the traditional client/server model we submit server requests by clicking on a link or via submit (this generates the HTTP request for us) • Notice we get a new web page as a result • XMLHTTPRequest • JavaScript object that will issue the HTTP request • No page load is generated as a result of the request • Can only issue request to URLs within the same domain • Cannot directly access a remote server • There is nothing the server needs to do just because the request is associated with AJAX. The server is just receiving an HTTP request • Ajax application just care about receiving an HTTP response

  24. Ajax Examples • HTML Ajax • http://test.deitel.com/examples/iw3htp4/ajax/fig15_05/SwitchContent.html • XML Ajax • http://test.deitel.com/examples/iw3htp4/ajax/fig15_08/PullImagesOntoPage.html • Jason Ajax • http://test.deitel.com/examples/iw3htp4/ajax/fig15_09_10/addressbook.html

  25. (PC) Interface Design (IE, Firefox) Client-side Programming (JavaScript) Interaction Design Interchange Language (HTML, XML) Server-side Programming (PHP) Business rules (MySQL) (PC, Unix) • Relational normalization • Structured programming • Software patterns • Object-oriented design • Functional decomposition Client Hardware Web Browser Database Server Hardware

  26. Model-View-Controller

  27. Web Services • Web Service • Web API (Application Programming Interface) that can be accessed over a network and executed at a remote system • Allows client applications to build interfaces to the service • From webopedia.com • Web services allow different applications from different sources to communicate with each other without time-consuming custom coding, and because all communication is in XML, Web services are not tied to any one operating system or programming language • Web services do not provide the user with a GUI. Web services instead share business logic, data and processes through a programmatic interface across a network • Web Service (From Wikipedia) • W3C defines a "Web service" as a software system designed to support interoperable machine-to-machine interaction over a network • Example: • http://code.google.com/apis/maps/documentation/webservices/#WebServices

  28. Web Services • Services can range from simple requests to complicated business processes • Payment processing • Content Syndication • Currency conversion • Language translation • Any internet protocol can be used to build web services but HTTP and XML are often used • By using web services, your application can publish its function to the world • Web services can be created in any programming language • Web services enable us to solve interoperability problems between systems by allowing data exchange between different applications and different platforms. • With web services a company billing system can connect with a supplier server

  29. Web Services • Several protocols and techniques have been developed to create and utilize web services. Two main ones: • REST  Representational State Transfer • SOAP  Simple Object Access Protocol • In General • REST  light-weight interactions • SOAP  secure, reliable interactions • Each has its advantages • From Wikipedia • REST  primary purpose of the service is to manipulate XML representations of Web resources using a uniform set of "stateless" operations • SOAP   the service may expose an arbitrary set of operations

  30. Web Services (REST) • REST (Representational State Transfer) • Resources are represented by URLs • Resource  document, person, location • Each resource has a unique URL • Each resource does not need to have an actual page/document. It can be generated dynamically • A resource is considered a “noun” • Operations are performed via HTTP methods (GET, POST, PUT, DELETE) • Methods are considered “verbs” • REST  designed to operate with resource-oriented services (locate/manipulate resource)

  31. Web Services (REST) • Example: • Web service that allows individuals to manage file backups • Each backup has an URL http://backupFake.doesnotexist.org/backups/1938 • Server responses will use XML • Using HTTP GET we can get the backup • Using HTTP PUT we can update a backup • Using HTTP POST we can upload a backup • We can receive a URL that corresponds to the new backup • Using HTTP DELETE we can delete a backup • Notice that REST relies on a familiar approach (HTTP methods) to ask for services (we don’t need to create a new interface/approach)

  32. Web Services(SOAP) • SOAP (Simple Object Access Protocol) • SOAP  Designed for action-oriented services (actions a web server can carry out) • Designed as a way to package remote procedure calls into XML wrappers • SOAP is an XML-based messaging protocol • SOAP request • XML document • Has three components • Envelop  defines document as SOAP request • Body  provides information about the call and responses • Optional header and fault elements • SOAP response is an XML document

  33. Web Services (Examples) • Web Service example • http://www.w3schools.com/webservices/ws_example.asp • Using web service example http://www.w3schools.com/webservices/ws_use.asp • Many popular organizations provide web services • Amazon  http://aws.amazon.com/ • Netflix  http://developer.netflix.com/docs • Netflix Web API allows you to • Search movies, TV series, etc. • Retrieve catalog titles • Manage and displaying queues for users • Yahoo • http://developer.yahoo.com/everything.html • eBay  http://developer.ebay.com/products/shopping/

  34. Web Services (Platform Elements) • WSDL (Web Services Description Language) • XML-based language for describing and locating web services • W3C standard • It is machine-readable • UDDI (Universal Description, Discovery and Integration) • Directory service where companies can search and register for web services described by WSDL • Service Broker • Wikipedia Image for Service Broker/Requester/Provider • http://en.wikipedia.org/wiki/File:Webservices.png

  35. REST vs. SOAP • http://www.youtube.com/watch?v=v3OMEAU_4HI • http://spf13.com/post/soap-vs-rest

  36. Frapi (RESTful API Framework) • Frapi • FRAPI is a RESTful API Framework that allows developers to develop RESTful APIs that • http://getfrapi.com/

  37. Mashups • Mashup • Web page or application that uses and combines data and/or functionality from several sources. Sources are often based on web services. • Relies on open APIs • Allow us to create new views of data • MashupGenres • Video and Photo Mashups • Mapping Mashups • Big player  Google Maps API • Search and Shopping Mashups • News Mashups • Example: Diggdot.us (combines news from Digg.com, Del.icio.us and Slashdot.org)

  38. Mashup Examples • Google vs Yahoo • http://www.langreiter.com/exec/yahoo-vs-google.html • Popular MashUp Listing • http://www.programmableweb.com/popular

  39. Semantic Web • From: • http://www.cs.umd.edu/~golbeck/LBSC690/SemanticWeb.html • Semantic web • Adds structure to the meaningful content of web pages • Most data in the web is for human consumption, rather than data that can be processed automatically by computers. Semantic Web will enable computers to be able to understand the data, instead of just displaying it • Allows for complex queries. For example: • How many stores are open when I am not at work or traveling in June? • It is not a separate web, but an extension of our present web • Semantic web – Term coined by Tim Berners-Lee • http://www.w3.org/People/Berners-Lee/

  40. Semantic Web • Semantic web needs • Access to structured collections of information • Sets of inference rules to conduct automated reasoning • Semantic Web Challenge • Provide a language that expresses both data and rules for reasoning about data • Allowing rules from knowledge-representation system to be exported to the web • Technologies for developing the semantic web • XML – Allows users to add arbitrary structure to their documents • RDF – Allows users to add meaning to their documents

  41. Semantic Web • RDF  Resource Description Framework • Allow us to express meaning • In RDF a document makes assertions that particular entities (people, web pages, etc.) have properties (e.g., “father of”) with certain values (e.g. another person) • Meaning is encoded in triples • Triple  has subject, verb/predicate and object (all expressed using URIs) • <#john> pref:loves <#cheescake>. • Written in XML • RDF Example  http://www.cs.umd.edu/~golbeck/INFM743/sample.owl • RDF triples form web of information about related things

  42. Semantic Web: Ontology • Document that formally defines terms and inference rules as to how terms relate • Used for reasoning about data • Typical ontology for the web has taxonomy and inference rules • Example of page marked up for ontology use: • http://www.cs.rpi.edu/~hendler/ • Notice the <USE-ONTOLOGY> tag • Using ontology’s concepts, information about where Dr. Hendler obtained his PhD is provided • Allows a computer to answer the question: “Where Dr. Hendler received his degree?”

  43. Semantic Web • Impact of semantic web will be seen when: • Programs are created that combine information from different sources, process the information and exchange results with other programs • Providing web-based services with semantics will • Allow for service discovery • Understanding of functions offered and how to take advantage of such functionality

  44. Microformats Human- and Machine-Readable Human-Readable <div id="contact"> <h2>Contact Me</h2> <p> You can contact me via email to <a href="mailto:jane@example.com">jane@example.com</a>, or send stuff to me at the following address:</p> <p>255 Some Street,<br /> Some Place,<br /> Some Town</p> </div> <div id="contact" class="vcard"> <h2>Contact Me</h2> <h3 class="fn">Jane Doe</h3> <p> You can contact me via email to <a class="email" href="mailto:jane@example.com">jane@example.com</a>, or reach me at the following address:</p> <div class="adr"> <div class="street-address">255 Some Street</div> <div class="locality">Some Town</div> <div class="region">Some Place</div> </div> </div>

  45. Web Scraping • From Wikipedia • Process of automatically collecting information from the web • From www.webopedia.com • Application that processes HTML of a web page to extract data • Web scrapping applications simulate a person viewing a web site • You may need to rely on web scrapping when no API is provided to access data • ScraperWiki • Platform that enables building of programs to extract and analyze data • https://scraperwiki.com/

  46. Semantic Web Videos • Introduction • http://www.youtube.com/watch?v=OGg8A2zfWKg • Demo of Semantic Web Portal • http://www.youtube.com/watch?v=X6WcpG5EEeI&feature=related • Semantic Web of Data Tim Berners-Lee • http://www.youtube.com/watch?v=HeUrEh-nqtU&feature=related • Tim Berners-Lee: The next Web of open, linked data • http://www.youtube.com/watch?v=OM6XIICm_qo&feature=related • RDF Basics • http://www.youtube.com/watch?v=ldl0m-5zLz4&feature=related • http://videolectures.net/training06_sure_stsw/ • Notice slides on the side move automatically

  47. References • http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol • http://www.w3schools.com/webservices/ • AJAX in 10 Minutes  ISBN-10: 0672328682 • http://en.wikipedia.org/wiki/Mashup_%28web_application_hybrid%29 • http://www.ibm.com/developerworks/xml/library/x-mashups.html • Sams Teach Yourself Perl in 24 Hours • Great Reference to learn Perl • ISBN: 0-672-32793-7

  48. References • http://www.cs.umd.edu/~golbeck/INFM743/xml.ppt • http://www.xml.com/ • XML in 10 Minutes (ISBN: 0-672-32471-7) • http://www.xmlhack.com/ • http://www.w3.org/XML/ • http://www.w3schools.com/xml/xml_whatis.asp • http://blogspace.com/rss/readers • http://www.w3.org/TR/REC-xml/ • http://cyber.law.harvard.edu/rss/rss.html

More Related