Further update... The Fuseki console is showing an OutOfMemoryError that
relates to this query which I have attached.


On Thu, Jan 31, 2013 at 10:09 AM, Rob Walpole <[email protected]> wrote:

> Ok, just looking at this problem again. It seems that even without the
> nested select the binding still causes a problem in the main body of the
> query. So...
>
> DESCRIBE ?ancestor
> WHERE
> {
>     BIND(<
> http://nationalarchives.gov.uk/dri/catalogue/exportStatus/ReadyToProcess>
> AS ?readyStatus)
>     ?export rdfs:member ?member ;
>             dri:username "dfreeman"^^xsd:string ;
>             dri:exportStatus ?readyStatus .
>     OPTIONAL
>     {
>         BIND(<
> http://nationalarchives.gov.uk/dri/catalogue/item/c2433752-b1e5-44e4-a271-c36d29aa6a3b>
> AS ?deselected)
>         # get the ancestors of the deselected item
> ?deselected (dri:parent)+ ?ancestor .
>  # get the ancestor that is a member of the export list
>         FILTER EXISTS { ?export rdfs:member ?ancestor } .
>     }
> }
>
> ...returns is seconds whereas...
>
> DESCRIBE ?ancestor
> WHERE
> {
>     BIND(<
> http://nationalarchives.gov.uk/dri/catalogue/exportStatus/ReadyToProcess>
> AS ?readyStatus)
>     BIND(<
> http://nationalarchives.gov.uk/dri/catalogue/item/c2433752-b1e5-44e4-a271-c36d29aa6a3b>
> AS ?deselected)
>     ?export rdfs:member ?member ;
>             dri:username "dfreeman"^^xsd:string ;
>             dri:exportStatus ?readyStatus .
>     OPTIONAL
>     {
>
>         # get the ancestors of the deselected item
>  ?deselected (dri:parent)+ ?ancestor .
>  # get the ancestor that is a member of the export list
>         FILTER EXISTS { ?export rdfs:member ?ancestor } .
>     }
> }
>
> ...just hangs. Any more thoughts?
>
> Thanks
> Rob
>
>
> On Tue, Jan 29, 2013 at 7:46 PM, Rob Walpole <[email protected]>wrote:
>
>> Cool, thanks guys, will give this a try tomorrow :-)
>>
>> Rob
>>
>>
>> On Tue, Jan 29, 2013 at 7:36 PM, Andy Seaborne <[email protected]> wrote:
>>
>>> On 29/01/13 18:21, Alexander Dutton wrote:
>>>
>>>>
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA1
>>>>
>>>> Hi Rob,
>>>>
>>>> On 29/01/13 18:11, Rob Walpole wrote:
>>>>
>>>>> Am I doing something wrong here?
>>>>>
>>>>
>>>> The short answer is that the inner SELECT is evaluated first, leading to
>>>> the results being calculated in the second case in a rather inefficient
>>>> way.
>>>>
>>>> In the first inner SELECT ?deselected is bound, so it's quite quick to
>>>> find all its ancestors.
>>>>
>>>> In the second, all possible ?deselected and ?ancestor pairs are returned
>>>> by the inner query, which are then (effectively) filtered to remove all
>>>> the pairs where ?deselected isn't whatever it was BINDed to.
>>>>
>>>> Here's more from the spec:
>>>> <http://www.w3.org/TR/**sparql11-query/#subqueries<http://www.w3.org/TR/sparql11-query/#subqueries>
>>>> >.
>>>>
>>>> I /think/ ARQ is able to perform some optimisations along these lines,
>>>> but obviously not for your query.
>>>>
>>>
>>> Spot on.
>>>
>>> If you remove the inner SELECT it should do better.
>>>
>>>
>>>
>>>   { BIND(...) AS ?readyStatus)
>>>     BIND(...) AS ?deselected)
>>>     ?export rdfs:member ?member .
>>>     ?export dri:username "rwalpole"^^xsd:string .
>>>     ?export dri:exportStatus ?readyStatus
>>>     OPTIONAL
>>>       { ?deselected (dri:parent)+ ?ancestor
>>>
>>>         FILTER EXISTS {?export rdfs:member ?ancestor }
>>>       }
>>>   }
>>>
>>> but technically this is a different query so it'll depend on your data
>>> as to whether it is right.
>>>
>>> http://www.sparql.org/query-**validator.html<http://www.sparql.org/query-validator.html>
>>>
>>>         Andy
>>>
>>>
>>>
>>>> Best regards,
>>>>
>>>> Alex
>>>>
>>>> PS. You don't need to do URI("http://?";); you can do a straight IRI
>>>> literal: <http://?>
>>>>
>>>> - --
>>>> Alexander Dutton
>>>> Developer, Office of the CIO; data.ox.ac.uk, OxPoints
>>>> IT Services, University of Oxford
>>>> -----BEGIN PGP SIGNATURE-----
>>>> Version: GnuPG v1.4.13 (GNU/Linux)
>>>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>>>
>>>> iQEcBAEBAgAGBQJRCBMZAAoJEPotab**D1ANF7Fb0H/**jeCedjfCIuhI2KTNETOcrVR
>>>> Gvl8N4k9ty4AN4F0xFKA3kcGCTR2CI**pgz/**hez6BM5s8mDqLc7ViNPXWxbUhb4kHh
>>>> fxVuuoYBr13VhGnyufvWFliFeT3xSV**LO3eDUilzoja2pvH/Cx/**sNQvcHbi2Ee+EX
>>>> MoWLyfSvtSGY2rXDmMAXvBz49wgk42**mC2Bsr5ptNUfXWQjzz6BXp5SxTKADy**SBXG
>>>> Tm/**DmqGRclHxw233I6EcB9lKfDytTosVu**gH1Yl0BGEHiFPL2/wkkB+**AZiLIwCmb/
>>>> cy+Y8/**I9PlD4onvYlDMRmP169HQVYt849Skx**5/TnTyjMBBNIgQiE8+cj0a/oDc8=
>>>> =ZQec
>>>> -----END PGP SIGNATURE-----
>>>>
>>>>
>>>
>>
>>
>> --
>>
>> Rob Walpole
>> Email [email protected]
>> Tel. +44 (0)7969 869881
>> Skype: RobertWalpolehttp://www.linkedin.com/in/robwalpole
>>
>>
>
>
> --
>
> Rob Walpole
> Email [email protected]
> Tel. +44 (0)7969 869881
> Skype: RobertWalpolehttp://www.linkedin.com/in/robwalpole
>
>


-- 

Rob Walpole
Email [email protected]
Tel. +44 (0)7969 869881
Skype: RobertWalpolehttp://www.linkedin.com/in/robwalpole
10:04:47 INFO  [32] 200 OK
10:04:52 INFO  [33] OK/describe
10:04:52 INFO  [33] 200 OK
10:06:04 WARN  [25] RC = 500 : GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
        at java.lang.Long.valueOf(Long.java:557)
        at org.openjena.atlas.lib.Bytes.assembleLong(Bytes.java:223)
        at org.openjena.atlas.lib.Bytes.getLong(Bytes.java:136)
        at com.hp.hpl.jena.tdb.lib.TupleLib.tuple(TupleLib.java:209)
        at 
com.hp.hpl.jena.tdb.index.TupleIndexRecord$1.convert(TupleIndexRecord.java:194)
        at 
com.hp.hpl.jena.tdb.index.TupleIndexRecord$1.convert(TupleIndexRecord.java:190)
        at org.openjena.atlas.iterator.Iter$4.next(Iter.java:301)
        at 
com.hp.hpl.jena.tdb.sys.DatasetControlMRSW$IteratorCheckNotConcurrent.next(DatasetControlMRSW.java:130)
        at org.openjena.atlas.iterator.Iter$4.next(Iter.java:301)
        at org.openjena.atlas.iterator.Iter$4.next(Iter.java:301)
        at org.openjena.atlas.iterator.Iter.next(Iter.java:828)
        at 
com.hp.hpl.jena.tdb.store.GraphTDBBase$ProjectQuadsToTriples.next(GraphTDBBase.java:178)
        at 
com.hp.hpl.jena.tdb.store.GraphTDBBase$ProjectQuadsToTriples.next(GraphTDBBase.java:166)
        at 
com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:80)
        at 
com.hp.hpl.jena.sparql.util.graph.GraphUtils.allNodes(GraphUtils.java:206)
        at com.hp.hpl.jena.sparql.path.PathLib.ungroundedPath(PathLib.java:202)
        at com.hp.hpl.jena.sparql.path.PathLib.execTriplePath(PathLib.java:141)
        at com.hp.hpl.jena.sparql.path.PathLib.execTriplePath(PathLib.java:121)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterPath.nextStage(QueryIterPath.java:48)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:113)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:65)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
        at 
com.hp.hpl.jena.sparql.engine.main.iterator.QueryIterGraph$QueryIterGraphInner.hasNextBinding(QueryIterGraph.java:123)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:79)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterProcessBinding.hasNextBinding(QueryIterProcessBinding.java:60)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterDefaulting.hasNextBinding(QueryIterDefaulting.java:54)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:79)
        at 
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
10:06:04 INFO  [25] 500 GC overhead limit exceeded
10:06:58 INFO  [34] GET 
http://localhost:3030/catalogue/query?query=PREFIX+api%3A+%3Chttp%3A%2F%2Fpurl.org%2Flinked-data%2Fapi%2Fvocab%23%3E%0D%0APREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0APREFIX+dri%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fterms%2Fdri%23%3E%0D%0APREFIX+elda%3A+%3Chttp%3A%2F%2Fwww.epimorphics.com%2Fvocabularies%2Flda%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+spec%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fterms%2Fcat%23%3E%0D%0APREFIX+tna%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fvocab%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0A%0D%0ADESCRIBE+%3Fancestor%0D%0AWHERE%0D%0A%7B%0D%0A++++BIND%28%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fdri%2Fcatalogue%2FexportStatus%2FReadyToProcess%3E+AS+%3FreadyStatus%29%0D%0A++++BIND%28%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fdri%2Fcatalogue%2Fitem%2Fc2433752-b1e5-44e4-a271-c36d29aa6a3b%3E+AS+%3Fdeselected%29%0D%0A++++%3Fexport+rdfs%3Amember+%3Fmember+%3B%0D%0A++++++++++++dri%3Ausername+%22dfreeman%22%5E%5Exsd%3Astring+%3B%0D%0A++++++++++++dri%3AexportStatus+%3FreadyStatus+.%0D%0A++++OPTIONAL%0D%0A++++%7B%0D%0A++++++++%0D%0A++++++++%23+get+the+ancestors+of+the+deselected+item%0D%0A%09%3Fdeselected+%28dri%3Aparent%29%2B+%3Fancestor+.%0D%0A%09%09%0D%0A%09%23+get+the+ancestor+that+is+a+member+of+the+export+list%0D%0A++++++++FILTER+EXISTS+%7B+%3Fexport+rdfs%3Amember+%3Fancestor+%7D+.%0D%0A++++%7D%0D%0A%7D&output=text&stylesheet=%2Fxml-to-html.xsl
10:06:58 INFO  [34] Query = PREFIX api: 
<http://purl.org/linked-data/api/vocab#>  PREFIX dc: 
<http://purl.org/dc/terms/>  PREFIX dri: 
<http://nationalarchives.gov.uk/terms/dri#>  PREFIX elda: 
<http://www.epimorphics.com/vocabularies/lda#>  PREFIX rdf: 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>  PREFIX rdfs: 
<http://www.w3.org/2000/01/rdf-schema#>  PREFIX spec: 
<http://nationalarchives.gov.uk/terms/cat#>  PREFIX tna: 
<http://nationalarchives.gov.uk/vocab#>  PREFIX xsd: 
<http://www.w3.org/2001/XMLSchema#>    DESCRIBE ?ancestor  WHERE  {      
BIND(<http://nationalarchives.gov.uk/dri/catalogue/exportStatus/ReadyToProcess> 
AS ?readyStatus)      
BIND(<http://nationalarchives.gov.uk/dri/catalogue/item/c2433752-b1e5-44e4-a271-c36d29aa6a3b>
 AS ?deselected)      ?export rdfs:member ?member ;              dri:username 
"dfreeman"^^xsd:string ;              dri:exportStatus ?readyStatus .      
OPTIONAL      {                    # get the ancestors of the deselected item   
       ?deselected (dri:parent)+ ?ancestor .                   # get the 
ancestor that is a member of the export list          FILTER EXISTS { ?export 
rdfs:member ?ancestor } .      }  }
10:11:52 INFO  [35] GET 
http://localhost:3030/catalogue/query?query=PREFIX+api%3A+%3Chttp%3A%2F%2Fpurl.org%2Flinked-data%2Fapi%2Fvocab%23%3E%0D%0APREFIX+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0D%0APREFIX+dri%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fterms%2Fdri%23%3E%0D%0APREFIX+elda%3A+%3Chttp%3A%2F%2Fwww.epimorphics.com%2Fvocabularies%2Flda%23%3E%0D%0APREFIX+rdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+spec%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fterms%2Fcat%23%3E%0D%0APREFIX+tna%3A+%3Chttp%3A%2F%2Fnationalarchives.gov.uk%2Fvocab%23%3E%0D%0APREFIX+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E%0D%0A%0D%0ADESCRIBE+%3Fancestor%0D%0AWHERE%0D%0A%7B%0D%0A++++BIND%28uri%28%22http%3A%2F%2Fnationalarchives.gov.uk%2Fdri%2Fcatalogue%2FexportStatus%2FReadyToProcess%22%29+AS+%3FreadyStatus%29%0D%0A%09%3Fexport+rdfs%3Amember+%3Fmember+%3B%0D%0A++++++++++++dri%3Ausername+%22dfreeman%22%5E%5Exsd%3Astring+%3B%0D%0A++++++++++++dri%3AexportStatus+%3FreadyStatus+.%0D%0A++++OPTIONAL%0D%0A++++%7B%0D%0A++++++++%7B%0D%0A++++++++++++SELECT+%3Fancestor%0D%0A++++++++++++WHERE%0D%0A++++++++++++%7B%0D%0A++++++++++++++++BIND%28URI%28%22http%3A%2F%2Fnationalarchives.gov.uk%2Fdri%2Fcatalogue%2Fitem%2Fc2433752-b1e5-44e4-a271-c36d29aa6a3b%22%29+AS+%3Fdeselected%29%0D%0A++++++++++++%09%23+get+the+ancestors+of+the+deselected+item%0D%0A%09%09%3Fdeselected+dri%3Aparent%2B+%3Fancestor+.%0D%0A%0D%0A%09%09%23+get+the+ancestor+that+is+a+member+of+the+export+list%0D%0A%09+++++++%09FILTER+EXISTS+%7B+%3Fexport+rdfs%3Amember+%3Fancestor+%7D+.%0D%0A%09++++%7D%0D%0A++++++++%7D%0D%0A++++%7D%0D%0A%7D&output=text&stylesheet=%2Fxml-to-html.xsl
10:11:52 INFO  [35] Query = PREFIX api: 
<http://purl.org/linked-data/api/vocab#>  PREFIX dc: 
<http://purl.org/dc/terms/>  PREFIX dri: 
<http://nationalarchives.gov.uk/terms/dri#>  PREFIX elda: 
<http://www.epimorphics.com/vocabularies/lda#>  PREFIX rdf: 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>  PREFIX rdfs: 
<http://www.w3.org/2000/01/rdf-schema#>  PREFIX spec: 
<http://nationalarchives.gov.uk/terms/cat#>  PREFIX tna: 
<http://nationalarchives.gov.uk/vocab#>  PREFIX xsd: 
<http://www.w3.org/2001/XMLSchema#>    DESCRIBE ?ancestor  WHERE  {      
BIND(uri("http://nationalarchives.gov.uk/dri/catalogue/exportStatus/ReadyToProcess";)
 AS ?readyStatus)      ?export rdfs:member ?member ;              dri:username 
"dfreeman"^^xsd:string ;              dri:exportStatus ?readyStatus .      
OPTIONAL      {          {              SELECT ?ancestor              WHERE     
         {                  
BIND(URI("http://nationalarchives.gov.uk/dri/catalogue/item/c2433752-b1e5-44e4-a271-c36d29aa6a3b";)
 AS ?deselected)               # get the ancestors of the deselected item       
       ?deselected dri:parent+ ?ancestor .             # get the ancestor that 
is a member of the export list                  FILTER EXISTS { ?export 
rdfs:member ?ancestor } .           }          }      }  }
10:12:11 WARN  [34] RC = 500 : GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
10:12:11 INFO  [34] 500 GC overhead limit exceeded
10:12:33 INFO  [35] OK/describe
10:12:33 INFO  [35] 200 OK
10:14:26 WARN  Open iterator: QueryIterConcat/1213022
10:14:26 WARN  [23] RC = 500 : GC overhead limit exceeded
java.lang.OutOfMemoryError: GC overhead limit exceeded
10:14:27 INFO  [23] 500 GC overhead limit exceeded

Reply via email to