Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infix conjuctions are not commutative #10

Open
phillord opened this issue May 2, 2017 · 2 comments
Open

Infix conjuctions are not commutative #10

phillord opened this issue May 2, 2017 · 2 comments

Comments

@phillord
Copy link

phillord commented May 2, 2017

Conjuction is commutative in OWL, but not in Scowl. Consider:

scala> import org.phenoscape.scowl._

import org.phenoscape.scowl._

scala>
scala> val a = Class("a")
a: org.semanticweb.owlapi.model.OWLClass = <a>

scala> val b = Class("b")
b: org.semanticweb.owlapi.model.OWLClass = <b>

scala> val c = Class("c")
c: org.semanticweb.owlapi.model.OWLClass = <c>

scala> a and b and c
res0: org.semanticweb.owlapi.model.OWLObjectIntersectionOf = ObjectIntersectionOf(<a> <b> <c>)

scala> a and (b and c)
res1: org.semanticweb.owlapi.model.OWLObjectIntersectionOf = ObjectIntersectionOf(<a> ObjectIntersectionOf(<b> <c>))

scala> (b and c) and a
res2: org.semanticweb.owlapi.model.OWLObjectIntersectionOf = ObjectIntersectionOf(<a> <b> <c>)

All of these results make sense except for the last which should return
ObjectIntersectionOf(<a> ObjectIntersectionOf(<b> <c>)) I think.

I think this is caused bc2d369 which addresses #3 unfortunately.

Just playing with Scowl and Scala. Very nice piece of work (Scowl that is,
Scala I will reserve judgement on for the moment)

@balhoff
Copy link
Member

balhoff commented May 4, 2017

Thanks for the report! In the spirit of #3 I would be inclined to change a and (b and c) to return ObjectIntersectionOf(<a> <b> <c>). I don't think there is a way to distinguish a and b and c from (a and b) and c in the code being called, since the parentheses just match the normal Scala order of operations. Does this sound okay for the "Manchester" syntax? The functional style is still available for creating nested intersections of unions.

@phillord
Copy link
Author

phillord commented May 4, 2017

shrugs. Six to one, half a dozen to the other. You trading off the gain in commutativity for the loss of non-associativity.

Can you not overload the and method to deal specifically with an OWLObjectIntersection to not use asConjunctSet. I guess that would work but would break A and B and C and D.

I don't have this problem in tawny, cause I use prefix notation. But then I can't do A and B or C so nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants