multiple rules being executed rather than just one

19 views
Skip to first unread message

Tanya

unread,
May 20, 2014, 9:21:31 AM5/20/14
to topbrai...@googlegroups.com
Hello,

I was wondering if you can help me with a problem which I am experiencing. I have two spin:rules associated with a class, each with different filters in the WHERE clause, but the filters aren't being applied when running the rules, with the result that both rules are being executed instead of the one rule whose filters are matched by the input data.

 Thank you for your assistance. I really appreciate it. Tanya

Mark Graham

unread,
May 20, 2014, 9:54:53 AM5/20/14
to topbrai...@googlegroups.com, Scott Henninger
Hi Tanya,

When available - can you update with the product and version you are using. and a couple of examples of the two spin queries (that include filter statements). Also, the input data used if possible. This may help the technicians when reviewing this question.

Thanks,
Mark

Thanks,
Mark


Mark Graham
TopQuadrant Support

*PRODUCT SUPPORT:*

sup...@topquadrant.com
http://www.topquadrant.com/products/support.html




--
-- 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.
For more options, visit https://groups.google.com/d/optout.

Scott Henninger

unread,
May 20, 2014, 9:57:08 AM5/20/14
to topbrai...@googlegroups.com
Tanya; Not very clear what you mean.  Can you provide an example?

-- Scott

Mark Graham

unread,
May 20, 2014, 9:59:19 AM5/20/14
to topbrai...@googlegroups.com
Hi Scott,

Sorry for the confusion on this thread. That was my update -  provide example- to request a little more info for you if needed. (I will exit the thread)

Thanks,
Mark

Thanks,
Mark


Mark Graham
TopQuadrant Support

*PRODUCT SUPPORT:*

sup...@topquadrant.com
http://www.topquadrant.com/products/support.html




Tanya Hiebert

unread,
May 20, 2014, 10:52:38 AM5/20/14
to topbrai...@googlegroups.com
Sure. I cannot include my project specific data though.

Version: 4.2.1
Product: TBC Free Edition

Examples:

WHERE {
    FILTER (?agent1 != ?agent2) .
    ?this a ?type .
    FILTER (?type = <http://example.org/type_ABC>) .
    BIND (:ABC_value(?agent1, ?agent2) AS ?ABC_Value) .
    BIND (:ABC_score AS ?ABC_Score) .
}

WHERE {
    FILTER (?agent1 != ?agent2) .
    ?this a ?type .
    FILTER (?type = <http://example.org/type_XYZ>) .
    BIND (:XYZ_value(?agent1, ?agent2) AS ?XYZ_Value) .
    BIND (:XYZ_score AS ?XYZ_Score) .
}


When I run the query filtering for type_ABC, the functions in type_XYZ (XYZ_value & XYZ_score) get triggered - thus the filter is not working.




You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/5ZxxlFnWyyI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.

Irene Polikoff

unread,
May 20, 2014, 1:59:48 PM5/20/14
to topbrai...@googlegroups.com

Tanya,

 

Are you saying that you get something constructed for resources with type http://example.org/type_ABC that should not be constructed? What class is the rule attached to - type_ABC, type_XYZ or something else? How do ?agent1 and ?agent2 variables get bound?

 

My initial guess this is not a product issue, but rather an issue with the queries.

 

As an aside, recommend replacing

 

    ?this a ?type .
    FILTER (?type = <http://example.org/type_ABC>) .

 

With

 

    ?this a <http://example.org/type_ABC>.

 

It is inefficient to get all triples and then filter out the ones you don’t need when you are can get only the ones you need from the beginning.

 

Regards,

 

Irene

Holger Knublauch

unread,
May 20, 2014, 6:13:18 PM5/20/14
to topbrai...@googlegroups.com
Tanya,

first I don't see where ?agent1 and ?agent2 are ever bound. Second, if you have FILTER and BIND in the same { ... } block, Jena may actually change the execution order. To make sure that FILTERs get executed before BINDs, use an extra level of { ... } nesting, e.g.

WHERE {
    {
        FILTER ....
    }
    BIND ...
}

HTH
Holger

Tanya Hiebert

unread,
May 21, 2014, 8:22:37 AM5/21/14
to topbrai...@googlegroups.com
Hello Irene,

Your suggestion works - I no longer seem to be calling other functions which are outside of the "type" of interest.

Thank you for your assistance,
Tanya
Reply all
Reply to author
Forward
0 new messages