Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 10th, 2008, 02:40 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Convert XML to RDF

Hello,

Does anyone know how to convert from XML to RDF?

I looked for, and I found out that we have to use XSL to convert from XML to RDF.

Any idea about this case?


Thank you
 
Old June 10th, 2008, 03:00 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

RDF is XML so you there maybe no change involved, otherwise you need to show the XML source and how it maps to the RDF you need.

--

Joe (Microsoft MVP - XML)
 
Old June 10th, 2008, 03:02 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Since RDF is often expressed in XML, one answer might be "do nothing". In fact, the answer is, it depends on the nature of the input XML and the nature of the output RDF that you want to produce. XSLT might well be a suitable language to express the transformation, but your question is a bit like asking "how do I convert data into documents?"

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 10th, 2008, 03:43 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The goal of my purpose actually is to search the "keyword" inside the document using RDF. What I use RDF, because by using RDF, the searching will be more semantically/more specific.

I know, RDF is similar like XML. But, I think RDF syntax is predefined and XML is not.

I read in w3schools.com, it just explain how to change from XML to XHTML/HTML...

Here is my XML:
<form>
<description>
  <desc_id>048/26/SMD/HRD/9/00</desc_id>
  <title>Kebijakan2</title>
  <dates>3/21/1999</dates>
  <author>Smart Co</author>
  <file_name>Policy2</file_name>
  <type>pdf</type>
  <category>memorandum</category>
  <sub_cat1>tidak_berlaku</sub_cat1>
  <sub_cat2>1983</sub_cat2>
  </description>
</form>


 
Old June 10th, 2008, 03:51 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You seem a little confused in your terminology here.

XML is a data format that defines how a document can be written.

RDF is a specific type of document, written in XML, that must follow other rules.

So you are trying to transform one XML document format into another XML document format.

We don't know RDF off the top of our heads, so if you have your input document above, what do you want your output document to look like.

/- Sam Judson : Wrox Technical Editor -/
 
Old June 10th, 2008, 04:05 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

RDF may be designed to capture rich semantics, but if you create it automatically from something else, there's no way that what you generate will have more semantic content than what you started with.

I would say you're much better off querying the original XML.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 10th, 2008, 05:33 AM
Authorized User
 
Join Date: Jun 2008
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So, what is the conclusion? I feel confuse. Does actually any possibilities to change from XML to RDF?

I have already create the XML file... This is my thesis topic for bachelor. And I can not change the title anymore. The title is"Implementation information Retrieval using RDF" So, I must use RDF.


 
Old June 10th, 2008, 05:38 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

As RDF IS XML then yes, it is perfectly possible to convert your XML document above into RDF.

However as I said - we don't know RDF, so if you want any help at all in writing an XSLT stylsheet to perform the transformation you will have to show us what you want the output (i.e. your RDF document) to look like.

/- Sam Judson : Wrox Technical Editor -/
 
Old June 10th, 2008, 05:45 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

>I have already create the XML file... This is my thesis topic for bachelor. And I can not change the title anymore. The title is"Implementation information Retrieval using RDF" So, I must use RDF.

Wonderful! If it's any consolation, similar things happen in commercial projects all the time. The requirements for the project say that it will use a relational database (or even a specific vendor's product!), so it ends up using one, despite mounting evidence during the design phase that better solutions are available. It's a very bad idea to commit to particular technologies too early; and a good project title would describe the objectives (=benefits to users), not the means of achieving them.

Well, if you want to do a project using RDF, go ahead. You'll find plenty of enthusiasts for it - but not here! So far, you haven't given a justification for using RDF that I would accept as valid.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old July 1st, 2008, 11:05 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Here is a hope valid reason to justify why someone need to do that (convert XML to RDF). I have all the data (obviously) available in XML. However, I build an ontology in Protege and I need to test it on real data. Protege uses OWL (ie RDF as I understand). Thus I have to convert the data into RDF format to actually import the ontology into it afterwards.

I realize your patriotic feelings and liability to XML, however there are cases when such conversion it has to be done (unless someone suggest something smarter). Your reply sounds like you know how to do it but not willing to help because there is no "a justification for using RDF that I would accept as valid" for you. So, please, Mr Michael Kay, if you can help, please do. Anyone else is also welcome.
Thank you for your help.





Similar Threads
Thread Thread Starter Forum Replies Last Post
The advantage of XML rather than RDF deean XML 2 June 17th, 2008 01:20 PM
Convert 1 big XML to multiple smaller XML victorcorey XSLT 1 March 20th, 2008 05:59 AM
Convert XML to XML template question bonekrusher XSLT 3 July 12th, 2007 07:47 AM
convert XML to XMl - Another Namespace question bonekrusher XSLT 2 July 10th, 2007 07:32 AM
Trouble reading RDF einarhansen Classic ASP XML 0 November 25th, 2003 03:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.