0

I posted other questions about this problem...But I think that I'm near the solution. I have this code that works ONLY with the loading of "dbpedia.owl". The problem appears when I add the other ontology "yago.nt"...I have "java.lang.OutOfMemoryError: Java heap space" like error...I tried to modified the Xmx value ( I increased it to 2048m)..But I have no result..I don't know what I have to do...Help me please..If you know how to use TDB , could you post the code applied to my code?

    OntModel ont=ModelFactory.createOntologyModel();
    InputStream in=FileManager.get().open("dbpedia.owl");
    InputStream i =FileManager.get().open("yago.nt");  
    ont.read(in,""); 
    Model schemaModel = FileManager.get().loadModel("yago.nt");
    ont.add(schemaModel); // <---THE ERROR IS HERE

    Reasoner r = ReasonerRegistry.getOWLReasoner();
    r=r.bindSchema(ont);
    OntModelSpec p= OntModelSpec.OWL_DL_MEM;
    p.setReasoner(r);

    OntModel model=ModelFactory.createOntologyModel(p,ont);
    ExtendedIterator s=model.listClasses();

    while (s.hasNext())
    {
    OntClass thisClass = (OntClass) s.next();
    System.out.println("Found class: " + thisClass.toString());
    }
user2837896
  • 271
  • 3
  • 11

1 Answers1

0

You can read directly into the database by using a TD dataset and getNamedModel.

But sine you are then setting up a persistent database, why not just do:

tdbloader --loc=DB dbpedia.owl yago.nt

(if .owl gives you problems, convert to NT first or use TDB 0.10.X).

AndyS
  • 16,345
  • 17
  • 21