Presentation is loading. Please wait.

Presentation is loading. Please wait.

XML, Ajax, Web Services, Semantic Web

Similar presentations


Presentation on theme: "XML, Ajax, Web Services, Semantic Web"— 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 "?> <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: < 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 Encoded Archival Description To enhance automated processing of finding aids Metadata Encoding and Transmission Standard Bundles descriptive and administrative metadata

7 The XML Family Tree XML SGML . . . . . . 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 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”

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) > DTD defines a document type in 1. Its vocabulary, what kind of elements are allowed in the document type. 2. It defines a content model for each element. A content model is a pattern that tells what elements or data can go inside an element, in what order, in what number, and whether they are required or optional. Think of this as the “grammar” of the attribute. #PCDATA => parsed character data. The characters will be checked by an XML parser for entity reference, which will then be replaced with their entity values #PCDATA span of text a,b a 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> Extensible Stylesheet language XSL

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:

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> Example:

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 XML Ajax Jason Ajax
XML Ajax Jason Ajax

25 Server-side Programming Interchange Language Client-side Programming
Relational normalization Structured programming Software patterns Object-oriented design Functional decomposition Client Hardware (PC, Unix) (MySQL) (PHP) (HTML, XML) (JavaScript) (IE, Firefox) (PC) Business rules Interaction Design Interface Web Browser Server-side Programming Interchange Language Client-side Programming 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:

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 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 Using web service example Many popular organizations provide web services Amazon  Netflix  Netflix Web API allows you to Search movies, TV series, etc. Retrieve catalog titles Manage and displaying queues for users Yahoo eBay 

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

35 REST vs. SOAP http://www.youtube.com/watch?v=v3OMEAU_4HI

36 Frapi (RESTful API Framework)
FRAPI is a RESTful API Framework that allows developers to develop RESTful APIs that

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 Mashup Genres 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
Popular MashUp Listing

39 Semantic Web From: 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

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  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: 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 to <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 to <a class=" " 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 https://scraperwiki.com/ From Wikipedia
Process of automatically collecting information from the web From 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

46 Semantic Web Videos Introduction
Demo of Semantic Web Portal Semantic Web of Data Tim Berners-Lee Tim Berners-Lee: The next Web of open, linked data RDF Basics Notice slides on the side move automatically

47 References http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol
AJAX in 10 Minutes  ISBN-10: Sams Teach Yourself Perl in 24 Hours Great Reference to learn Perl ISBN:

48 References http://www.xml.com/ XML in 10 Minutes (ISBN: 0-672-32471-7)
XML in 10 Minutes (ISBN: )


Download ppt "XML, Ajax, Web Services, Semantic Web"

Similar presentations


Ads by Google