I am trying to create individuals and save them in OWL file. The OWL file was created in Protégé. The size of the file was 10KB but after trying to save the individuals in the ontology the size of the code becomes 7KB.
Then I tried to open the OWL file using Protégé but it will not open.
The code is:
String SOURCE = "http://www.semanticweb.org/ontologies/2012/9/untitled-ontology-19";
String NS = SOURCE + "#";
OntModel onto = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
onto.read("file:/home/tourism.owl", "RDF/XML");
OntClass place = onto.getOntClass(NS+"Mountains");
Individual am1 = onto.createIndividual(NS+Concept1, place);
FileOutputStream output = null;
try {
output = new FileOutputStream( "/home/tourism.owl ");
} catch(Exception e) {}
onto.writeAll(output, "RDF/XML-ABBREV","xmlbase");