Hello K.J.; The way a SPIN Rule works is that it will execute until no new triples are created.  This is how SPIN Rules can be used as a forward chaining reasoner.  Since now() will create a unique value each time it is executed, it will always create a new triple.

The best option here is probably to make sure this rule is executed only once.  You can configure all rules to execute once by opening Inference > Configure Inferencing in Composer.  Double-click on TopSPIN in the Inference Engine flow and chose Single pass.

If you want to retain forward-chaining behavior for other rules, you can create a rule set and set it to single pass/  Start by creating a sub-property of spin:rule.  Name it :singlePassRules or whatever you want.  For the :singlePassRules, set spin:rulePropertyMaxIterationCount to 1.  Then use :singlePassRules instead of spin:rules as the property to define your rule.  On execution, rules defined with spin:rules will execute normally (until no new triples are created) and rules defined with :singlePassRules will execute only once.

-- Scott

On 9/29/2014, 10:40 AM, K. J. Toad wrote:
Hi Jerven

Thanks for your input. I just tried your solution, but the problem is still consistent. I'll list the things I've already tried:
  • change the property from xsd:dateTime to xsd:date
  • convert sp:now() into a string by using spif:name() and changing the property into xsd:string
  • and some other things I can not remember...
On Monday, September 29, 2014 3:58:05 PM UTC+2, [email protected] wrote:
Hi,

It might be because the sp:now() is in a IF that its not being picked up
by arq for being made a constant in the query engine. So the following
might work.

Regards,
Jerven (Not associated with topquadrant in any way)

CONSTRUCT {

     ?EW ns:WEInitiation ?EWI .

     ?EW ns:WEHasDateTime ?EWDT .

}

WHERE {
     BIND(now() as ?now)
     ?this ns:FRHasWEThresholdLevel ?EWTL .

     ?this ns:FRHasWEScoreLevel ?EWSL .

     ?this ns:FRInitiatesWE ?EW .

     BIND (IF((?EWSL >= ?EWTL), true, false) AS ?EWI) .

     BIND (IF((?EWSL >= ?EWTL), ?now, "") AS ?EWDT) .
}

On 29/09/14 15:53, K. J. Toad wrote:
> While developing some SPIN rules, I have encountered a problem, I don't
> know how to solve. I'm very new to ontologies, SPARQL and SPIN and my
> last thread was answered very quickly and I'm so thankful for that. So
> I'll try it again with this problem.
>
> I have the following code that should set a DateTime as soon as a
> threshold is reached or surpassed. However, I encounter an infinite loop
> when using sp:now(). I have tried it with different methods, including
> just setting a 'date' manually (e.g. 2/2/2014), which works just fine.
>
> *CONSTRUCT*{
>
> ?EW ns:WEInitiation ?EWI .
>
> ?EW ns:WEHasDateTime ?EWDT .
>
> }
>
> *WHERE*{
>
> *?this* ns:FRHasWEThresholdLevel ?EWTL .
>
> *?this* ns:FRHasWEScoreLevel ?EWSL .
>
> *?this* ns:FRInitiatesWE ?EW .
>
> *BIND* (*IF*((?EWSL >= ?EWTL), true, false) *AS* ?EWI) .
>
> *BIND* (*IF*((?EWSL >= ?EWTL), sp:now(), "") *AS* ?EWDT)
> .<https://groups.google.com/forum/#_msocom_1>
>
>
> Can you please help me figure out what the problem is? Is it the
> mechanics of SPIN rules that won't work here? I assumed that the problem
> was, that sp:now takes the time as it is now, and again, and again,
> since 'now' is relative. But after reading the description it says that
> 'now' is when the query was started.
>
> Thanks in advance.
>
> K. J.
>
> --
> -- You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include Enterprise
> Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid
> Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
> To post to this group, send email to
> topbrai...@googlegroups.com
> To unsubscribe from this group, send email to
> topbraid-user...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en
> ---
> 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 topbraid-user...@googlegroups.com
> <mailto:topbraid-users+[email protected]>.
> For more options, visit https://groups.google.com/d/optout.

--
-------------------------------------------------------------------
Jerven Bolleman                        [email protected]
SIB Swiss Institute of Bioinformatics  Tel: +41 (0)22 379 58 85
CMU, rue Michel Servet 1               Fax: +41 (0)22 379 58 58
1211 Geneve 4,
Switzerland     www.isb-sib.ch - www.uniprot.org
Follow us at https://twitter.com/#!/uniprot
-------------------------------------------------------------------
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
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.

Reply via email to