You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Tran Thai Binh <th...@gmail.com> on 2011/12/02 17:02:02 UTC

Pellet run too slow

Dear all,

I create a RDF file, I have class HighResolution with definition like :

RasterBased
 and (hasSensor some
    (Sensor
     and (hasResolutionValue some float[> 2.5f , <= 10.0f])))
-----
-----

I write a code in Jena

----
----
package query;

import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryExecution;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFormatter;
import com.hp.hpl.jena.rdf.model.ModelFactory;

public class query {

    public static void main(String[] args) {

        OntModel model = ModelFactory.createOntologyModel(
org.mindswap.pellet.jena.PelletReasonerFactory.THE_SPEC, null);
        model.read("file:ModelJena.rdf");

        model.prepare();

        String queryString =
            "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
            "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+
            "PREFIX test: <
http://www.semanticweb.org/ontologies/2011/4/DataDomain.owl#>"+
            "select ?data " +
            "where { "+
            "}";

        System.out.println(queryString);

            Query query = QueryFactory.create(queryString);

            // Execute the query and obtain results
            QueryExecution qe = QueryExecutionFactory.create(query, model);
            ResultSet results = qe.execSelect();

            // Output query results
            ResultSetFormatter.out(System.out, results, query);

            qe.close();
            System.out.println("----------------------");


    }
}

----
----

When I query with predefine class like

select ?data
where ?data a test:HighResolution

Jena run 20 minutes and it looks like can not finish. But it can return
correct result quite fast with


select ?data
where ?data test:hasSensor ?sensor.
          ?sensor test:hasResolutionValue ?resolution.
          FILTER ((?resolution > 2.5) && (?resolution <= 10))

It is very strange. Could anybody explant to me why.

Thank in advance.
Binh



-- 
Trần Thái Bình
GIS and Remote Sensing
thaibinhtran@gmail.com
ttbinh@vast-hcm.ac.vn
Phone: (848) 38247360
mobile:
- Việt Nam -

Re: Pellet run too slow

Posted by Dave Reynolds <da...@gmail.com>.
I was thinking of: http://owl.cs.manchester.ac.uk/validator/
or the (pre-OWL2) http://www.mygrid.org.uk/OWL/Validator

Pellet itself will do validation but since the original poster's problem
was with configuration of Pellet that seemed like a less good
suggestion.

Typical ontology editing tools like Protege will also do validation via
whatever reasoner then have plugged in.

Dave


On Mon, 2011-12-05 at 09:09 +0100, Mario Kofler wrote: 
> Hello,
> 
> I am curious: can you please give me a hint how i find such an online
> tool, or give me some name so that I can search for it? I just do not
> find
> any online checker.
> 
> Thank you very much,
> 
> Best Regards,
> 
> Mario
> 
> > The first step is to run it through one of the online ontology checkers
> > to make sure it is legal OWL 2 DL and doesn't accidentally include some
> > OWL-fullism.




Re: Pellet run too slow

Posted by Mario Kofler <ma...@gmail.com>.
Hello,

I am curious: can you please give me a hint how i find such an online
tool, or give me some name so that I can search for it? I just do not
find
any online checker.

Thank you very much,

Best Regards,

Mario

> The first step is to run it through one of the online ontology checkers
> to make sure it is legal OWL 2 DL and doesn't accidentally include some
> OWL-fullism.

Re: Pellet run too slow

Posted by Dave Reynolds <da...@gmail.com>.
On Mon, 2011-12-05 at 09:32 +0100, Tran Thai Binh wrote: 
> Hi Dave
> 
> >
> > This goes fast because no reasoning is required. This is the alternative
> > that I suggested to you earlier.
> >
> > I know that it does not run reasoner, but I need predefined classes for
> some complex query. 

Why?

> Do you have any suggestion. 

Have you tried my earlier suggestions? I.e. validate the ontology and
ask for support from the Pellet folks?

Dave



Re: Pellet run too slow

Posted by Tran Thai Binh <th...@gmail.com>.
Hi Dave

>
> This goes fast because no reasoning is required. This is the alternative
> that I suggested to you earlier.
>
> I know that it does not run reasoner, but I need predefined classes for
some complex query. Do you have any suggestion. that can use predefined
classes.

Cheers,
Binh

-- 
Trần Thái Bình
GIS and Remote Sensing
thaibinhtran@gmail.com
ttbinh@vast-hcm.ac.vn
Phone: (848) 38247360
mobile:
- Việt Nam -

Re: Pellet run too slow

Posted by Dave Reynolds <da...@gmail.com>.
Hi,

On Fri, 2011-12-02 at 17:02 +0100, Tran Thai Binh wrote: 
> Dear all,
> 
> I create a RDF file, I have class HighResolution with definition like :
> 
> RasterBased
>  and (hasSensor some
>     (Sensor
>      and (hasResolutionValue some float[> 2.5f , <= 10.0f])))
> -----
> -----
> 
> I write a code in Jena
> 
> ----
> ----
> package query;
> 
> import com.hp.hpl.jena.ontology.OntModel;
> import com.hp.hpl.jena.query.Query;
> import com.hp.hpl.jena.query.QueryExecution;
> import com.hp.hpl.jena.query.QueryExecutionFactory;
> import com.hp.hpl.jena.query.QueryFactory;
> import com.hp.hpl.jena.query.ResultSet;
> import com.hp.hpl.jena.query.ResultSetFormatter;
> import com.hp.hpl.jena.rdf.model.ModelFactory;
> 
> public class query {
> 
>     public static void main(String[] args) {
> 
>         OntModel model = ModelFactory.createOntologyModel(
> org.mindswap.pellet.jena.PelletReasonerFactory.THE_SPEC, null);
>         model.read("file:ModelJena.rdf");
> 
>         model.prepare();
> 
>         String queryString =
>             "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+
>             "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"+
>             "PREFIX test: <
> http://www.semanticweb.org/ontologies/2011/4/DataDomain.owl#>"+
>             "select ?data " +
>             "where { "+
>             "}";
> 
>         System.out.println(queryString);
> 
>             Query query = QueryFactory.create(queryString);
> 
>             // Execute the query and obtain results
>             QueryExecution qe = QueryExecutionFactory.create(query, model);
>             ResultSet results = qe.execSelect();
> 
>             // Output query results
>             ResultSetFormatter.out(System.out, results, query);
> 
>             qe.close();
>             System.out.println("----------------------");
> 
> 
>     }
> }
> 
> ----
> ----
> 
> When I query with predefine class like
> 
> select ?data
> where ?data a test:HighResolution
> 
> Jena run 20 minutes and it looks like can not finish. But it can return
> correct result quite fast with
> 
> 
> select ?data
> where ?data test:hasSensor ?sensor.
>           ?sensor test:hasResolutionValue ?resolution.
>           FILTER ((?resolution > 2.5) && (?resolution <= 10))

This goes fast because no reasoning is required. This is the alternative
that I suggested to you earlier.

> 
> It is very strange. Could anybody explant to me why.
> 
> Thank in advance.

The code looks reasonable.

It may be that there is some problem with your ontology.

The first step is to run it through one of the online ontology checkers
to make sure it is legal OWL 2 DL and doesn't accidentally include some
OWL-fullism.

If it is legal OWL 2 DL then either it is using some expensive OWL 2
features or perhaps it has hit some corner case with Pellet. For support
on that you would need to ask on the Pellet list.

Dave