Hi Mikael

I don't think I can be of much more help now. Maybe if you post the data 
somewhere then I could try the queries myself to see if I could make it faster. 

Håvard

> On 08 Aug 2016, at 14:16, Mikael Pesonen <[email protected]> wrote:
> 
> 
> For some reason with filter I dont get any results (corrected == to = ). 
> Without filter it takes 12 secs so about the same speed.
> 
> -Mikael
> 
> 
>> On 8.8.2016 14:40, Håvard Ottestad wrote:
>> Maybe your inner select gets executed for every results of the second graph 
>> query. How about executing them separately and joining them with a filter?
>> 
>> SELECT DISTINCT ?s ?p ?o WHERE {
>> Union{
>>   GRAPH <http://www.lingsoft.fi/> { SELECT DISTINCT ?child WHERE { 
>> {<http://www.lingsoft.fi/c16e9937a515bda6> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/e56f6309f0d86b95> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/b393055ac0f3a0bc> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/642194686a67f935> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/a9beeb4bf0b0af70> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/ce3598292f301cec> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/26aa300e4c033981> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/bd07d765f36ea88f> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/bcf9e082e2ae8c9b> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/78d3955357a8ac10> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/369b1a9c822f55db> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/7098a84669b9feca> skos:narrower* ?child} UNION 
>> {<http://www.lingsoft.fi/b7cb30c4efed996a> skos:narrower* ?child} } }
>>                                   }
>>   union {
>>    GRAPH <http://www.lingsoft.fi/resource-meta/> { ?s 
>> <http://purl.org/dc/terms/subject> ?child2 . ?s 
>> <http://purl.org/dc/terms/isPartOf> 
>> <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . ?s ?p ?o }
>>   }
>>      filter(?child == ?child2)
>>      }
>> 
>> Håvard
>> 
>>> On 08 Aug 2016, at 13:03, Mikael Pesonen <[email protected]> wrote:
>>> 
>>> 
>>> Also tested original query but removed all * from narrower, so ontology 
>>> query returns less keywords, and query time dropped to half. Still too 
>>> slow...
>>> 
>>> -Mikael
>>> 
>>> 
>>>> On 8.8.2016 13:43, Andy Seaborne wrote:
>>>> There is a a certain amount of "it depend" here: what's the data stored 
>>>> in? what shape is the data?( which Jena version?)
>>>> 
>>>> In the next release, and available in development builds is:
>>>> 
>>>> https://issues.apache.org/jira/browse/JENA-1195
>>>> 
>>>> where property* got speeded up recently.  Usually, it took moderately 
>>>> unusual data to show this up but the repeated use of an expensive 
>>>> operation in property* may be happening here too.
>>>> 
>>>> Mikael - are you able to try out a SNAPSHOT build?
>>>> 
>>>>    Andy
>>>> 
>>>> 
>>>>> On 08/08/16 11:37, Håvard Ottestad wrote:
>>>>> Is this any better?
>>>>> 
>>>>> SELECT DISTINCT ?s ?p ?o WHERE {
>>>>> 
>>>>>  GRAPH <http://www.lingsoft.fi/resource-meta/> {
>>>>>   ?s <http://purl.org/dc/terms/isPartOf> 
>>>>> <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> .
>>>>>    ?s <http://purl.org/dc/terms/subject> ?child .
>>>>>   ?s ?p ?o
>>>>> }
>>>>> 
>>>>>  GRAPH <http://www.lingsoft.fi/> {
>>>>>    SELECT DISTINCT ?child WHERE {
>>>>>           {<http://www.lingsoft.fi/c16e9937a515bda6> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/e56f6309f0d86b95> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/b393055ac0f3a0bc> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/642194686a67f935> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/a9beeb4bf0b0af70> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/ce3598292f301cec> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/26aa300e4c033981> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/bd07d765f36ea88f> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/bcf9e082e2ae8c9b> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/78d3955357a8ac10> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/369b1a9c822f55db> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/7098a84669b9feca> skos:narrower* 
>>>>> ?child} UNION {<http://www.lingsoft.fi/b7cb30c4efed996a> skos:narrower* 
>>>>> ?child}
>>>>>     }
>>>>>  }
>>>>> 
>>>>> }
>>>>> 
>>>>> Regards,
>>>>> Håvard M. Ottestad
>>>>> 
>>>>>> On 08 Aug 2016, at 11:25, Mikael Pesonen <[email protected]> 
>>>>>> wrote:
>>>>>> 
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> I'm not if this is the correct forum to ask but hope you can help. This 
>>>>>> query takes over 20 seconds with jena:
>>>>>> 
>>>>>> SELECT DISTINCT ?s ?p ?o WHERE { GRAPH <http://www.lingsoft.fi/> { 
>>>>>> SELECT DISTINCT ?child WHERE { 
>>>>>> {<http://www.lingsoft.fi/c16e9937a515bda6> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/e56f6309f0d86b95> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/b393055ac0f3a0bc> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/642194686a67f935> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/a9beeb4bf0b0af70> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/ce3598292f301cec> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/26aa300e4c033981> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/bd07d765f36ea88f> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/bcf9e082e2ae8c9b> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/78d3955357a8ac10> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/369b1a9c822f55db> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/7098a84669b9feca> skos:narrower* ?child} UNION 
>>>>>> {<http://www.lingsoft.fi/b7cb30c4efed996a> skos:narrower* ?child} } } 
>>>>>> GRAPH <http://www.lingsoft.fi/resource-meta/> { ?s 
>>>>>> <http://purl.org/dc/terms/subject> ?child . ?s 
>>>>>> <http://purl.org/dc/terms/isPartOf> 
>>>>>> <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . ?s ?p ?o } }First graph 
>>>>>> query is for getting keywords from an ontology graph, second is for 
>>>>>> querying documents having those keywords. Is there better way/order to 
>>>>>> make this query? Thank you for the help, Mikael
>>>>>> 
>>>>>> -- 
>>>>>> www.lingsoft.fi
>>>>>> 
>>>>>> Speech Applications - Language Management - Translation - Reader's and 
>>>>>> Writer's Tools - Text Tools - E-books and M-books
>>>>>> 
>>>>>> Mikael Pesonen
>>>>>> System Engineer
>>>>>> 
>>>>>> e-mail: [email protected]
>>>>>> Tel. +358 2 279 3300
>>>>>> 
>>>>>> Time zone: GMT+2
>>>>>> 
>>>>>> Helsinki Office
>>>>>> Eteläranta 10
>>>>>> FI-00130 Helsinki
>>>>>> FINLAND
>>>>>> 
>>>>>> Turku Office
>>>>>> Linnankatu 10 A
>>>>>> FI-20100 Turku
>>>>>> FINLAND
>>> -- 
>>> www.lingsoft.fi
>>> 
>>> Speech Applications - Language Management - Translation - Reader's and 
>>> Writer's Tools - Text Tools - E-books and M-books
>>> 
>>> Mikael Pesonen
>>> System Engineer
>>> 
>>> e-mail: [email protected]
>>> Tel. +358 2 279 3300
>>> 
>>> Time zone: GMT+2
>>> 
>>> Helsinki Office
>>> Eteläranta 10
>>> FI-00130 Helsinki
>>> FINLAND
>>> 
>>> Turku Office
>>> Linnankatu 10 A
>>> FI-20100 Turku
>>> FINLAND
> 
> -- 
> www.lingsoft.fi
> 
> Speech Applications - Language Management - Translation - Reader's and 
> Writer's Tools - Text Tools - E-books and M-books
> 
> Mikael Pesonen
> System Engineer
> 
> e-mail: [email protected]
> Tel. +358 2 279 3300
> 
> Time zone: GMT+2
> 
> Helsinki Office
> Eteläranta 10
> FI-00130 Helsinki
> FINLAND
> 
> Turku Office
> Linnankatu 10 A
> FI-20100 Turku
> FINLAND
> 
> 

Reply via email to