Difference between revisions of "Description Logic"

From BC$ MobileTV Wiki
Jump to: navigation, search
Line 12: Line 12:
 
== EXAMPLE ==
 
== EXAMPLE ==
  
'''FACTS - Simpson Family tree'''<ref>Simpson's Familyhttp://en.wikipedia.org/wiki/Simpson_family</ref>
+
'''FACTS - Simpson Family tree'''<ref>The Simpson's Family tree: http://en.wikipedia.org/wiki/Simpson_family</ref>
 
<pre>
 
<pre>
 
lastname('simpson').
 
lastname('simpson').

Revision as of 02:52, 11 May 2011

Description Logic (commonly abbreviated DL) is a set of mathematical rules and expressions for describing an action or set of outcomes, based on a particular set of inputs, as defined by principles of mathematical.


Specifications


EXAMPLE

FACTS - Simpson Family tree[2]

lastname('simpson').
lastname('bouvier').
man('homer').
woman('marge').
dog('santas little helper').
kitty('snowball II').
hasFather('homer','abe').
hasMother('homer','mona').
hasFather('marge','clancy').
hasMother('marge','jacqueline').
hasBrother('homer','herb').
hasSister('marge','patty').
hasSister('marge','selma').
hasSon('homer','bart').
hasSon('marge','bart').
hasAdoptedDaughter('selma','ling').
hasDaughter('homer','lisa').
hasDaughter('marge','lisa').
hasDaughter('homer','maggie').
hasDaughter('marge','maggie').
hasMaidenName('marge','bouvier').
hasPet('simpson','santas little helper').
hasPet('simpson','snowball II').
areMarried('homer','marge').
isUncle(?y,?z) :- hasBrother(?x,?y), hasSon(?x,?z).
isAunt(?y,?z) :- hasSister(?x,?y), hasDaughter(?x,?z).
isGrandfather(?y,?z) :- hasFather(?x,?y), hasSon(?x,?z).
isGrandmother(?y,?z) :- hasMother(?x,?y), hasDaughter(?x,?z).
isMale(?x) :- man(?x).
isFemale(?x) :- woman(?x).
isMale(?x) :- dog(?x).
isFemale(?x) :- bitch(?x).
isMale(?x) :- cat(?x).
isFemale(?x) :- kitty(?x).
isMale(?y) :- hasSon(?x,?y).
isFemale(?y) :- hasDaughter(?x,?y).
isMale(?y) :- hasAdoptedSon(?x,?y).
isFemale(?y) :- hasAdoptedDaughter(?x,?y).
isMale(?y) :- hasBrother(?x,?y).
isFemale(?y) :- hasSister(?x,?y).
isMale(?y) :- hasFather(?x,?y).
isFemale(?y) :- hasMother(?x,?y).
isFamily(?x) :- areMarried(?x,?y).
isFamily(?y) :- areMarried(?x,?y).
isFamily(?y) :- hasSon(?x,?y).
isFamily(?y) :- hasDaughter(?x,?y).
isExtendedFamily(?y) :- isFamily(?x,?y).
isExtendedFamily(?y) :- hasAdoptedSon(?x,?y).
isExtendedFamily(?y) :- hasAdoptedDaughter(?x,?y).
isExtendedFamily(?y) :- isGrandfather(?x,?y).
isExtendedFamily(?y) :- isGrandmother(?x,?y).
isExtendedFamily(?y) :- isAunt(?x,?y).
isExtendedFamily(?y) :- isUncle(?x,?y).

EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart, Homer, Abe, Herb, Santa's Little Helper are male from "son", ,"uncle", "grandfather" relationships, as well as "man" and "dog" fact)

?-isMale(?x).


EXAMPLE QUERY #2 - Who has a son? (Explicitly stated)

?-hasSon(?x).


EXAMPLE QUERY #3 - Who are in the Simpson family? (infered from son/daughter/marriage reciprocal relationships)

?-isFamily(?x).


EXAMPLE QUERY #4 - Who are the Simpson's pets? (Explicity stated)

?-isPet('simpson').


EXAMPLE QUERY #5 - Who are in the Simpson's "extended" family? (infered from family relationship and Pets, Grandparents, etc)

?-isExtendedFamily(?x).



Tools


Resources


Tutorials


External Links

References

  1. wikipedia: Prolog syntax and semantics
  2. The Simpson's Family tree: http://en.wikipedia.org/wiki/Simpson_family
  3. http://iris-reasoner.org/demo

See Also

Rule Engine | Semantic Web | AI | Machine Learning