You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "df.santamaria87" <df...@gmail.com> on 2015/09/25 11:34:40 UTC

Pellet and Jena Querying Label Problem

Dear all,

I have a problem querying labels in Jena with Pellet reasoner.
The ontologies I'm using were populated with OWL-API and Pellet. Now I
would ask for some labels. So I write:

KnowledgeBase kb = reasoner.getKB();
PelletInfGraph graph = new
org.mindswap.pellet.jena.PelletReasoner().bind( kb );

InfModel model = ModelFactory.createInfModel( graph );
Query q = QueryFactory.create(query);
QueryExecution qe = QueryExecutionFactory.create( q, model );
ResultSet rs = qe.execSelect();	

The query simple asks for labels:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?subject ?object
	WHERE { ?subject rdfs:label ?object }

I get no result. I tried the query in Protegè with the same ontologies
and it works properly. Other queries work, the problem is limited to
labels . So, what I'm missing in the code ?
Cheers,
Daniele

Re: Pellet and Jena Querying Label Problem

Posted by "df.santamaria87" <df...@gmail.com>.
The Jena version is 2.10.11. I have crossposted in Pellet usergroup.
Thank you.
Il 26/09/2015 13:17, Dave Reynolds ha scritto:
> Hi,
>
> You didn't answer whether this is jena2 or jena3. If jena3 then try
> again with jena 2.13.0.
>
> Apart from that it really looks like a question for the pellet folks.
>
> Dave
>
> On 25/09/2015 18:08, df.santamaria87 wrote:
> > Hello,
> > The KB is not empty,I can perform query and  get response propertly,
> > the problem only involves labels. The problem seems to appear only in
> > the integration with Pellet. I used the version provided by
> >
> >   <dependency>
> >      <groupId>net.sourceforge.owlapi</groupId>
> >      <artifactId>pellet-profiler-ignazio1977</artifactId>
> >      <version>2.4.0-ignazio1977</version>
> >   </dependency>
> >
> > Cheers.
> >
> > Il 25/09/2015 18:19, Dave Reynolds ha scritto:
> >> On 25/09/15 10:34, df.santamaria87 wrote:
> >>> Dear all,
> >>>
> >>> I have a problem querying labels in Jena with Pellet reasoner.
> >>> The ontologies I'm using were populated with OWL-API and Pellet. Now I
> >>> would ask for some labels. So I write:
> >>>
> >>> KnowledgeBase kb = reasoner.getKB();
> >>> PelletInfGraph graph = new
> >>> org.mindswap.pellet.jena.PelletReasoner().bind( kb );
> >>>
> >>> InfModel model = ModelFactory.createInfModel( graph );
> >>> Query q = QueryFactory.create(query);
> >>> QueryExecution qe = QueryExecutionFactory.create( q, model );
> >>> ResultSet rs = qe.execSelect();
> >>>
> >>> The query simple asks for labels:
> >>>
> >>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> >>> SELECT ?subject ?object
> >>>      WHERE { ?subject rdfs:label ?object }
> >>>
> >>> I get no result. I tried the query in Protegè with the same ontologies
> >>> and it works properly. Other queries work, the problem is limited to
> >>> labels . So, what I'm missing in the code ?
> >>
> >> I'm not familiar with the Pellet API but don't see where you are loading
> >> the data. Does kb have anything in it?  If you do kb.find(Node.ANY,
> >> Node.ANY, Node.Any) and iterate over the first few triples is there
> >> anything there?
> >>
> >> If you load the same ontology into a plain model and run the query does
> >> it work?
> >>
> >> If so then it sounds like a question for the Pellet folks.
> >>
> >> If you are using jena 3 then there may be incompatibilities with Pellet
> >> due to the RDF 1.1 changes to how strings are handled.
> >>
> >> Dave
> >>
> >>
> >
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com
>


Re: Pellet and Jena Querying Label Problem

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

You didn't answer whether this is jena2 or jena3. If jena3 then try 
again with jena 2.13.0.

Apart from that it really looks like a question for the pellet folks.

Dave

