This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading value from an RDF file into a servlet

 
vijayalakshmi raghavan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is my RDF file structure.



I want to write a piece of java code that can
* read the value of into a model inside a java program.

How should I do this??

I am a newbie. So, please help!!
 
Tim Moores
Bartender
Posts: 2745
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any XML API should do; if it's just that one element I'd probably go for XPath. The http://www.coderanch.com/how-to/java/XmlFaq page links to some introductions on that.

Or you could use a specialized RDF API like Jena.
 
vijayalakshmi raghavan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Jena. I read the following tutorial.

http://jena.sourceforge.net/tutorial/RDF_API/#ch-Jena RDF Packages

But its not very clear and I need specific code for extracting the value from the specific <RDF.subject> and <RDF.object> tags.
 
Tim Moores
Bartender
Posts: 2745
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once you have created a Model (step 4), you'd query it (step 9). Are you familiar with RDF queries?

It seems that using a standard XML API would be easier, though (unless there are other requirements that you haven't mentioned).
 
vijayalakshmi raghavan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried the XML API method... Thats not working too... I am not able to obtain the element's value by this method.
 
Tim Moores
Bartender
Posts: 2745
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want help with that you'll need to tell us what, exactly, you tried, what the result was, and how that differed from what you were expecting.
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijayalakshmi - just curious... how do you save the RDF file? Do you have an RDF Store? If so can you try executing SPARQL queries for your requirement?
 
vijayalakshmi raghavan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am storing it using the JENA API. Its very simple to use.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic