We can also control prefixes of RDF files with the use
of Jena API for RDF. In RDF file there are two ways for Controlling RDF
First is explicit prefix controlling and second is implicit prefix definition controlling. Here we have created prefix definitions with the explicit prefix definitions.
We have created one resource "root" with one property. To create resources we have to use createResource() method of Model interface. To add property in this model we have used createProperty() method of Model interface.
Above lines of code creates an object of Model interface and then we have created two resources first is root and second is child and then we have added these with the Model interface method add().
model.add(root,property,child) adds resources to the graph model. Following is the full source code of RDFPrefix.java.
To run this example :
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial