Hi, thanks for the brilliantly reproducible bug report! I don't consider your ontology particularly big nor complicated (although it has 6 equivalent class declarations) , so I think this could be a bug in Jena.
I have recorded this in the Jena bug tracker as JENA-1026 https://issues.apache.org/jira/browse/JENA-1026 I hope it's OK to share your ontology for testing. (Y ahora quiero un poco mas comida! :)) I get similar execution time for listIndividuals at about 20 seconds, but sometimes about 8 seconds. I guess this depends on the hardware and Java version - and other OS load. I got the runtime down to 8 seconds by closing Firefox.. :) I'll report my further investigation under the thread for JENA-1026. On 12 September 2015 at 19:33, Maria Clementina Latanzi <[email protected]> wrote: > Hi all, > > I'm working with Jena. I have an ontology with no more than 50 individuals, > and I use Jena to > get individuals from Ontology by calling listIndividual > (com.hp.hpl.jena.ontology.OntModel.listIndividuals). When I call this > method, it's taking a lot of time up to 20 seconds. When debugging, it takes > more than 1 minute to return. Other methods like listClass return instantly. > > I found a stackoverflow question relevant to my problem but there was no > answer. This makes me think that the problem might be general for other > people and not just an issue with my ontology. Here's the link: > > http://stackoverflow.com/questions/27645110/method-listindividual-takes-more-than-15-mins-with-dbpedia-2014-owl-2mb-siz# > > I'm wondering if you could help me figure out why does it take so long to > run. Any ideas? Is this normal and expected behavior because of the size of > the ontology? > > Here's the code, and I attach the owl file. > > Thanks for the help! > > package testOnto; > > import java.io.InputStream; > > import java.util.ArrayList; > > import java.util.Iterator; > > import com.hp.hpl.jena.ontology.Individual; > > import com.hp.hpl.jena.ontology.OntClass; > > import com.hp.hpl.jena.ontology.OntModel; > > import com.hp.hpl.jena.rdf.model.ModelFactory; > > import com.hp.hpl.jena.rdf.model.Resource; > > import com.hp.hpl.jena.rdf.model.Property; > > import com.hp.hpl.jena.rdf.model.StmtIterator; > > import com.hp.hpl.jena.rdf.model.impl.StatementImpl; > > import com.hp.hpl.jena.shared.JenaException; > > import com.hp.hpl.jena.util.FileManager; > > import com.hp.hpl.jena.util.iterator.ExtendedIterator; > > public class onto { > > static String Ontofile = > "C:/Users/Sig/Clemen/OntologiasArchivos/OntologiaIngesta.owl"; > > public static void main(String[] args) { > > //crea ontologia > > OntModel m = ModelFactory.createOntologyModel(); > > try { > > InputStream in = > FileManager.get().open("C:/Users/Sig/Clemen/OntologiasArchivos/OntologiaDeAlimentos.owl"); > > if (in ==null) { > > System.out.println("ERROR abriendo archivo" + Ontofile); > > return; > > } > > else { m.read(in, "RDF/XML"); > > System.out.println("archivo" + Ontofile + "leido > exitosamente" ); > > } > > } catch (JenaException je) { > > System.out.println("ERROR leyendo archivo" + je.getMessage()); > > je.printStackTrace(); > > System.exit(0); > > } > > > > long startMilC = System.currentTimeMillis(); > > System.out.println("Start list classes: " + startMilC); > > ExtendedIterator classes = m.listClasses(); > > long endMilC = System.currentTimeMillis(); > > System.out.println("Duration ListIndividuals: " + (endMilC - > startMilC)); > > > > long startMil = System.currentTimeMillis(); > > System.out.println("Start ListIndividuals: " + startMil); > > ExtendedIterator individuos = m.listIndividuals(); > > > > long endMil = System.currentTimeMillis(); > > System.out.println("Duration ListIndividuals: " + (endMil - > startMil)); > > } > > } -- Stian Soiland-Reyes Apache Taverna (incubating), Apache Commons RDF (incubating) http://orcid.org/0000-0001-9842-9718
