You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Olivier Rossel <ol...@gmail.com> on 2012/08/01 18:35:30 UTC

Limiting the sub-SELECT of a CONSTRUCT

Hi jena-users (and Steve :)

I am sending this query to my 4store 1.1.4:
CONSTRUCT
{ ?Anl0 <http://data.bnf.fr/ontologie/hasExpression> ?Expression1 .
?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl> }
WHERE
{ SERVICE <http://royale.zerezo.com:6666/sparql/> {

{SELECT * WHERE {?Anl0 <http://data.bnf.fr/ontologie/hasExpression>
?Expression1 FILTER ( (!isLiteral(?Expression1)) || lang( ?Expression1
)="" || lang( ?Expression1 )="en"  )  .
 ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl>} LIMIT 1}

}} LIMIT 300

I should get much fewer results than what I get (because of the LIMIT
1 in the sub-SELECT).
I use Jena (with Syntax.syntaxSPARQL_11) as my client lib. And 4store
1.1.4 as my server.
And I wonder whether I have to blame Jena or 4store (or me :)

Any opinion, fellows?

Re: Limiting the sub-SELECT of a CONSTRUCT

Posted by Olivier Rossel <ol...@gmail.com>.
> Why not remove the SERVICE and send a CONSTRUCT to
> http://royale.zerezo.com:6666/sparql/ directly?

My next step is to federate several SERVICEs, and tune the
orderBy/limit/offset differently for each SERVICE block .

Does it sound possible/logical to you?

Re: Limiting the sub-SELECT of a CONSTRUCT

Posted by Andy Seaborne <an...@apache.org>.
On 01/08/12 17:35, Olivier Rossel wrote:
> Hi jena-users (and Steve :)
>
> I am sending this query to my 4store 1.1.4:
> CONSTRUCT
> { ?Anl0 <http://data.bnf.fr/ontologie/hasExpression> ?Expression1 .
> ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl> }
> WHERE
> { SERVICE <http://royale.zerezo.com:6666/sparql/> {
>
> {SELECT * WHERE {?Anl0 <http://data.bnf.fr/ontologie/hasExpression>
> ?Expression1 FILTER ( (!isLiteral(?Expression1)) || lang( ?Expression1
> )="" || lang( ?Expression1 )="en"  )  .
>   ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl>} LIMIT 1}
>
> }} LIMIT 300
>
> I should get much fewer results than what I get (because of the LIMIT
> 1 in the sub-SELECT).
> I use Jena (with Syntax.syntaxSPARQL_11) as my client lib. And 4store
> 1.1.4 as my server.
> And I wonder whether I have to blame Jena or 4store (or me :)

If you are sending that whole query to 4Store, it's not the client library.

(But you are probably not.)

Why not remove the SERVICE and send a CONSTRUCT to 
http://royale.zerezo.com:6666/sparql/ directly?

>
> Any opinion, fellows?
>


	Andy



RE: Transitivity

Posted by David Jordan <Da...@sas.com>.
So use of + is the syntax. Does this also address the ordering?

-----Original Message-----
From: Cong Wang [mailto:joshua.cong@gmail.com] 
Sent: Friday, August 03, 2012 9:47 AM
To: users@jena.apache.org
Subject: Re: Transitivity

First, you can try ?x predicate + ?y …  For example, select * where { ?x owl:sameAs+ ?y .}    

otherwise, i believe you can use OWL syntax, say predicate is transitive, then use whatever reasoner to do inference first. then query   

--
Cong Wang
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, August 3, 2012 at 2:32 PM, David Jordan wrote:

