There will be a lecture this Friday to help you prepare your revision over Easter. We will look at the exam structure and last year's paper. I also want to gather your thoughts on topics which would benefit from additional revision material to present after Easter, although we still have material to cover after Easter.
The workshop will be on the representation of time using the tutorial on the SIMILE timeline project. Think of this as a GoogleEarth of time.
Wednesday, 21 March 2007
Tuesday, 20 March 2007
Multiple nodes in PHP
Several of you have asked about looping round elements in XML. This is obviously desirable because, although only six places are asked for in the data, the code should not have to change when a new place is added.
Heres how to do it - [Caution - this code is unchecked]
Heres how to do it - [Caution - this code is unchecked]
//assume places.xml contains multiple places, each with a name and description
$placesxml = simplexml_load_file("places.xml");
$places = $placesxml->xpath("//Place");
// $places is now an array of XML elements, each a Place element
foreach ($places as $place) {
//$place now points to each Place in the XML document in turn
// so we can use object references to access the elements within a Place
print $place->name, $place->description;
// or even XPath expression as well
// and of course, if the are repeated elements in Place, such Link, with elements
//url and text, we can use a inner loop to work with these
foreach( $place->Link as $link) {
print "<a href='$link->url'/>$link->text</a>"
}
}
Wednesday, 14 March 2007
Week 20 - Sematic Web -16th of March
We are going to continue to look at the Semantic Web. This week we are going to look at this excellent introduction to the Semantic Web, Schema Languages and Ontology Languages. Then, for self-study, read the section on RDF Schema in the RDF primer that I gave out last week.
Further reading - see the links for last week.
Further reading - see the links for last week.
Sunday, 4 March 2007
Week 19 - RDF - 9th of March
In the next two weeks we are going to looking at RDF and RDF Schema languages. We will be reading the RDF primer so please take a look at this document.
See also a short set of slides and the handout for the session.
Further reading:
See also a short set of slides and the handout for the session.
Further reading:
- Eric Miller's tutorial on RDF at DC-2002, October 13-17, 2002, Florence, Italy.
- Ivan Herman's talk at WWW2006 in Edinburgh on the Semantic Web.
- Henry Story's video presentation about RDF produced by Sun Microsystems.
- Peter Patel-Schneider's Google TechTalk on the Semantic Web.
Wednesday, 28 February 2007
Week 18 - XSLT
XSLT is a rather different language for transforming XML documents than XQuery, but it shares much of the same functionaility. It is more widely used than XQuery partly because there are a number of XSLT processors readily available to use server-side and browsers now include an XSLT processor so that the transformation can be made in the client.
I also want show how XML schemas can be used - for validation of an XML document, and in InfoPath to create a data entry form.
Workshop
Based on the sample data, stylesheet and CSS in this directory
http://www.cems.uwe.ac.uk/~cjwallac/apps/scotch/
1. Copy these files to a directory of your own. There is a zip of the files you need.
2. Test distillery-2.xml to make sure it is working as it does in my directory
3. Make a simple modifucation to the CSS to change the output
4. Add another simple template to the XSLT to display another item of information in the file.
5. Modify the stylesheet for distilleries to display
6. Use InfoPath to create a simple form for either the whisky data or for your own data.
I also want show how XML schemas can be used - for validation of an XML document, and in InfoPath to create a data entry form.
Workshop
Based on the sample data, stylesheet and CSS in this directory
http://www.cems.uwe.ac.uk/~cjwallac/apps/scotch/
1. Copy these files to a directory of your own. There is a zip of the files you need.
2. Test distillery-2.xml to make sure it is working as it does in my directory
3. Make a simple modifucation to the CSS to change the output
4. Add another simple template to the XSLT to display another item of information in the file.
5. Modify the stylesheet for distilleries to display
6. Use InfoPath to create a simple form for either the whisky data or for your own data.
Thursday, 22 February 2007
Week 17 - Xquery and XML database
This week we look at an alternative technology for working with XML. This uses a language called XQuery which is an extension of XPath. There are many XQuery implementations and we will be using one which is part of an open-source project providing a native XML databas.
- slides
- Distillery example
- eXist Database
- Xquery on w3 schools
Monday, 19 February 2007
Periodic table of Visualization Methods
Visual-Literacy.org has published this great Periodic Table of methods of visualisation. This displays around 100 diagram types, with examples and a multi-faceted classification by:
These listings are made by:
List of methods
for $item in data(/HTML[contains(.//TITLE,'Periodic')]//A/@onmouseover)
let $name := lower-case(substring-before(substring-after($item,"window.status='"),"';"))
let $pix := substring-before(substring-after($item,'src="'),'">')
where string-length($pix) >0
order by $name
return
<div><a href="'http://www.visual-literacy.org/periodic_table/{$pix}'">{$name}</a>
</div>
In fact, instead of running a query against the raw HTML, I wrote a slightly different query to generate a simple XML file in which the basic data was stored in alphabetical order. Using an intermediate file also allow me to correct a couple of typos in the method names, and of course it is faster to generate the page. In addition, I've added the facility for a user to group methods and tag the group. Some links to Google images and Wikipedia have been added too. There's a lot more could be done with this.
Now what would be nice would be to get the raw data including the class names as XML so it could be re-organised and extended, without having to descend to scraping.
- simple to complex
- data/information/concept/strategy/metaphor/compound
- process/structure
- detail/overview
- divergence/convergence
These listings are made by:
- taking the HTML source of the Periodic table
- loading it into the eXist database. The source is accepted by eXist even though it is not well formed XML - missing quotes, bare <>
- writing a query on XQuery to generate the page.
- Find the html document with 'Periodic' in the title
- Find all the A tags,
- Get the onmouseover attribute
- use some string functions to get the name and the source of the image from this string
- sort by name
- generate a div per tag
List of methods
for $item in data(/HTML[contains(.//TITLE,'Periodic')]//A/@onmouseover)
let $name := lower-case(substring-before(substring-after($item,"window.status='"),"';"))
let $pix := substring-before(substring-after($item,'src="'),'">')
where string-length($pix) >0
order by $name
return
<div><a href="'http://www.visual-literacy.org/periodic_table/{$pix}'">{$name}</a>
</div>
In fact, instead of running a query against the raw HTML, I wrote a slightly different query to generate a simple XML file in which the basic data was stored in alphabetical order. Using an intermediate file also allow me to correct a couple of typos in the method names, and of course it is faster to generate the page. In addition, I've added the facility for a user to group methods and tag the group. Some links to Google images and Wikipedia have been added too. There's a lot more could be done with this.
Now what would be nice would be to get the raw data including the class names as XML so it could be re-organised and extended, without having to descend to scraping.
Subscribe to:
Posts (Atom)