Re: Very slow SPARQL query on TDB

2015-01-29 Thread Laurent Rucquoy
Hi Andy,

I've good response time now with the SPARQL request fixed by Milorad.
Nevertheless, I will focus on the TDB Optimizer soon and also upgrade Jena
to the last release (my current release is 2.10.1)
Thank you for your help.

Sincerely,
Laurent.

On Wed, Jan 28, 2015 at 7:44 PM, Andy Seaborne a...@apache.org wrote:

 On 28/01/15 18:34, Milorad Tosic wrote:

 Hi Laurent,
 I would give a try to a different sequencing in the query. For example:

 PREFIX base:http://www.telemis.com/PREFIX rdf: 
 http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
 http://www.w3.org/2001/XMLSchema#
 SELECT ?x{ ?image base:sopInstanceUID 1.2.840.113564.10656621.
 201302121438403281.1003000225002^^XMLS:string . ?image a base:Image .
?seq ?p ?image . ?x base:images ?seq .
   ?x a base:ImageAnnotation ;  base:deleted false .
 }
 Though, it may or may not help.
 Regards,Milorad


From: Laurent Rucquoy laurent.rucq...@telemis.com
   To: users@jena.apache.org
   Sent: Wednesday, January 28, 2015 6:13 PM
   Subject: Very slow SPARQL query on TDB

 Hello,
 I have a Java application which implements an object model persisted
 through JenaBean in my Jena TDB (see the attached image of the classes
 diagram).
 The request to retrieve an ImageAnnotation resource from the ID of a
 linked Image is very slow.Here is a typical SPARQL query used (more than
 40s to get the result):


 PREFIX base:http://www.telemis.com/PREFIX rdf: 
 http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
 http://www.w3.org/2001/XMLSchema#
 SELECT ?x{ ?x a base:ImageAnnotation ;  base:deleted false ; base:images
 ?seq . ?seq ?p ?image . ?image a base:Image . ?image base:sopInstanceUID
 1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string
 .}


 Can you help me to find what I'm doing wrong ?
 Thank you in advance.
 Sincerely,Laurent


 Which version of TDB? 2.11.2 had possibly related fixes.

 https://issues.apache.org/jira/browse/JENA-685

 If you do take Milorad suggestion, also put in a none.opt file to stop
 TDB reordering your improved order into a worse one.

 http://jena.apache.org/documentation/tdb/optimizer.
 html#choosing-the-optimizer-strategy

 Andy

 PS Attachments don't come through this list.




-- 
*Laurent Rucquoy*
RD Engineer

Telemis http://www.telemis.com
*Extending Human Life*

*** NEW ADDRESS ***
Avenue Athéna 2
1348 Louvain-la-Neuve
Belgium
laurent.rucq...@telemis.com
Tel: +32 (0) 10 47 14 39
Fax: +32 (0) 10 48 00 20


Re: Very slow SPARQL query on TDB

2015-01-29 Thread Laurent Rucquoy
Hi Milorad,

Your suggestion solved my performance problem: the fixed SPARQL query took
less than 1s to get the result !
Thank you very much for your efficient support.

Sincerely,
Laurent.


On Wed, Jan 28, 2015 at 7:34 PM, Milorad Tosic mbto...@yahoo.com.invalid
wrote:

 Hi Laurent,
 I would give a try to a different sequencing in the query. For example:

 PREFIX base:http://www.telemis.com/PREFIX rdf: 
 http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
 http://www.w3.org/2001/XMLSchema#
 SELECT ?x{ ?image base:sopInstanceUID
 1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .
 ?image a base:Image . ?seq ?p ?image . ?x base:images ?seq .
  ?x a base:ImageAnnotation ;  base:deleted false .
 }
 Though, it may or may not help.
 Regards,Milorad


   From: Laurent Rucquoy laurent.rucq...@telemis.com
  To: users@jena.apache.org
  Sent: Wednesday, January 28, 2015 6:13 PM
  Subject: Very slow SPARQL query on TDB

 Hello,
 I have a Java application which implements an object model persisted
 through JenaBean in my Jena TDB (see the attached image of the classes
 diagram).
 The request to retrieve an ImageAnnotation resource from the ID of a
 linked Image is very slow.Here is a typical SPARQL query used (more than
 40s to get the result):


 PREFIX base:http://www.telemis.com/PREFIX rdf: 
 http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
 http://www.w3.org/2001/XMLSchema#
 SELECT ?x{ ?x a base:ImageAnnotation ;  base:deleted false ; base:images
 ?seq . ?seq ?p ?image . ?image a base:Image . ?image base:sopInstanceUID
 1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .}


 Can you help me to find what I'm doing wrong ?
 Thank you in advance.
 Sincerely,Laurent






-- 
*Laurent Rucquoy*
RD Engineer

Telemis http://www.telemis.com
*Extending Human Life*

*** NEW ADDRESS ***
Avenue Athéna 2
1348 Louvain-la-Neuve
Belgium
laurent.rucq...@telemis.com
Tel: +32 (0) 10 47 14 39
Fax: +32 (0) 10 48 00 20


Re: Very slow SPARQL query on TDB

2015-01-29 Thread Andy Seaborne

On 29/01/15 11:05, Laurent Rucquoy wrote:

Hi Andy,

I've good response time now with the SPARQL request fixed by Milorad.
Nevertheless, I will focus on the TDB Optimizer soon and also upgrade Jena
to the last release (my current release is 2.10.1)
Thank you for your help.


Glad you've got it working.

2.11.2+ should effectively do what Milorad suggests - it should pick

image base:sopInstanceUID 
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .


as the first triple pattern to evaluate.

The bug was that it would choose

?x a base:ImageAnnotation ;

and that is somewhat less selective.

Andy