> Of course that reasoning needs to occur to compute the transitivity. 
> That would result in triples containing A Predicate B B Predicate C C 
> Predicate D
>  
> But I think the question is how that set of triples could get returned 
> as A B C
>  
> I'd be very interested in understanding how to do this also.
>  
> -----Original Message-----
> From: Cong Wang [mailto:joshua.cong@gmail.com]
> Sent: Friday, August 03, 2012 9:13 AM
> To: users@jena.apache.org (mailto:users@jena.apache.org); Anthony 
> Ramalho
> Subject: Re: Transitivity
>  
> why not use reasoner to saturate ontology first? then query…
>  
> --
> Cong Wang
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>  
>  
> On Friday, August 3, 2012 at 1:52 PM, Anthony Ramalho wrote:
>  
> > Hi all,
> >  
> > Does anybody know a way of using the transitivity facet of OWL in a way that we can, for example, perform a query with SPARQL and get a result based on:
> > a -> b -> c -> d
> >  
> > So, querying "a" we get all the others in that order.
> >  
> > Thanks for your help,
> >  
> > Anthony Andrey
> >  
> >  
> >  
>  
>  
>  



Re: Transitivity

Posted by Cong Wang <jo...@gmail.com>.
First, you can try ?x predicate + ?y …  For example, select * where { ?x owl:sameAs+ ?y .}    

otherwise, i believe you can use OWL syntax, say predicate is transitive, then use whatever reasoner to do inference first. then query   

--  
Cong Wang
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, August 3, 2012 at 2:32 PM, David Jordan wrote:

> Of course that reasoning needs to occur to compute the transitivity. That would result in triples containing
> A Predicate B
> B Predicate C
> C Predicate D
>  
> But I think the question is how that set of triples could get returned as
> A
> B
> C
>  
> I'd be very interested in understanding how to do this also.
>  
> -----Original Message-----
> From: Cong Wang [mailto:joshua.cong@gmail.com]  
> Sent: Friday, August 03, 2012 9:13 AM
> To: users@jena.apache.org (mailto:users@jena.apache.org); Anthony Ramalho
> Subject: Re: Transitivity
>  
> why not use reasoner to saturate ontology first? then query…  
>  
> --  
> Cong Wang
> Sent with Sparrow (http://www.sparrowmailapp.com/?sig)
>  
>  
> On Friday, August 3, 2012 at 1:52 PM, Anthony Ramalho wrote:
>  
> > Hi all,
> >  
> > Does anybody know a way of using the transitivity facet of OWL in a way that we can, for example, perform a query with SPARQL and get a result based on:
> > a -> b -> c -> d
> >  
> > So, querying "a" we get all the others in that order.
> >  
> > Thanks for your help,
> >  
> > Anthony Andrey  
> >  
> >  
> >  
>  
>  
>  



RE: Transitivity

Posted by David Jordan <Da...@sas.com>.
Of course that reasoning needs to occur to compute the transitivity. That would result in triples containing
A Predicate B
B Predicate C
C Predicate D

But I think the question is how that set of triples could get returned as
A
B
C

I'd be very interested in understanding how to do this also.

-----Original Message-----
From: Cong Wang [mailto:joshua.cong@gmail.com] 
Sent: Friday, August 03, 2012 9:13 AM
To: users@jena.apache.org; Anthony Ramalho
Subject: Re: Transitivity

why not use reasoner to saturate ontology first? then query…   

--  
Cong Wang
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, August 3, 2012 at 1:52 PM, Anthony Ramalho wrote:

> Hi all,
>   
> Does anybody know a way of using the transitivity facet of OWL in a way that we can, for example, perform a query with SPARQL and get a result based on:
> a -> b -> c -> d
>   
> So, querying "a" we get all the others in that order.
>   
> Thanks for your help,
>   
> Anthony Andrey    
>  
>  



Re: Transitivity

Posted by Cong Wang <jo...@gmail.com>.
why not use reasoner to saturate ontology first? then query…   

--  
Cong Wang
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Friday, August 3, 2012 at 1:52 PM, Anthony Ramalho wrote:

> Hi all,
>   
> Does anybody know a way of using the transitivity facet of OWL in a way that we can, for example, perform a query with SPARQL and get a result based on:
> a -> b -> c -> d
>   
> So, querying "a" we get all the others in that order.
>   
> Thanks for your help,
>   
> Anthony Andrey    
>  
>  



Transitivity

Posted by Anthony Ramalho <an...@yahoo.com>.
Hi all,
 
Does anybody know a way of using the transitivity facet of OWL in a way that we can, for example, perform a query with SPARQL and get a result based on:
a -> b -> c -> d
 
So, querying "a" we get all the others in that order.
 
Thanks for your help,
 
Anthony Andrey   

Re: Limiting the sub-SELECT of a CONSTRUCT

Posted by Andy Seaborne <an...@apache.org>.
On 01/08/12 17:57, Steve Harris wrote:
> 4store supports neither subqueries, nor SERVICE, so I think you can blame that :)
>
> - Steve
>
> On 2012-08-01, at 17:35, Olivier Rossel wrote:
>
>> Hi jena-users (and Steve :)
>>
>> I am sending this query to my 4store 1.1.4:
>> CONSTRUCT
>> { ?Anl0 <http://data.bnf.fr/ontologie/hasExpression> ?Expression1 .
>> ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl> }
>> WHERE
>> { SERVICE <http://royale.zerezo.com:6666/sparql/> {
>>
>> {SELECT * WHERE {?Anl0 <http://data.bnf.fr/ontologie/hasExpression>
>> ?Expression1 FILTER ( (!isLiteral(?Expression1)) || lang( ?Expression1
>> )="" || lang( ?Expression1 )="en"  )  .
>> ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
>> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl>} LIMIT 1}
>>
>> }} LIMIT 300
>>
>> I should get much fewer results than what I get (because of the LIMIT
>> 1 in the sub-SELECT).
>> I use Jena (with Syntax.syntaxSPARQL_11) as my client lib. And 4store
>> 1.1.4 as my server.
>> And I wonder whether I have to blame Jena or 4store (or me :)
>>
>> Any opinion, fellows?
>

