*When I run this program without writing it to the file, it runs smoothly.
But when I copy it to a file (both newly created and existing file),
sometime it adds the garbage claases to the file like Seq, Bag, Resource
and most of the time it does nothing except it empties the destination
file.*
*I have copied the whole code except the code auto generated by netbeans*
*public class NewJFrame extends javax.swing.JFrame {*
* public static void readOntology(String file,OntModel model)*
* {*
* InputStream in =FileManager.get().open(file);*
*if (in==null) {*
*throw new IllegalArgumentException( "File: " + file + " not found");*
*}*
* model.read(in,null);*
* //in.close();}}*
private void read1(String str, OntModel model)
{
String ns="
http://www.semanticweb.org/ontologies/untitled-ontology-54/";
OntClass user = model.createClass(ns + "User");
OntClass user1 = model.getOntClass(ns + "User");
Individual janeSmith = user1.createIndividual(ns + str)
try {
String file="F://newontology.owl";
FileOutputStream f1=new FileOutputStream(file);
RDFWriter d = model.getWriter("RDF/XML-ABBREV");
d.write(model,f1,null);
}catch(Exception e) {}
*private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
*
*OntModel model=ModelFactory.createOntologyModel();*
* String str=jTextField2.getText()*
* read1(str, model); }}*
* public static void main(String args[]) {*
* OntModel model = ModelFactory.createOntologyModel();*
* String file="F://updated.owl";*
* readOntology(file , model );*
*}*