As you have already learned about controlling prefix, generating RDF files and about RDF Iterators in the previous examples, so in this section we are going to describe how to run simple query on the RDF graph model. Now lets see the example that can fires a simple query. The example is going to list the subject with property name "VCARD.FN".
To do this we have taken an object of Model interface. By the use of listSubjectsWithProperty() method we have queried about VCARD.FN . It returns an object of ResIterator (i.e ResourceIterator).
"Resource res = iter.nextResource();"
Above line of code gets all the resources of that particular Subject. Now we can get property and other information's of that resource.
getProperty() gets property of that resource.
getURI() will gets URI of that resource.
To run this example follow these steps:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial