You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Stian Soiland-Reyes (JIRA)" <ji...@apache.org> on 2015/09/20 22:28:04 UTC

[jira] [Resolved] (JENA-1026) listIndividuals (and listClasses) performance issue

     [ https://issues.apache.org/jira/browse/JENA-1026?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stian Soiland-Reyes resolved JENA-1026.
---------------------------------------
    Resolution: Not A Problem

> listIndividuals (and listClasses) performance issue
> ---------------------------------------------------
>
>                 Key: JENA-1026
>                 URL: https://issues.apache.org/jira/browse/JENA-1026
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Ontology API
>    Affects Versions: Jena 3.0.0
>         Environment: Verified on Jena 3.0.1-SNAPSHOT (2015-09-13) w/ Ubuntu 14.04/x64, 4 cores i7-3520M, 16G ram, SSD disk, Open JDK 1.8.0_45-internal
>            Reporter: Stian Soiland-Reyes
>            Priority: Minor
>         Attachments: OntologiaDeAlimentos.owl, lpb-trace-of-not-much-food.txt, not-much-food.ttl, onto.java
>
>
> As [reported by Maria Clementina Latanzi|http://mail-archives.apache.org/mod_mbox/jena-dev/201509.mbox/%3CCAMOD-YqMEmXqTGnHCEinZb9DSruOnhhDZxXUU%2BvX1m_0%3DKJnEg%40mail.gmail.com%3E] on dev@jena 2015-09-12:
> {quote}
> 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.
> {quote}
> {code}
> 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/OntologiasArchivosOntologiaDeAlimentos.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));
>     }
> }
> {code}
> See attached ontology and test case.
> Verified against current 3.0.1-SNAPSHOT.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)