Sincerely,
Laurent.

On Wed, Jan 28, 2015 at 7:44 PM, Andy Seaborne a...@apache.org wrote:


On 28/01/15 18:34, Milorad Tosic wrote:


Hi Laurent,
I would give a try to a different sequencing in the query. For example:

PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?image base:sopInstanceUID 1.2.840.113564.10656621.
201302121438403281.1003000225002^^XMLS:string . ?image a base:Image .
?seq ?p ?image . ?x base:images ?seq .
   ?x a base:ImageAnnotation ;  base:deleted false .
}
Though, it may or may not help.
Regards,Milorad


From: Laurent Rucquoy laurent.rucq...@telemis.com
   To: users@jena.apache.org
   Sent: Wednesday, January 28, 2015 6:13 PM
   Subject: Very slow SPARQL query on TDB

Hello,
I have a Java application which implements an object model persisted
through JenaBean in my Jena TDB (see the attached image of the classes
diagram).
The request to retrieve an ImageAnnotation resource from the ID of a
linked Image is very slow.Here is a typical SPARQL query used (more than
40s to get the result):


PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?x a base:ImageAnnotation ;  base:deleted false ; base:images
?seq . ?seq ?p ?image . ?image a base:Image . ?image base:sopInstanceUID
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string
.}


Can you help me to find what I'm doing wrong ?
Thank you in advance.
Sincerely,Laurent



Which version of TDB? 2.11.2 had possibly related fixes.

https://issues.apache.org/jira/browse/JENA-685

If you do take Milorad suggestion, also put in a none.opt file to stop
TDB reordering your improved order into a worse one.

http://jena.apache.org/documentation/tdb/optimizer.
html#choosing-the-optimizer-strategy

 Andy

PS Attachments don't come through this list.









Very slow SPARQL query on TDB

2015-01-28 Thread Laurent Rucquoy
Hello,

I have a Java application which implements an object model persisted
through JenaBean in my Jena TDB* (see the attached image of the classes
diagram)*.

The request to retrieve an ImageAnnotation resource from the ID of a linked
Image is very slow.
Here is a typical SPARQL query used (more than 40s to get the result):



PREFIX base:http://www.telemis.com/
PREFIX rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
PREFIX XMLS: http://www.w3.org/2001/XMLSchema#

SELECT ?x
{
?x a base:ImageAnnotation ;
 base:deleted false ;
base:images ?seq .
?seq ?p ?image .
?image a base:Image .
?image base:sopInstanceUID
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .
}



Can you help me to find what I'm doing wrong ?

Thank you in advance.

Sincerely,
Laurent


Re: Very slow SPARQL query on TDB

2015-01-28 Thread Andy Seaborne

On 28/01/15 18:34, Milorad Tosic wrote:

Hi Laurent,
I would give a try to a different sequencing in the query. For example:

PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?image base:sopInstanceUID 
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string . 
?image a base:Image . ?seq ?p ?image . ?x base:images ?seq .
  ?x a base:ImageAnnotation ;  base:deleted false .
}
Though, it may or may not help.
Regards,Milorad


   From: Laurent Rucquoy laurent.rucq...@telemis.com
  To: users@jena.apache.org
  Sent: Wednesday, January 28, 2015 6:13 PM
  Subject: Very slow SPARQL query on TDB

Hello,
I have a Java application which implements an object model persisted through 
JenaBean in my Jena TDB (see the attached image of the classes diagram).
The request to retrieve an ImageAnnotation resource from the ID of a linked 
Image is very slow.Here is a typical SPARQL query used (more than 40s to get 
the result):


PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?x a base:ImageAnnotation ;  base:deleted false ; base:images ?seq . ?seq ?p 
?image . ?image a base:Image . ?image base:sopInstanceUID 
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .}


Can you help me to find what I'm doing wrong ?
Thank you in advance.
Sincerely,Laurent


Which version of TDB? 2.11.2 had possibly related fixes.

https://issues.apache.org/jira/browse/JENA-685

If you do take Milorad suggestion, also put in a none.opt file to stop 
TDB reordering your improved order into a worse one.


http://jena.apache.org/documentation/tdb/optimizer.html#choosing-the-optimizer-strategy

Andy

PS Attachments don't come through this list.


Re: Very slow SPARQL query on TDB

2015-01-28 Thread Milorad Tosic
Hi Laurent,
I would give a try to a different sequencing in the query. For example:

PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?image base:sopInstanceUID 
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string . 
?image a base:Image . ?seq ?p ?image . ?x base:images ?seq . 
 ?x a base:ImageAnnotation ;  base:deleted false .
}
Though, it may or may not help.
Regards,Milorad

 
  From: Laurent Rucquoy laurent.rucq...@telemis.com
 To: users@jena.apache.org 
 Sent: Wednesday, January 28, 2015 6:13 PM
 Subject: Very slow SPARQL query on TDB
   
Hello,
I have a Java application which implements an object model persisted through 
JenaBean in my Jena TDB (see the attached image of the classes diagram).
The request to retrieve an ImageAnnotation resource from the ID of a linked 
Image is very slow.Here is a typical SPARQL query used (more than 40s to get 
the result):


PREFIX base:http://www.telemis.com/PREFIX rdf: 
http://www.w3.org/1999/02/22-rdf-syntax-ns#PREFIX XMLS: 
http://www.w3.org/2001/XMLSchema#
SELECT ?x{ ?x a base:ImageAnnotation ;  base:deleted false ; base:images ?seq . 
?seq ?p ?image . ?image a base:Image . ?image base:sopInstanceUID 
1.2.840.113564.10656621.201302121438403281.1003000225002^^XMLS:string .}


Can you help me to find what I'm doing wrong ?
Thank you in advance.
Sincerely,Laurent