Hi Holger,
Thank you so much! Your solution works perfectly.
Regards,
Ahmed
On Sunday, April 17, 2016 at 6:36:47 PM UTC-7, Holger Knublauch wrote:
>
> The SPARQL engine may move FILTER clauses to the end of a BGP block, i.e.
> the FILTER may indeed not be executed before the magic properties are.
> Could you try
>
> WHERE {
> {
> OPTIONAL{
> ?this body:reason_float_X ?currentReasonX .
> }
> FILTER(!bound(?currentReasonX)) .
> }
> ?this body:float_X ?reasonX .
> ?this body:float_Y ?reasonY .
> ?this body:float_Z ?reasonZ .
> }
>
> to make sure that the OPTIONAL and the FILTER are executed first.
>
> (I believe you could also just write the following:
>
> {
> FILTER NOT EXISTS { ?this body:reason_float_X ?any }
> }
>
> HTH
> Holger
>
>
> On 18/04/2016 11:32, Ahmed Shafei wrote:
>
> Hi Holger,
>
> I am sure it's not executed as the triples that use the values calculated
> by the JavaScript function are not constructed. Also, the precondition is
> not fulfilled. Here's my query:
>
> CONSTRUCT{
> ?this body:reason_float_X ?reasonX .
> ?this body:reason_float_Y ?reasonY .
> ?this body:reason_float_Z ?reasonZ .
> }
> WHERE {
> OPTIONAL{
> ?this body:reason_float_X ?currentReasonX .
> }
> FILTER(!bound(?currentReasonX)) .
> ?this body:float_X ?reasonX .
> ?this body:float_Y ?reasonY .
> ?this body:float_Z ?reasonZ .
> }
>
>
> - So, body:float_X,Y,Z are magic properties that call a SPINx function
> which calculates a value and return it back.
> - When this query runs for the first time, it will call the SPINx
> function 3 times and construct the 3 triples.
> - If the body:reason_float_X was already there, it doesn't create
> anything. But yet, it takes also a long time. If I remove the 3 triples
> containing the magic properties from the WHERE clause, it doesn't take
> longer time. The problem also persists if I call the SPINx function
> directly in the WHERE clause and BIND the values instead of querying the
> Magic property.
>
> Any hints about that?
> Thanks a lot.
>
>
> On Sunday, April 17, 2016 at 5:30:26 PM UTC-7, Holger Knublauch wrote:
>>
>> Hi Ahmed,
>>
>> how certain are you that the BIND doesn't get executed? Maybe the
>> execution order is different from what you expect - often it's a matter of
>> placing the right { ... } braces around certain blocks to control the
>> execution order.
>>
>> Would you want to share details of the SPARQL query?
>>
>> Holger
>>
>>
>> On 18/04/2016 10:12, Ahmed Shafei wrote:
>>
>> Hi all,
>> I have a CONSTRUCT query that has a call to a SPINx function. I noticed
>> that even if the query didn't reach the part where the SPINx function has
>> to be called (i.e. BIND(ex:CalculateWithJS(?someNumber) AS
>> ?calculatedNumber)), the query takes longer time. If I remove that BIND,
>> the query takes a normal query time. I don't really understand what happens
>> when a query calls a SPIN function that has a JavaScript code attached, why
>> does it take longer time even if the code was not executed?
>>
>> Thanks in advance.
>> Regards,
>> Ahmed
>>
>> --
>> You received this message because you are subscribed to the Google Group
>> "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
>> Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid
>> Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
>> To post to this group, send email to [email protected]
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "TopBraid Suite Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
> You received this message because you are subscribed to the Google Group
> "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
> Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid
> Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
> To post to this group, send email to [email protected]
> <javascript:>
> ---
> You received this message because you are subscribed to the Google Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Group
"TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live,
TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.