This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes reading value from an RDF file into a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "reading value from an RDF file into a servlet" Watch "reading value from an RDF file into a servlet" New topic
Author

reading value from an RDF file into a servlet

vijayalakshmi raghavan
Greenhorn

Joined: Mar 25, 2012
Posts: 5
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Mar 25, 2012
Posts: 5
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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

Joined: Mar 25, 2012
Posts: 5
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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
Bartender

Joined: May 31, 2011
Posts: 1776
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

Joined: Mar 25, 2012
Posts: 5
I am storing it using the JENA API. Its very simple to use.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reading value from an RDF file into a servlet
 
Similar Threads
namespaces, rdf and forEach
find a word in a text and take a part of a text
How to display RSS in jsp?
A Beginner's Question
schema and namespaces