SWRL rule - when I reopen the owl file, the order of elements is changed

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

SWRL rule - when I reopen the owl file, the order of elements is changed

anacrl
Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina

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

protege_individuos_TPCH_v5.owl (250K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: SWRL rule - when I reopen the owl file, the order of elements is changed

Martin O'Connor-2
Can you verify that you are using the latest 5.5 Protege and the latest 2.0.8 version of the SWRLTab plugin. 

Martin 

On Apr 18, 2020, at 11:10, "[hidden email]" <[hidden email]> wrote:


Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>
_______________________________________________
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: SWRL rule - when I reopen the owl file, the order of elements is changed

samsontu
In reply to this post by anacrl
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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: SWRL rule - when I reopen the owl file, the order of elements is changed

Michael DeBellis-2
Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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

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

Re: SWRL rule - when I reopen the owl file, the order of elements is changed

Martin O'Connor-2
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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: SWRL rule - when I reopen the owl file, the order of elements is changed

anacrl
Martin,

The order is important for me.
I developed this ontology in the Protege 5.1.0.
I went back to work this ontology now and recreated the swrl rules in version 5.5.0 and SWRL Tab Plugin 2.0.8. 
If you could solve this problem, I would appreciate it very much.

Regards,
Ana Carolina


Em Sáb, Abr 18, 2020 às 16:40, Martin O'Connor <[hidden email]> escreveu:
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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: SWRL rule - when I reopen the owl file, the order of elements is changed

Michael DeBellis-2
In reply to this post by Martin O'Connor-2
Martin, sorry my mistake. I think this used to happen in older versions of the SWRL tab where it would re-order predicates where the order didn't change the reasoning, but I just double checked an ontology I have with about 20 SWRL rules and for me it is preserving the order of the rules as written. I also tried the ontology that Ana attached and for me it seems that the rules in that ontology are not changed either. For example Rule1SempExpAnd before I run the reasoner is: 

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

and after I run the reasoner is still the same:

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)


I'm using the latest version 5.5.0 on Windows. 


Michael


On Sat, Apr 18, 2020 at 12:39 PM Martin O'Connor <[hidden email]> wrote:
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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

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

Re: SWRL rule - when I reopen the owl file, the order of elements is changed

anacrl
Michael,

The problem isn't in the reasoning (before/after).
My problem occurs when I close and reopen the owl file.

Regards,
Ana Carolina


Em Sáb, Abr 18, 2020 às 17:16, Michael DeBellis <[hidden email]> escreveu:
Martin, sorry my mistake. I think this used to happen in older versions of the SWRL tab where it would re-order predicates where the order didn't change the reasoning, but I just double checked an ontology I have with about 20 SWRL rules and for me it is preserving the order of the rules as written. I also tried the ontology that Ana attached and for me it seems that the rules in that ontology are not changed either. For example Rule1SempExpAnd before I run the reasoner is: 

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

and after I run the reasoner is still the same:

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)


I'm using the latest version 5.5.0 on Windows. 


Michael

On Sat, Apr 18, 2020 at 12:39 PM Martin O'Connor <[hidden email]> wrote:
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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

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

Re: SWRL rule - when I reopen the owl file, the order of elements is changed

anacrl
In reply to this post by anacrl
Martin,

Any position on this problem? Are you trying to solve this problem for Protege 5.5.0?

Regards,
Ana Carolina



Em Sáb, Abr 18, 2020 às 16:59, [hidden email] escreveu:
Martin,

The order is important for me.
I developed this ontology in the Protege 5.1.0.
I went back to work this ontology now and recreated the swrl rules in version 5.5.0 and SWRL Tab Plugin 2.0.8. 
If you could solve this problem, I would appreciate it very much.

Regards,
Ana Carolina


Em Sáb, Abr 18, 2020 às 16:40, Martin O'Connor <[hidden email]> escreveu:
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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: SWRL rule - when I reopen the owl file, the order of elements is changed

Martin O'Connor-2
I will take a look in the next few days.

Martin

From: protege-user <[hidden email]> on behalf of [hidden email] <[hidden email]>
Sent: Thursday, April 23, 2020 6:15 AM
To: [hidden email] <[hidden email]>
Subject: Re: [protege-user] SWRL rule - when I reopen the owl file, the order of elements is changed
 
Martin,

Any position on this problem? Are you trying to solve this problem for Protege 5.5.0?

Regards,
Ana Carolina



Em Sáb, Abr 18, 2020 às 16:59, [hidden email] escreveu:
Martin,

The order is important for me.
I developed this ontology in the Protege 5.1.0.
I went back to work this ontology now and recreated the swrl rules in version 5.5.0 and SWRL Tab Plugin 2.0.8. 
If you could solve this problem, I would appreciate it very much.

Regards,
Ana Carolina


Em Sáb, Abr 18, 2020 às 16:40, Martin O'Connor <[hidden email]> escreveu:
For SWRL rules containing only non-built-in atoms, the order of predicates is not semantically meaningful - though predicate order is often important for comprehensibility.

Predicate order does matter for argument binding in rules with built-ins, where a left-to-right scan is performed when determining variable bindings [1].

While the latest V4 version of the OWLAPI specifies that the predicates in a SWRL rule are stored in a set (https://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/model/SWRLRule.html), the default implementation uses a LinkedHashSet [2], and thus maintains predicate order.

It is possible that some rule manipulations cause this order to be lost in some cases, though the SWRLAPI always tries to maintain this order. 

Is this definitely happening in the latest 2.0.8 version of the SWRLTab in Protege 5.5?

Martin

[2] https://github.com/owlcs/owlapi/blob/version4/impl/src/main/java/uk/ac/manchester/cs/owl/owlapi/SWRLRuleImpl.java

On Apr 18, 2020, at 11:30 AM, Michael DeBellis <[hidden email]> wrote:

Yes, that's what I was going to say as well. This happens to me all the time with SWRL rules, the various predicates in the rule get re-ordered from the way I wrote them but it has no effect on the reasoning. 

Michael

On Sat, Apr 18, 2020 at 11:27 AM Samson Tu <[hidden email]> wrote:
Why is re-ordering a problem? It has no impact on reasoning.

Protege uses the externally-developed OWL API to save and load ontology files. So it probably has no control over the ordering of the predicates.

With best regards,
Samson


On Apr 18, 2020, at 11:04 AM, [hidden email] wrote:

Hi,

I have more than 10 SWRL rules in this ontology (attached).
The protege SW is changing the order of elements in each SWRL rule.

What can I do to prevent this from happening?

I deleted all the rules and tried to recreate them. Only with two rules, this scenario already happens.
If I create these rules:

Rule1SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?desc, " AND ") ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1) ^ swrlx:makeOWLThing(?simple1, ?and0) -> tuning:SimpleExpression(?simple1) ^ tuning:componentOfPredicate(?simple1, ?pred) ^ tuning:hasPredicateDescription(?simple1, ?and0)

Rule2SimpExpAnd

tuning:CompositeExpression(?pred) ^ tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:ComparisonOperator(?op1) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:contains(?and0, ?dop1)  ^  -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

When I reopen the owl file, the order of elements in the second rule is:

tuning:hasPredicateDescription(?pred, ?desc) ^ swrlb:substringBefore(?and0, ?and1, " AND ") ^ swrlx:makeOWLThing(?simple1, ?and0) ^ tuning:hasTokenDescription(?op1, ?dop1) ^ swrlb:substringAfter(?and1, ?desc, " AND ") ^ swrlb:contains(?and0, ?dop1) ^ tuning:ComparisonOperator(?op1) ^ tuning:CompositeExpression(?pred) -> tuning:SimpleExpression(?simple1) ^ tuning:hasPredicateDescription(?simple1, ?and0) ^ tuning:componentOfPredicate(?simple1, ?pred)

How can I correct this problem, please?

Regards,
Ana Carolina
<protege_individuos_TPCH_v5.owl>_______________________________________________
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
_______________________________________________
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