[ 
https://issues.apache.org/jira/browse/JENA-1026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14742315#comment-14742315
 ] 

Stian Soiland-Reyes commented on JENA-1026:
-------------------------------------------

If I understand this correctly, all OWL understanding in Jena is done by the 
rule engines. No matter which engine you choose, it is still effectively 
running a second programming language in interpreter mode, and therefore you 
get a big performance hit compared to explicit Java code run on the JVM to deal 
with OWL constructs, e.g. to determine of something is a class or property, etc.

Now my question is why this hits listIndividuals() so hard, and not 
listClasses. If you try to actually iterate through the classes (e.g. 
classes.toList() )  you will find this will run all the rules and also take 
about 20 seconds.

20 seconds to iterate over an ontology of 4 classes is obviously not ideal - we 
might want to reconsider the role of the rule system as opposed to hard-coded 
rules in Java. This could be part of adding support for OWL 2 (JENA-80)


> listIndividuals performance issue
> ---------------------------------
>
>                 Key: JENA-1026
>                 URL: https://issues.apache.org/jira/browse/JENA-1026
>             Project: Apache Jena
>          Issue Type: Bug
>          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
>
>
> As reported by Maria Clementina Latanzi 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/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));
>       }
> }
> {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)

Reply via email to