0

I'm trying to use Protegé to solve the following mathematical riddle:

Find a SIX digit number in which the FIRST digit is ONE more than the THIRD, the SECOND digit is ONE less than the FOURTH, the FIFTH digit is ONE less than the THIRD, and the SIXTH digit is ONE more than the FOURTH. The sum of the SECOND and the THIRD digits equal the FIRST. The sum of all the digits is 30.

This roughly translates to the following rules:

Rules
------
n1 >(+1) n3
n2 <(-1) n4
n5 <(-1) n3
n6 >(+1) n4
n2 + n3 = n1
nSUM = 30

And so, within Protegé, I've created the following ontological rules:

  • class: Number.
  • object property: isOneMoreThan, character: not sure, domain & range: Number
  • object property: isOneLessThan, character: not sure, domain & range: Number
  • individuals: n1, n2, n3, n4, n5, n6 (each having an assigned obj prop assertion of isOneMoreThan or isOneLessThan

But I'm not sure of two things:

  1. how do I know what object property characterizations to give my existing object properties?
  2. how do I model the Sum rules so that way [n2+n3]=n1 and [n1+n2+n3+n4+n5+n6]=30?
Kristian
  • 21,204
  • 19
  • 101
  • 176
  • 1
    "is one more than" should not be transitive. After all, 7 is one more than 6, and 6 is one more than 5, but 7 is not one more than 5. (I assume that "one more than" was intended as "successor" or "exactly one more than", and not as "At least one more than".) The same kind of thing applies to "is one less than". These properties could, of course, be *functional*. – Joshua Taylor Jan 31 '15 at 22:06
  • 1
    In general though, this kind of numeric reasoning won't be easy, if possible at all, in OWL. The sum, for instance, is really a tertiary relation, sum(2,3,5), for instance. – Joshua Taylor Jan 31 '15 at 22:09
  • @JoshuaTaylor that is precisely the question. is it possible to model a sum in OWL, and if not, how would it be done? SPIN? – Kristian Feb 02 '15 at 20:18
  • You'd generally represent a ternary relation by something like `e a Equation ; equand left, right. left a Sum ; hasSummands 2, 3, 4, 5 . right a Number ; value 5 .` That's just an example. However, you can use arithmetic in SWRL rules, so there might be a workaround there. – Joshua Taylor Feb 02 '15 at 20:28

1 Answers1

1

I don't think that you can get this to work with current OWL reasoners, but you can come close with SWRL rules (though I still think you can't quite get it to work). Here's the approach that I would take.

  1. Declare a data property hasValue with range xsd:int[≥0,≤9].
  2. Declare a class Digit as a subclass of hasValue exactly 1
    • This means that every digit has a value between 0 and 9, inclusive.
  3. Declare Digit individuals, first, second, third, fourth, fifth, and sixth.
  4. Add a bunch of SWRL rules that specify the various constraints:

    1. hasValue(third,?x) &wedge; swrlb:add(?y,?x,?1) &rightarrow; hasValue(first,?y)
      • first is one more than the third
    2. hasValue(fourth,?x) &wedge; swrlb:subtract(?y,?x,?1) &rightarrow; hasValue(second,?y)
      • second is one less than the fourth
    3. and so on, possibly adding rules in the other direction, too (e.g., for 1., you'd also have hasValue(first,?y) &wedge; swrlb:subtract(?x,?y,?1) &rightarrow; hasValue(third,?x).

If you're really lucky, a reasoner might try to assign the hasValue values for the individuals and would be forced into a correct assignment based on the SWRL rules. What's probably more likely is that you'd have to start trying some values and let the reasoner rule out the inconsistent ones.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353