Introduction to Web Science

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Advanced XSLT. Branching in XSLT XSLT is functional programming –The program evaluates a function –The function transforms one structure into another.
XML: Extensible Markup Language
XSLT 11-Apr-17.
1 XSLT – eXtensible Stylesheet Language Transformations Modified Slides from Dr. Sagiv.
XML 6.2 XSL / XSLT 6. What is XSL? XSL stands for eXtensible Stylesheet Language CSS was designed for styling HTML pages, and can be used to style XML.
XSL XSLT and XPath 11-Apr-17.
+ XSL eXtensible Stylesheet Language. + 2 XML Lecture Adapted from the work of Prof Mark Baker ACET, University of Reading.
1 CP3024 Lecture 9 XML revisited, XSL, XSLT, XPath, XSL Formatting Objects.
Rendering XML documents with XSL The most powerful approaches to rendering XML documents involve using XSL (eXtensible Stylesheet Language) XSL enables.
XSL Transformations (XSLT) Meghasyam Bokam April’1 st, 2002.
XSL Unit 6 November 2. XSL –eXtensible Stylesheet Language –Basically a stylesheet for XML documents XSL has three parts: –XSLT –XPath –XSL-FO.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
XML Technologies and Applications Rajshekhar Sunderraman Department of Computer Science Georgia State University Atlanta, GA 30302
September 15, 2003Houssam Haitof1 XSL Transformation Houssam Haitof.
Semantic Web Technologies Lecture # 2 Faculty of Computer Science, IBA.
ECA 228 Internet/Intranet Design I Intro to XSL. ECA 228 Internet/Intranet Design I XSL basics W3C standards for stylesheets – CSS – XSL: Extensible Markup.
XSLT 1. C ONTENTS XSLT and uses XSLT example Simple XML How XSLT works? Template-match Value-of For-each and sort If Choose-when Apply-templates Where.
16-1 The World Wide Web The Web An infrastructure of distributed information combined with software that uses networks as a vehicle to exchange that information.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
XML for E-commerce III Helena Ahonen-Myka. In this part... n Transforming XML n Traversing XML n Web publishing frameworks.
IS432 Semi-Structured Data Lecture 5: XSLT Dr. Gamal Al-Shorbagy.
XP New Perspectives on XML Tutorial 6 1 TUTORIAL 6 XSLT Tutorial – Carey ISBN
XP 1 CREATING AN XML DOCUMENT. XP 2 INTRODUCING XML XML stands for Extensible Markup Language. A markup language specifies the structure and content of.
WORKING WITH XSLT AND XPATH
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall XML Transformation: XSLT Semantic Web - Spring 2007 Computer.
1 CIS336 Website design, implementation and management (also Semester 2 of CIS219, CIS221 and IT226) Lecture 6 XSLT (Based on Møller and Schwartzbach,
1 XSLT An Introduction. 2 XSLT XSLT (extensible Stylesheet Language:Transformations) is a language primarily designed for transforming the structure of.
ECA 228 Internet/Intranet Design I XSLT Example. ECA 228 Internet/Intranet Design I 2 CSS Limitations cannot modify content cannot insert additional text.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
XSLT Kanda Runapongsa Dept. of Computer Engineering Khon Kaen University.
Lecture 11 XSL Transformations (part 1: Introduction)
XML eXtensible Markup Language. Topics  What is XML  An XML example  Why is XML important  XML introduction  XML applications  XML support CSEB.
 2002 Prentice Hall, Inc. All rights reserved. 1 Chapter 12 – XSL: Extensible Stylesheet Language Transformations (XSLT) Outline 12.1Introduction 12.2Setup.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Applying eXtensible Style Sheets (XSL) Ellen Pearlman Eileen Mullin Programming.
1 Overview of XSL. 2 Outline We will use Roger Costello’s tutorial The purpose of this presentation is  To give a quick overview of XSL  To describe.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 4 1COMP9321, 15s2, Week.
XSLT. XSLT stands for Extensible Stylesheet Language Transformations XSLT is used to transform XML documents into other kinds of documents. XSLT can produce.
XP New Perspectives on XML, 2 nd Edition Tutorial 7 1 TUTORIAL 7 CREATING A COMPUTATIONAL STYLESHEET.
Martin Kruliš by Martin Kruliš (v1.1)1.
XSLT: How Do We Use It? Nancy Hallberg Nikki Massaro Kauffman.
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall XML Transformation: XSLT Semantic Web - Fall 2005 Computer.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Jackson, Web Technologies: A Computer Science Perspective, © 2007 Prentice-Hall, Inc. All rights reserved Chapter 7 Representing Web Data:
XML Introduction to XML Extensible Markup Language.
XML Schema – XSLT Week 8 Web site:
1 XSL Transformations (XSLT). 2 XSLT XSLT is a language for transforming XML documents into XHTML documents or to other XML documents. XSLT uses XPath.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
1 Extensible Stylesheet Language (XSL) Extensible Stylesheet Language (XSL)
CH 15 XSL Transformations 1. Objective What is XSL? Overview of XSL transformations Understanding XSL templates Computing the value of a node with xsl:value-of.
In this session, you will learn to:
XSLT: The XML transformation language
Advanced Computer Systems
XML Introduction Bill Jerome.
Unit 4 Representing Web Data: XML
Displaying XML Data with XSLT
XML QUESTIONS AND ANSWERS
Reference: cit /Lectures/xslt.ppt
Using XSLT and XPath to Transform XML Documents
XML in Web Technologies
eXtensible Stylesheet Language
ACG 4401 XSLT Extensible Stylesheet Language for Transformations
Chapter 7 Representing Web Data: XML
Applying eXtensible Style Sheets (XSL)
XML WITH CSS.
CS 431 – February 28, 2005 Carl Lagoze – Cornell University
XSL XSLT and XPath 24-Feb-19.
Attributes, Empty-Element Tags, and XSL
XSL XSLT and XPath.
More XML XML schema, XPATH, XSLT
Presentation transcript:

Introduction to Web Science Maintaining Information on the Web

Six challenges of the Knowledge Life Cycle Acquire Model Reuse Retrieve Publish Maintain

Prediction Ontology maintenance will become the significant problem as ontologies become more mainstream High quality ontologies are easier to maintain

What makes a good quality ontology? Coverage Correctness Consistency Richness Organisation Relation to reality Making meaning clear

Common modelling pitfalls Instantiation Constitution Composition Disjunction Polysemy

Instantiation (1) Which one is correct? PDA IPAQ PDA My PDA

Instantiation (2) Question Answer What PDA model do you sell? My PDA is not a PDA model! So you wouldn’t sell your PDA!

Composition (1) What’s incorrect with this? Computer Disk Drive Memory Micro Drive Memory

Composition (2) Question Answer What computers do you sell? Definitely not disk drives and memory is the answer!

Disjunction (1) Computer Part Disk Drive Micro Drive Memory

Disjunction (2) Computer Has part Computer Part Camera Has part Flashcard 110

Disjunction (2) Computer Has part Computer Part Camera Has part Flashcard 110

Disjunction (3) Computer Has part Computer Part Camera Has part

Polysemy (1) Words with more than one meaning … What is a book? A physical object “The DaVinci Code” An abstract entity A Book by Dan Brown

Polysemy (2) Book The DaVinci Code Dan Brown Book We must be consistent with what is a book! Book The DaVinci Code Dan Brown Book

Constitution (1) Computer should not form part of the hierarchy, different level of constitution Entity Matter Metal Clay Physical Object Computer

Constitution (2) What kind of matter conducts electricity? Answer should not be computer

Making Meaning Clear Part-of relates parts to their wholes E.g. part-of(engine,car) Part-of is irreflexive Part-of is anti-symmetric Nothing can have only one part

Requirement for Ontology Management(1/2) Stored, aligned, evolution need to be managed Alignment the ontologies either need to be integrated Because, re-used Ontology alignment is very relevant in a Semantic Web context separate ontologies should be aligned and linked

Requirement for Ontology Management(2/2) Support for evolving ontologies change in the real world (E.g. Car engines) adaptations to different tasks (E.g. Wine and food) alignments to other ontologies (E.g. Travel and food) Ontology library systems grouping, reorganizing ontologies for further re-use integration, maintenance, mapping, versioning

Aligning Ontologies (1) Why is Aligning Needed created to link different terminologies (E.g. books) modeling styles used in these domain specific ontologies creating bridges between separated pieces of knowledge

Aligning Ontologies (2) Aligning Annotated XML Documents (The alignments)

Supporting Ontology Change (1) Ontologies specific Not static, evolution is need Reasons of changes in ontologies Changes in the domain Change in the real world Domain to be modified Changes in the conceptualization Different perspective E.g. Pet shop vrs Reptile Ontology Changes in the specification Translation – retain the semantics

Supporting Ontology Change (2) Changes in ontologies involve Several Problems Effects of Ontology Change Different interpretation or may use unknown terms Changes to the source ontology Applications that use the ontology may also be hampered

Supporting Ontology Change (3) Change Management Comparing Ontologies Logical definition change Non-logical change Identifier change Addition of definitions Deletion of definitions Specification of Change Transformation or actual change Conceptual relation Descriptive meta-data like date, author, and reason of the update Valid context

Organising Ontologies (1) Different ontologies increasing Task of storing Maintaining and re-organizing Ontology library system Tool in grouping and re-organizing ontologies Re-use, integration, maintenance and versioning

Organising Ontologies (2) Sesame Open storage, identification and versioning of ontologies Smooth access to existing ontologies and advanced support in adapting ontologies to certain domain and task-specific circumstances Fully employing the power of standardization and providing access to upper-layer ontologies and standard representation languages

Organising Ontologies (3) Sesame Requirements (Aspects of an ontology library system)

Organising Ontologies (4) Functionality of an Ontology Storage System Management Storage easily accessible Ontologies classified Stored in modules (because ontology re-use) Identification Unique identifier Versioning Ensuring consistency

Organising Ontologies (5) Functionality of an Ontology Storage System Adaptation Searching how to search ontology Editing how to add, delete and edit specific ontologies Reasoning How to derive consequences from an ontology

Organising Ontologies (6) Functionality of an Ontology Storage System Standardization Language Kind of standard ontology language used in the ontology library system E.g. RDFS, XMLS, DAML+OIL Upper-level Ontologies

Organising Ontologies (7) Current storage systems Adaptation Searching Access through the Internet or World Wide Web Offer Simple browsing only SQL-based searching Editing Simple editing function Reasoning Very simple reasoning function E.g. WebOnto(rule-based reasoning), Ontolingua (ontology testing), SHOE(ontology revision)

Organising Ontologies (8) Requirement for a Storage System Other requirements Ontology scalability Maintenance facility Explicit documentation

Translating between Ontologies XSLT stands for Extensible Stylesheet Language Transformations XSLT is used to transform XML documents into other kinds of documents--usually, but not necessarily, XHTML XSLT uses two input files: The XML document containing the actual data The XSL document containing both the “framework” in which to insert the data, and XSLT commands to do so

Very simple example File data.xml: File render.xsl: <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="render.xsl"?> <message>Howdy!</message> File render.xsl: <?xml version="1.0"?> <xsl:stylesheet version="1.0” xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- one rule, to transform the input root (/) --> <xsl:template match="/"> <html><body> <h1><xsl:value-of select="message"/></h1> </body></html> </xsl:template> </xsl:stylesheet>

The .xsl file An XSLT document has the .xsl extension The XSLT document begins with: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/ XSL/Transform"> Contains one or more templates, such as: <xsl:template match="/"> ... </xsl:template> And ends with: </xsl:stylesheet>

Finding the message text The template <xsl:template match="/"> says to select the entire file You can think of this as selecting the root node of the XML tree Inside this template, <xsl:value-of select="message"/> selects the message child Alternative Xpath expressions that would also work: ./message /message/text() (text() is an XPath function) ./message/text()

Putting it together The XSL was: <xsl:template match="/"> <html><body> <h1><xsl:value-of select="message"/></h1> </body></html> </xsl:template> The <xsl:template match="/"> chooses the root The <html><body> <h1> is written to the output file The contents of message is written to the output file The </h1> </body></html> is written to the output file The resultant file looks like: <html><body> <h1>Howdy!</h1> </body></html>

How XSLT works The XML text document is read in and stored as a tree of nodes The <xsl:template match="/"> template is used to select the entire tree The rules within the template are applied to the matching nodes, thus changing the structure of the XML tree Unmatched parts of the XML tree are not changed After the template is applied, the tree is written out again as a text document

Where XSLT can be used With an appropriate program, such as Xerces, XSLT can be used to read and write files A server can use XSLT to change XML files into HTML files before sending them to the client A modern browser can use XSLT to change XML into HTML on the client side Most users seldom update their browsers If you want “everyone” to see your pages, do any XSL processing on the server side Otherwise, think about what best fits your situation

xsl:value-of <xsl:value-of select="XPath expression"/> selects the contents of an element and adds it to the output stream The select attribute is required Example (from an earlier slide): <h1> <xsl:value-of select="message"/> </h1>

xsl:for-each xsl:for-each is a kind of loop statement The syntax is <xsl:for-each select="XPath expression"> Text to insert and rules to apply </xsl:for-each> Example: to select every book element irrespective of where it is (//book) and make an unordered list (<ul>) of their titles (title), use: <ul> <xsl:for-each select="//book"> <li> <xsl:value-of select="title"/> </li> </xsl:for-each> </ul> // means any ancestor / means just the parent

Filtering output You can filter (restrict) output by adding a criterion to the select attribute’s value: <ul> <xsl:for-each select="//book"> <li> <xsl:value-of select="title[../author=‘Dan Brown']"/> </li> </xsl:for-each> </ul>

Filter details Here is the filter we just used: <xsl:value-of select="title[../author=‘Dan Brown'"]/> author is a sibling of title, so from title we have to go up to its parent, book, then back down to author This filter requires a quote within a quote, so we need both single quotes and double quotes Legal filter operators are: = != < >

But it doesn’t work right! Here’s what we did: <xsl:for-each select="//book"> <li> <xsl:value-of select="title[../author=‘Dan Brown']"/> </li> </xsl:for-each> This will output <li> and </li> for every book, so we will get empty bullets for authors other than Dan Brown There is no obvious way to solve this with just xsl:value-of

xsl:if xsl:if allows us to include content if a given condition (in the test attribute) is true Example: <xsl:for-each select="//book"> <xsl:if test="author=‘Dan Brown'"> <li> <xsl:value-of select="title"/> </li> </xsl:if> </xsl:for-each> This does work correctly!

xsl:choose The xsl:choose ... xsl:when ... xsl:otherwise construct is XML’s equivalent of Java’s switch ... case ... default statement The syntax is: <xsl:choose> <xsl:when test="some condition"> ... some code ... </xsl:when> <xsl:otherwise> ... some code ... </xsl:otherwise> </xsl:choose>

xsl:sort You can place an xsl:sort inside an xsl:for-each The attribute of the sort tells what field to sort on Example: <ul> <xsl:for-each select="//book"> <xsl:sort select="author"/> <li> <xsl:value-of select="title"/> by <xsl:value-of select="author"> </li> </xsl:for-each> </ul> This example creates a list of titles and authors, sorted by author

xsl:text <xsl:text>...</xsl:text> helps deal space related problems: XSL isn’t very careful with whitespace in the document This doesn’t matter much for HTML, which collapses all whitespace anyway (though the HTML source may look ugly) <xsl:text> gives you much better control over whitespace; it acts like the <pre> element in HTML

Creating tags from XML data Suppose the XML contains <name>Dr. Dave's Home Page</name> <url>http://www.cis.upenn.edu/~matuszek</url> And you want to turn this into <a href="http://www.cis.upenn.edu/~matuszek"> Dr. Dave's Home Page</a> We need additional tools to do this

Creating tags Suppose the XML contains <name>Dr. Dave's Home Page</name> <url>http://www.cis.upenn.edu/~matuszek</url> <xsl:attribute name="..."> adds the named attribute to the enclosing tag The value of the attribute is the content of this tag Example: <a> <xsl:attribute name="href"> <xsl:value-of select="url"/> </xsl:attribute> <xsl:value-of select="name"/> </a> Result: <a href="http://www.cis.upenn.edu/~matuszek"> Dr. Dave's Home Page</a>

Modularization Modularization--breaking up a complex program into simpler parts--is an important programming tool In programming languages modularization is often done with functions or methods In XSL we can do something similar with xsl:apply-templates For example, suppose we have a DTD for book with parts titlePage, tableOfContents, chapter, and index We can create separate templates for each of these parts

Book example <xsl:template match="/"> <html> <body> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="tableOfContents"> <h1>Table of Contents</h1> <xsl:apply-templates select="chapterNumber"/> <xsl:apply-templates select="chapterName"/> <xsl:apply-templates select="pageNumber"/> </xsl:template> Etc.

xsl:apply-templates The <xsl:apply-templates> element applies a template rule to the current element or to the current element’s child nodes If we add a select attribute, it applies the template rule only to the child that matches If we have multiple <xsl:apply-templates> elements with select attributes, the child nodes are processed in the same order as the <xsl:apply-templates> elements

Applying templates to children <book> <title>XML</title> <author>Gregory Brill</author> </book> <xsl:template match="/"> <html> <head></head> <body> <b><xsl:value-of select="/book/title"/></b> <xsl:apply-templates select="/book/author"/> </body> </html> </xsl:template> <xsl:template match="/book/author"> by <i><xsl:value-of select="."/></i> </xsl:template> With this line: XML by Gregory Brill Without this line: XML

Calling named templates You can name a template, then call it, similar to the way you would call a method in Java The named template: <xsl:template name="myTemplateName"> ...body of template... </xsl:template> A call to the template: <xsl:call-template name="myTemplateName"/> Or: <xsl:call-template name="myTemplateName"> ...parameters... </xsl:call-template>

Templates with parameters Parameters, if present, are included in the content of xsl:template, but are the only content of xsl:call-template Example call: <xsl:call-template name="doOneType"> <xsl:with-param name="header" select="'Lectures'"/> <xsl:with-param name="nodes" select="//lecture"/> </xsl:call-template> Single quotes inside double quotes make this a string This parameter is a typical XPath expression

Thoughts on XSL XSL is a programming language--and not a particularly simple one These slides have been an introduction to XSL and XSLT--there’s a lot more of it we haven’t covered As with any programming, it’s a good idea to start simple and build it up incrementally: “Write a little, test a little” This is especially a good idea for XSLT, because you don’t get a lot of feedback about what went wrong

FYI There exists also Formatting Objects Processors Task is to transform XML into other formats Not just other XML type documents But also PDF, PS, PNG, etc

Automatic Ontologies Maintenance Use IE + WWW search to identify them New Domain Word identification Biocomputation Abbreviations (OWL) Aliases (BSE also known as “Mad Cow Disease”) Spelling Errors Anesthesia > Anaesthesia Orthographic Variances Audio/Visual > Audio-visual Morphological Variances CD ROM > CD ROMs

Related Concepts A term G is related to term T if T and G share some words Ballistic missile -- medium-range ballistic missile T and G often appear together in same sentences Select a set of semantically related terms with higher domain specificity

Relation Extraction Structurally Suggested ISA Relation Position defense. The type of defense in which …. Hyperspectral imagery. A term used to describe the imagery derived from .. Lexically Suggested ISA Relation guided rocket-powered delivery vehicle ---ISA--- delivery vehicle

Automatic Ontology Construction (1) Agroterrorism. Terrorist attacks aimed at reducing the food supply by destroying crops using natural pests such as the potato beetle, animal diseases such as hoof and mouth disease and anthrax, molds and other plant diseases.

Automatic Ontology Construction (2) Food Supply Potato Beatle Attack IS A reduce Crop Hoof IS A IS A destroy Terrorist Attack Natural Pest Mouth Disease IS A IS A use Animal Disease Anthrax Agroterrorism IS A use Plant Disease Mold IS A use

Conclusion Ontology maintenance is a critical problem Need support Tools help Theories help Text analysis helps

Questions?