On 25/09/2015 18:08, df.santamaria87 wrote:
> Hello,
> The KB is not empty,I can perform query and  get response propertly, the problem only involves labels. The problem seems to appear only in the integration with Pellet. I used the version provided by
>
>   <dependency>
>      <groupId>net.sourceforge.owlapi</groupId>
>      <artifactId>pellet-profiler-ignazio1977</artifactId>
>      <version>2.4.0-ignazio1977</version>
>   </dependency>
>
> Cheers.
>
> Il 25/09/2015 18:19, Dave Reynolds ha scritto:
>> On 25/09/15 10:34, df.santamaria87 wrote:
>>> Dear all,
>>>
>>> I have a problem querying labels in Jena with Pellet reasoner.
>>> The ontologies I'm using were populated with OWL-API and Pellet. Now I
>>> would ask for some labels. So I write:
>>>
>>> KnowledgeBase kb = reasoner.getKB();
>>> PelletInfGraph graph = new
>>> org.mindswap.pellet.jena.PelletReasoner().bind( kb );
>>>
>>> InfModel model = ModelFactory.createInfModel( graph );
>>> Query q = QueryFactory.create(query);
>>> QueryExecution qe = QueryExecutionFactory.create( q, model );
>>> ResultSet rs = qe.execSelect();
>>>
>>> The query simple asks for labels:
>>>
>>> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>>> SELECT ?subject ?object
>>>      WHERE { ?subject rdfs:label ?object }
>>>
>>> I get no result. I tried the query in Protegè with the same ontologies
>>> and it works properly. Other queries work, the problem is limited to
>>> labels . So, what I'm missing in the code ?
>>
>> I'm not familiar with the Pellet API but don't see where you are loading
>> the data. Does kb have anything in it?  If you do kb.find(Node.ANY,
>> Node.ANY, Node.Any) and iterate over the first few triples is there
>> anything there?
>>
>> If you load the same ontology into a plain model and run the query does
>> it work?
>>
>> If so then it sounds like a question for the Pellet folks.
>>
>> If you are using jena 3 then there may be incompatibilities with Pellet
>> due to the RDF 1.1 changes to how strings are handled.
>>
>> Dave
>>
>>
>


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com


Re: Pellet and Jena Querying Label Problem

Posted by "df.santamaria87" <df...@gmail.com>.
Hello,
The KB is not empty,I can perform query and  get response propertly, the problem only involves labels. The problem seems to appear only in the integration with Pellet. I used the version provided by

 <dependency>
    <groupId>net.sourceforge.owlapi</groupId>
    <artifactId>pellet-profiler-ignazio1977</artifactId>
    <version>2.4.0-ignazio1977</version>
 </dependency>

Cheers.

Il 25/09/2015 18:19, Dave Reynolds ha scritto:
> On 25/09/15 10:34, df.santamaria87 wrote:
> > Dear all,
> >
> > I have a problem querying labels in Jena with Pellet reasoner.
> > The ontologies I'm using were populated with OWL-API and Pellet. Now I
> > would ask for some labels. So I write:
> >
> > KnowledgeBase kb = reasoner.getKB();
> > PelletInfGraph graph = new
> > org.mindswap.pellet.jena.PelletReasoner().bind( kb );
> >
> > InfModel model = ModelFactory.createInfModel( graph );
> > Query q = QueryFactory.create(query);
> > QueryExecution qe = QueryExecutionFactory.create( q, model );
> > ResultSet rs = qe.execSelect();   
> >
> > The query simple asks for labels:
> >
> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> > SELECT ?subject ?object
> >     WHERE { ?subject rdfs:label ?object }
> >
> > I get no result. I tried the query in Protegè with the same ontologies
> > and it works properly. Other queries work, the problem is limited to
> > labels . So, what I'm missing in the code ?
>
> I'm not familiar with the Pellet API but don't see where you are loading
> the data. Does kb have anything in it?  If you do kb.find(Node.ANY,
> Node.ANY, Node.Any) and iterate over the first few triples is there
> anything there?
>
> If you load the same ontology into a plain model and run the query does
> it work?
>
> If so then it sounds like a question for the Pellet folks.
>
> If you are using jena 3 then there may be incompatibilities with Pellet
> due to the RDF 1.1 changes to how strings are handled.
>
> Dave
>
>


Re: Pellet and Jena Querying Label Problem

Posted by Dave Reynolds <da...@gmail.com>.
On 25/09/15 10:34, df.santamaria87 wrote:
> Dear all,
>
> I have a problem querying labels in Jena with Pellet reasoner.
> The ontologies I'm using were populated with OWL-API and Pellet. Now I
> would ask for some labels. So I write:
>
> KnowledgeBase kb = reasoner.getKB();
> PelletInfGraph graph = new
> org.mindswap.pellet.jena.PelletReasoner().bind( kb );
>
> InfModel model = ModelFactory.createInfModel( graph );
> Query q = QueryFactory.create(query);
> QueryExecution qe = QueryExecutionFactory.create( q, model );
> ResultSet rs = qe.execSelect();	
>
> The query simple asks for labels:
>
> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
> SELECT ?subject ?object
> 	WHERE { ?subject rdfs:label ?object }
>
> I get no result. I tried the query in Protegè with the same ontologies
> and it works properly. Other queries work, the problem is limited to
> labels . So, what I'm missing in the code ?

I'm not familiar with the Pellet API but don't see where you are loading 
the data. Does kb have anything in it?  If you do kb.find(Node.ANY, 
Node.ANY, Node.Any) and iterate over the first few triples is there 
anything there?

If you load the same ontology into a plain model and run the query does 
it work?

If so then it sounds like a question for the Pellet folks.

If you are using jena 3 then there may be incompatibilities with Pellet 
due to the RDF 1.1 changes to how strings are handled.

Dave