In this example we are going to generate our first RDF( Resource Description File). This example generates a RDF file with the use of "Jena". Jena is a java API to create and manipulate RDF graphs.
To create RDF file we do need to import following packages:
To create model we have used createDefaultModel() of ModelFactory, which in turn returns an object of Model interface.
Model model = ModelFactory.createDefaultModel();
To create resource we have used createResource() method of Model interface. Now we can add properties in this model resource by using the "addProperty()" method.
To run the example you have to follow these steps:
You will get following output on your command prompt.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial