How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
Hello everyone,
I have the following SQWRL rule:
Length(?z) ^ has_value_length(?z, ?a) ^ swrlb:lessThan(?a, 50) ^ swrlb:greaterThan(?a, 10)  -> sqwrl:select("V9AA13")

This rule is running for all values that are less than 50 and for all values that are greater than 10. For example, when the value of the length is "9" the rule will be activated and executed. However, This is not my need. I want to run this rule only when the value is between 10 and 50. So "9" must not run this rule.
How can do that, please?
Thank you for any help.
Best regards
Fatma.
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Martin O'Connor-2

Note that this is a query. It is not a rule.

This query will not match value lengths outside the range 10 to < 50. Can you post the original ontology.

Martin

> On Sep 5, 2016, at 2:17 AM, Fatma ELLOUZE <[hidden email]> wrote:
>
> Hello everyone,
> I have the following SQWRL rule:
> Length(?z) ^ has_value_length(?z, ?a) ^ swrlb:lessThan(?a, 50) ^
> swrlb:greaterThan(?a, 10)  -> sqwrl:select("V9AA13")
>
> This rule is running for all values that are less than 50 and for all values
> that are greater than 10. For example, when the value of the length is "9"
> the rule will be activated and executed. However, This is not my need. I
> want to run this rule only when the value is between 10 and 50. So "9" must
> not run this rule.
> How can do that, please?
> Thank you for any help.
> Best regards
> Fatma.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
Thank you for your clarification. Yes, it is a query.
You find attached the ontology example.
myOnto.owl
E.g., for query name SA5 or SA6.
Many Thanks.
Best regards
Fatma
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Michael DeBellis-2
In reply to this post by Fatma ELLOUZE
Fatma, are you sure that this query is firing when the value is 9? Since you just have a hard coded string in the select statement I'm not sure how you are determining when the query is firing.  You can put variables in the select statement as well, so you could say: sqwrl:select(?a) instead and that would tell you for sure what values a has when the left hand side is matching the query. That is a great way to debug SWRL rules.

Michael

On Mon, Sep 5, 2016 at 2:17 AM, Fatma ELLOUZE <[hidden email]> wrote:
Hello everyone,
I have the following SQWRL rule:
Length(?z) ^ has_value_length(?z, ?a) ^ swrlb:lessThan(?a, 50) ^
swrlb:greaterThan(?a, 10)  -> sqwrl:select("V9AA13")

This rule is running for all values that are less than 50 and for all values
that are greater than 10. For example, when the value of the length is "9"
the rule will be activated and executed. However, This is not my need. I
want to run this rule only when the value is between 10 and 50. So "9" must
not run this rule.
How can do that, please?
Thank you for any help.
Best regards
Fatma.



--
View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
Thank you Mr Michael for your reply.
In fact, I use OWL API to create individuals for classes in the query and then I try to execute all the queries I have in Protege. When the left hand side is matching the query, I have a text message returned. So the execution is done from OWL API using Eclipse. So, I am sorry, the current ontology that I submit doesn't contain individuals that match the queries.
Many thanks,
Best regards
Fatma.
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Lorenz Buehmann
How do you determine then that the query matches data even for length
values of 9?


On 05.09.2016 17:07, Fatma ELLOUZE wrote:

> Thank you Mr Michael for your reply.
> In fact, I use OWL API to create individuals for classes in the query and
> then I try to execute all the queries I have in Protege. When the left hand
> side is matching the query, I have a text message returned. So the execution
> is done from OWL API using Eclipse. So, I am sorry, the current ontology
> that I submit doesn't contain individuals that match the queries.
> Many thanks,
> Best regards
> Fatma.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352p4666356.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
In my java program, I have a query interface, so the user determine for example that the value of the "Depth" is 50, the value of the "length" is 9 and so one.
in my java code I create individuals for the Depth and its corresponding dataProperty and its value "50". the same thing for the "Length" and the other classes of the query.
Then I execute query by query like this :
Set<SQWRLQuery> result = queryEngine.getSQWRLQueries();
for(int i=0; i<result.size(); i++){
val= queryEngine.runSQWRLQuery("SarActAss" +j +"").toString();
...............}
So when I open my ontology in Protege, I have new individuals that are created. Among them the individual of the Length "9" that can run the query using swrlb:lessThan and swrlb:greaterThan.
I hope I have clarified more.
Best regards
Fatma
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Martin O'Connor-2
In reply to this post by Fatma ELLOUZE

I found a bug in the comparator for xsd:integer and xsd:decimal datatypes. The bug has been fixed and I will generate a new release of the libraries and plugin today.

Note that in the SWRLTab editor unqualified numeric literals are mapped to xsd:int and xsd:float. So 9, for example, is equivalent to “9”^^xsd:int. The xsd:integer datatype is not equivalent to xsd:int.

This distinction can become an issue in numeric operations. For example

swrlb:greaterThan(?x, 9)

where ?x binds to an xsd:integer will always evaluate to false because the literal 9 will be assigned an xsd:int datatype.

The expression

swrlb:greaterThan(?x, “9”^^xsd:integer)

will allow a valid comparison here.

Martin

> On Sep 5, 2016, at 8:07 AM, Fatma ELLOUZE <[hidden email]> wrote:
>
> Thank you Mr Michael for your reply.
> In fact, I use OWL API to create individuals for classes in the query and
> then I try to execute all the queries I have in Protege. When the left hand
> side is matching the query, I have a text message returned. So the execution
> is done from OWL API using Eclipse. So, I am sorry, the current ontology
> that I submit doesn't contain individuals that match the queries.
> Many thanks,
> Best regards
> Fatma.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352p4666356.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
Thank you Mr. Martin.
Please, how can I proceed after this change? Is that modification will affects my code?
Best regards,
Fatma.
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Martin O'Connor-2

The fixes will not affect your code. However, you will need to fully qualify your literals to be xsd:integer if you are using this type for your lengths etc.

Martin


> On Sep 5, 2016, at 8:52 AM, Fatma ELLOUZE <[hidden email]> wrote:
>
> Thank you Mr. Martin.
> Please, how can I proceed after this change? Is that modification will
> affects my code?
> Best regards,
> Fatma.
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352p4666360.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Fatma ELLOUZE
Ok, Thank you for this clarification and I will try this when you generate the new release of the libraries and plugin.
Best regards
Fatma
Reply | Threaded
Open this post in threaded view
|

Re: How to say swrlb:lessThan and swrlb:greaterThan at the same rule?

Martin O'Connor-2

The 1.1.2 version of the plugin is available now (via File->Check for plugins…).

The libraries may take a few hours to appear on Maven Central.

Martin

> On Sep 5, 2016, at 9:26 AM, Fatma ELLOUZE <[hidden email]> wrote:
>
> Ok, Thank you for this clarification and I will try this when you generate
> the new release of the libraries and plugin.
> Best regards
> Fatma
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/How-to-say-swrlb-lessThan-and-swrlb-greaterThan-at-the-same-rule-tp4666352p4666362.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user