The problem is that you still did not learn enough about RDF, OWL and SPARQL...
If you create a resource with JENA, what do you think is it? An individual, a class, a property? JENA, and I'm talking here about the methods you used, creates RDF, not OWL. Protege on the other hand reads and works on OWL ontologies(ok, it also supports OBO, but that's another topic). Please read the tutorial [1] about JENA and OWL, then I think you will make it [1] https://jena.apache.org/documentation/ontology/ Kind regards, Lorenz > After executing this code, I can not find the resource (Ranjani) in my > Protege owl file. Where is the mistake in code? > > > > > public class rdffile { > public static void main(String[] args) throws IOException { > > String ns = " > http://www.semanticweb.org/ontologies/2016/7/my-ontology-54#Ranjani"; > > > > Model model=ModelFactory.createDefaultModel(); > InputStream in = FileManager.get().open("C:/User/Desktop/first.owl"); > if (in==null) { > throw new IllegalArgumentException( > "File: " + " not found "); > } > model.read(in, ""); > > > Resource ranjani = model.createResource(ns+"Ranjani"); > > String ss= "C:/Users/Desktop/first.owl"; > FileWriter out = new FileWriter( ss ); > > model.write(out, "RDF/XML-ABBREV"); > -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center
