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:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.