Jena have provided the methods which can read and write RDF files. RDF stands for Resource Description Framework that is used to represents the maximum information of resources available in the World Wide Web.
This example includes everything that you need to create an application that writes RDF or Resource Description Framework file in Java. The example illustrates you how to write a RDF/XML files with separate source code and examples. With the help of the given example, we have tried to simplify this concept to you to learn it quickly and concentrate on the actual part that RDF.
Guideline and example code to develop RDF file in Java
"createDefaultModel()" method of ModelFactory returns an object of Model interface.
Above lines of code creates an object of Model interface and creates resource object and then we can add different properties to this node. To write this model we have used write(java.io.OutputStream out) method of Model interface.
To run this example you have to follow these following steps:
You will have "amitkumar.xml" in your bin folder and content of this xml file will look this:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: September 27, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles