Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Use XQuery to transform XML to RDF

Better understand XQuery's potential

Howard Katz is a programmer and technical writer who lives and works in a forest in beautiful Roberts Creek, British Columbia, Canada. He's been a programmer for almost 40 years and has written numerous technical articles for the computer trade press in that time, as well as online columns on programming matters for Microsoft and Apple. He's the editor of the Addison-Wesley book, XQuery from the Experts, and is the author of a Java-based, open-source XQuery engine at Sourceforge. He currently sits on the W3C's RDF Data Access Working Group as an invited expert. You can reach him at howardk@fatdog.com.

Summary:  This tutorial is designed to assist XQuery users who would like to better understand its capabilities, particularly those pertaining to data transformation, as well as RDF users who want to use XQuery to move existing XML data into RDF. Examples show how to use XQuery to transform a specific XML vocabulary into Resource Description Framework (RDF).

Date:  27 Sep 2004
Level:  Intermediate PDF:  A4 and Letter (136 KB | 31 pages)Get Adobe® Reader®

Activity:  5006 views
Comments:  

Introduction

Should I take this tutorial?

This tutorial is designed to assist XQuery users who would like to better understand its capabilities, particularly those pertaining to data transformation, as well as Resource Description Framework (RDF) users who want to use XQuery to move existing XML data into RDF. The tutorial demonstrates how to use XQuery to transform a specific XML vocabulary into RDF.

This tutorial assumes you are familiar with the basics of XML. You do not need in depth knowledge of either XQuery or RDF to use the XQuery code developed here; however, the more you know about either subject, the more you're likely to appreciate what's going on. Although Basic principles provides some information on RDF issues, the main focus of the tutorial is XQuery.


What is this tutorial about?

This tutorial uses a specific XML vocabulary as a simple illustration of how to generally use XQuery to transform XML into RDF. The methodology used here is to move the XML data into a particular application of XML known as RDF/XML, the official transfer syntax, or serialization format, for RDF (according to the W3C, the organization responsible for the RDF specification). The source XML vocabulary in the tutorial is the bib.xml sample bibliography that's part of the Use Cases document that ships with the XQuery specification (see Resources for more information).

In discussing how to use XQuery to make this transformation, the tutorial looks at a number of XQuery's syntactic features. These are stock-standard XQuery mechanisms that are useful for working with XML transformations in general, not just in the present application. The mechanisms I'll show you include:

  • Constructing elements (both directly and computationally)
  • Accessing element text content
  • Accessing attribute text content
  • Using FLWOR expressions to iterate through node sequences
  • Using the built-in doc() function to access XML tree content
  • Using user-defined functions
  • Using well-known and explicitly-declared namespaces

1 of 8 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=XML
ArticleID=138524
TutorialTitle=Use XQuery to transform XML to RDF
publish-date=09272004
author1-email=howardk@fatdog.com
author1-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.