|
Here's a crazy example that's been on my mind lately. Imagine that we've expressed a poker hand in RDF. I'm going to be flexible as to exactly how it's done, but an RDF list would work.
in this case, I want to infer
I'd like to have types that correspond to the types of hands that occur in poker.
if :someOtherHand is, say, a pair of :Queen(s). I'm happy to see any method of inference used, and as mentioned before, if you can do it with a :Bag or using a property to represent hand membership, that's find with me too. Of course, a complete working system is a lot to ask, but a rough design would count towards a useful answer |
|
It's an absolute cinch with OWL 2: Semantics of the cards first:
A little glue:
...and then you're ready to define some semantics to classify different hands:
And then defining the ordering of different (strict) hands is a piece of cake using the principle of "All Elephants are Bigger Than All Mice"... in this case, all ...see, it's a cinch. 1
:beats is a little more complicated than that... A pair of Jacks beat a pair of Sevens, for instance. However, that's a great answer! 1
And for all who consider doing real reasoning based on this with their favorite OWL reasoner, let me tell you that OWL inferencing can easily become something like a Poker game! ;-) ...ack, true yep. High card doesn't cut it, but a little bit more axiom-wrangling to define high-pairs, high-trips and high-quads and you'd get there (eventually). There's no doubt a few bugs in the above sketch, and shortcuts might be possible, but given a week or so I'm fairly sure a full solution is feasible, at least in OWL 2 Full. The one concern I'd have is the definition of ...a more practical problem would be finding a reasoner smart enough to classify hands. (Sticking to OWL 2 DL would be very beneficial here.... otherwise maybe @Michael might have a solution... http://www.springerlink.com/content/2x4p65l6k4pv6885/) Maybe! :-) Fact is, that I haven't applied this OWL Full implementation approach to such a complex "real-world" application so far. ;-) Maybe I'll find some time to apply the approach to your axiomatization (after its completion, and after ISWC, I'm too busy now). Man, automatic reasoning for Poker gaming... I guess, that's where the money goes, eventually! ;-) 1
...was actually wondering last night if doing a full ontology and classifier (using an existing reasoner) for poker hands in OWL would be publishable... might be a bit of fun... who's in? :) 3
Could become a classic representer of the category "problems for which there are tons of solutions using traditional software development approaches which can also be solved via sophisticated Semantic Web reasoning". ;-) @Michael I'm interested in this because I want to replace a mess of internal and external DSLs with something that's standardized. I might to easily change my Poker A.I. to play 'Dealers Choice' or update a system to next year's tax code... The thing I do know is that RDF data is going into the system, so I need some powerful way to express rules over it.
showing 5 of 10
show 5 more comments
|
|
Ok so here's my attempt at doing this with just RDF and SPARQL. Here's my sample data:
Firstly checking we have a valid hand:
We can use SELECT queries to determine what hand you have e.g. pairs, three of a kind or four of a kind
Full house starts to get a bit more complicated since we're looking for a pair and a 3 of a kind. We can do this by using the previous query as a subquery and then using an
Flushes are relatively simple:
Straights are again a bit harder, note that the desired count is 4 and not 5 since the highest card in the straight will not have a card above it in the hand:
From this you could work up to queries that determine whose hand is better though I don't have time to do this right now, may add more later when I have more time... |

