Difference between revisions of "Description Logic"

From BC$ MobileTV Wiki
Jump to: navigation, search
Line 5: Line 5:
 
== EXAMPLE ==
 
== EXAMPLE ==
  
'''FACTS'''
+
'''FACTS - Simpson Family tree'''
 
<pre>
 
<pre>
 
man('homer').
 
man('homer').
 
woman('marge').
 
woman('marge').
 +
dog('santas little helper').
 +
kitty('snowball II').
 
lastname('simpson').
 
lastname('simpson').
 +
lastname('bouvier').
 +
hasFather('homer','abe').
 +
hasMother('marge','jacqueline').
 +
hasBrother('homer','herb').
 +
hasSister('marge','patty').
 +
hasSister('marge','selma').
 
hasSon('homer','bart').
 
hasSon('homer','bart').
 
hasSon('marge','bart').
 
hasSon('marge','bart').
Line 16: Line 24:
 
hasDaughter('homer','maggie').
 
hasDaughter('homer','maggie').
 
hasDaughter('marge','maggie').
 
hasDaughter('marge','maggie').
dog('santas little helper').
+
hasMaidenName('marge','bouvier').
 
hasPet('simpson','santas little helper').
 
hasPet('simpson','santas little helper').
 +
hasPet('simpson','snowball II').
 
married('homer','marge').
 
married('homer','marge').
 
isMale(?x) :- man(?x).
 
isMale(?x) :- man(?x).
 
isFemale(?x) :- woman(?x).
 
isFemale(?x) :- woman(?x).
 
isMale(?x) :- dog(?x).
 
isMale(?x) :- dog(?x).
isFemale(?x) :- doe(?x).
+
isFemale(?x) :- bitch(?x).
 +
isMale(?x) :- cat(?x).
 +
isFemale(?x) :- kitty(?x).
 
isMale(?y) :- hasSon(?x,?y).
 
isMale(?y) :- hasSon(?x,?y).
 
isFamily(?x) :- married(?x,?y).
 
isFamily(?x) :- married(?x,?y).
Line 30: Line 41:
 
isFamily(?x) :- lastname(?x).
 
isFamily(?x) :- lastname(?x).
 
isExtendedFamily(?x) :- isFamily(?x,?y).
 
isExtendedFamily(?x) :- isFamily(?x,?y).
 +
isExtendedFamily(?x) :- isGrandfather(?x,?y).
 +
isExtendedFamily(?x) :- isGrandmother(?x,?y).
 +
isExtendedFamily(?x) :- isAunt(?x,?y).
 +
isExtendedFamily(?x) :- isUncle(?x,?y).
 
isExtendedFamily(?x) :- hasPet(?x,?y).
 
isExtendedFamily(?x) :- hasPet(?x,?y).
 
</pre>
 
</pre>
  
'''EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart is male from "son" relationship)'''
+
'''EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart and Santa's Little Helper are male from "son" and "dog" relationship)'''
 
<pre>
 
<pre>
 
?-isMale(?x).
 
?-isMale(?x).
Line 51: Line 66:
  
  
'''EXAMPLE QUERY #4 - Who are in the Simpson's "extended" family? (infered from family relationship and Pets, Grandparents, etc)'''
+
'''EXAMPLE QUERY #4 - Who are the Simpson's pets? (Explicity stated)'''
 
<pre>
 
<pre>
?-isFamily(?x).
+
?-isPet('simpson').
 +
</pre>
 +
 
 +
 
 +
'''EXAMPLE QUERY #5 - Who are in the Simpson's "extended" family? (infered from family relationship and Pets, Grandparents, etc)'''
 +
<pre>
 +
?-isExtendedFamily(?x).
 
</pre>
 
</pre>
  

Revision as of 02:10, 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.


EXAMPLE

FACTS - Simpson Family tree

man('homer').
woman('marge').
dog('santas little helper').
kitty('snowball II').
lastname('simpson').
lastname('bouvier').
hasFather('homer','abe').
hasMother('marge','jacqueline').
hasBrother('homer','herb').
hasSister('marge','patty').
hasSister('marge','selma').
hasSon('homer','bart').
hasSon('marge','bart').
hasDaughter('homer','lisa').
hasDaughter('marge','lisa').
hasDaughter('homer','maggie').
hasDaughter('marge','maggie').
hasMaidenName('marge','bouvier').
hasPet('simpson','santas little helper').
hasPet('simpson','snowball II').
married('homer','marge').
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).
isFamily(?x) :- married(?x,?y).
isFamily(?y) :- married(?x,?y).
isFamily(?y) :- hasSon(?x,?y).
isFamily(?y) :- hasDaughter(?x,?y).
isFamily(?x) :- lastname(?x).
isExtendedFamily(?x) :- isFamily(?x,?y).
isExtendedFamily(?x) :- isGrandfather(?x,?y).
isExtendedFamily(?x) :- isGrandmother(?x,?y).
isExtendedFamily(?x) :- isAunt(?x,?y).
isExtendedFamily(?x) :- isUncle(?x,?y).
isExtendedFamily(?x) :- hasPet(?x,?y).

EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart and Santa's Little Helper are male from "son" and "dog" relationship)

?-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. http://iris-reasoner.org/demo

See Also

Rule Engine | Semantic Web | AI | Machine Learning