Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rustam Mehmandarov — Semantic Wizardry, Logic [Zebra] Puzzles, and Java

Rustam Mehmandarov — Semantic Wizardry, Logic [Zebra] Puzzles, and Java

What is it all about? Ever heard of Zebra Puzzles?
Those logical puzzles that are claimed to be invented by Albert Einstein as a little boy?
Those that are based on simple logical facts and go something like this: “The Brit lives in the Red house. The Swede keeps dogs as pets. The Dane drinks tea… Who owns the zebra?”

Some claim that only 2% of the population can solve it without any help.
However, with the help of semantic technologies, we can solve it in (almost) no time.

Of course, you have to know RDF, OWL, Jena, reasoning, inference.
The good news is that I will be showing you how it works in this session.
Later, I will also post a link to the code for the rest of you to try all that at home.

3fc5b5eb32bd3b48d7810fd67b37f9a1?s=128

Moscow JUG

April 05, 2018
Tweet

Transcript

  1. Semantic Wizardry, Logic [Zebra] Puzzles, and Java Rustam Mehmandarov @RMehmandarov

  2. @RMEHMANDAROV 2 ABOUT ME

  3. @RMEHMANDAROV 3 I am Rustam Mehmandarov HELLO!

  4. @RMEHMANDAROV ABOUT YOU 4

  5. @RMEHMANDAROV AGENDA 5

  6. @RMEHMANDAROV 6

  7. @RMEHMANDAROV THE PUZZLE 1. There are five houses. 2. The

    Englishman lives in the red house. 3. The Spaniard owns the dog. 4. Coffee is drunk in the green house. 5. The Ukrainian drinks tea. 6. The green house is immediately to the right of the ivory house. 7. The Fuji owner owns snails. 8. The Giant owner lives in the yellow house. 9. Milk is drunk in the middle house. 10. The Norwegian lives in the first house. 11. The man who owns Kona lives in the house next to the man with the fox. 12. The Giant owner lives in a house next to the house where the horse is kept. 13. The Scott owner drinks orange juice. 14. The Japanese owns Trek. 15. The Norwegian lives next to the blue house. Now, who drinks water? Who owns the zebra? 7
  8. @RMEHMANDAROV THE PUZZLE ? 8

  9. @RMEHMANDAROV 9 AGENDA • Theory in general • Semantic technologies

    – RDF – OWL – Reasoning
  10. @RMEHMANDAROV SEMANTICS LOVES 10

  11. @RMEHMANDAROV SEMANTICS LOVES Subject Object Predicate TRAVELS TO 11

  12. @RMEHMANDAROV RDF, RDFS, OWL RDF RDFS OWL Vocabulary Data Interchange

    + rdfs:Class rdfs:subClassOf rdfs:domain / rdfs:range + owl:Restriction owl:intersectionOf owl:equivalentClass 12
  13. @RMEHMANDAROV SYNTAX EXPLAINED QName URIs (with prefixes) Namespaces Blank Nodes

    13
  14. @RMEHMANDAROV RDF GRAPHS 14

  15. @RMEHMANDAROV REASONING 15

  16. @RMEHMANDAROV EXAMPLES 16

  17. @RMEHMANDAROV EXAMPLE 1 1. Read a simple "Hello, World!" statement

    in RDF (in Turtle format) from file. 2. Print all individuals in the model with Jena. 3. Verify that we have only one individual that looks like this: (:Joe :hasSentMessage 'Hello World!'^^http://www.w3.org/2001/XMLSchema#string) 4. Achievement unlocked! 17
  18. @RMEHMANDAROV THE TURTLE FILE 18

  19. @RMEHMANDAROV 19

  20. @RMEHMANDAROV EXAMPLE 2 1. Recreate the model from Exercise 1

    with Jena 2. Print the model in RDF (TTL) => Same as Exercise 1 3. Achievement unlocked! Jena level 1. The basics of Jena mastered you have, young Padawan. 20
  21. @RMEHMANDAROV 21

  22. @RMEHMANDAROV MORE REASONING AND JENA Frank Mammal Anna Human is

    is hasChild domain 22
  23. @RMEHMANDAROV MORE REASONING AND JENA 23

  24. @RMEHMANDAROV THE PUZZLE DEMO 25

  25. @RMEHMANDAROV WANT TO TRY IT YOURSELF? Code: https://github.com/mehmandarov/ zebra-puzzle-workshop 26

  26. @RMEHMANDAROV 27 Any questions ? • @RMehmandarov • rm@computas.com •

    https://mehmandarov.com THANKS!