So it's the SERVICE part that goes to 4Store ...

What query is received? How long does it take?

SELECT  *
WHERE
{ ?Anl0 <http://data.bnf.fr/ontologie/hasExpression> ?Expression1
   FILTER ( ( ( ! isLiteral(?Expression1) ) || ( lang(?Expression1) = "" 
) ) || ( lang(?Expression1) = "en" ) )
  ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl>
}
LIMIT   1

	Andy



Re: Limiting the sub-SELECT of a CONSTRUCT

Posted by Steve Harris <st...@garlik.com>.
4store supports neither subqueries, nor SERVICE, so I think you can blame that :)

- Steve

On 2012-08-01, at 17:35, Olivier Rossel wrote:

> Hi jena-users (and Steve :)
> 
> I am sending this query to my 4store 1.1.4:
> CONSTRUCT
> { ?Anl0 <http://data.bnf.fr/ontologie/hasExpression> ?Expression1 .
> ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl> }
> WHERE
> { SERVICE <http://royale.zerezo.com:6666/sparql/> {
> 
> {SELECT * WHERE {?Anl0 <http://data.bnf.fr/ontologie/hasExpression>
> ?Expression1 FILTER ( (!isLiteral(?Expression1)) || lang( ?Expression1
> )="" || lang( ?Expression1 )="en"  )  .
> ?Anl0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> <http://rdvocab.info/uri/schema/FRBRentitiesRDA/Anl>} LIMIT 1}
> 
> }} LIMIT 300
> 
> I should get much fewer results than what I get (because of the LIMIT
> 1 in the sub-SELECT).
> I use Jena (with Syntax.syntaxSPARQL_11) as my client lib. And 4store
> 1.1.4 as my server.
> And I wonder whether I have to blame Jena or 4store (or me :)
> 
> Any opinion, fellows?

-- 
Steve Harris, CTO
Garlik, a part of Experian
+44 7854 417 874  http://www.garlik.com/
Registered in England and Wales 653331 VAT # 887 1335 93
Registered office: Landmark House, Experian Way, Nottingham, Notts, NG80 1ZZ