Difference between revisions of "Description Logic"

From BC$ MobileTV Wiki
Jump to: navigation, search
Line 1: Line 1:
 
'''D'''escription '''L'''ogic (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.
 
'''D'''escription '''L'''ogic (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 ==
 +
 +
* Prolog syntax: http://rigaux.org/language-study/syntax-across-languages-per-language/Prolog.html<ref>[[wikipedia: Prolog syntax and semantics]]</ref>
 +
* IRIS Syntax: http://iris-reasoner.org/syntax
 +
* POSL - Positional Slotted Language syntax: http://ruleml.org/submission/ruleml-shortation.html
  
  
Line 7: Line 14:
 
'''FACTS - Simpson Family tree'''
 
'''FACTS - Simpson Family tree'''
 
<pre>
 
<pre>
 +
lastname('simpson').
 +
lastname('bouvier').
 
man('homer').
 
man('homer').
 
woman('marge').
 
woman('marge').
 
dog('santas little helper').
 
dog('santas little helper').
 
kitty('snowball II').
 
kitty('snowball II').
lastname('simpson').
 
lastname('bouvier').
 
 
hasFather('homer','abe').
 
hasFather('homer','abe').
 
hasMother('marge','jacqueline').
 
hasMother('marge','jacqueline').
Line 27: Line 34:
 
hasPet('simpson','santas little helper').
 
hasPet('simpson','santas little helper').
 
hasPet('simpson','snowball II').
 
hasPet('simpson','snowball II').
married('homer','marge').
+
areMarried('homer','marge').
 
isMale(?x) :- man(?x).
 
isMale(?x) :- man(?x).
 
isFemale(?x) :- woman(?x).
 
isFemale(?x) :- woman(?x).
Line 35: Line 42:
 
isFemale(?x) :- kitty(?x).
 
isFemale(?x) :- kitty(?x).
 
isMale(?y) :- hasSon(?x,?y).
 
isMale(?y) :- hasSon(?x,?y).
isFamily(?x) :- married(?x,?y).
+
isUncle(?y,?z) :- hasBrother(?x,?y), hasSon(?x,?z).
isFamily(?y) :- married(?x,?y).
+
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).
 +
isFamily(?x) :- areMarried(?x,?y).
 +
isFamily(?y) :- areMarried(?x,?y).
 
isFamily(?y) :- hasSon(?x,?y).
 
isFamily(?y) :- hasSon(?x,?y).
 
isFamily(?y) :- hasDaughter(?x,?y).
 
isFamily(?y) :- hasDaughter(?x,?y).
isFamily(?x) :- lastname(?x).
 
 
isExtendedFamily(?x) :- isFamily(?x,?y).
 
isExtendedFamily(?x) :- isFamily(?x,?y).
 
isExtendedFamily(?x) :- isGrandfather(?x,?y).
 
isExtendedFamily(?x) :- isGrandfather(?x,?y).
Line 45: Line 55:
 
isExtendedFamily(?x) :- isAunt(?x,?y).
 
isExtendedFamily(?x) :- isAunt(?x,?y).
 
isExtendedFamily(?x) :- isUncle(?x,?y).
 
isExtendedFamily(?x) :- isUncle(?x,?y).
isExtendedFamily(?x) :- hasPet(?x,?y).
+
isExtendedFamily(?y) :- hasPet(?x,?y).
 
</pre>
 
</pre>
  

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

lastname('simpson').
lastname('bouvier').
man('homer').
woman('marge').
dog('santas little helper').
kitty('snowball II').
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').
areMarried('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).
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).
isFamily(?x) :- areMarried(?x,?y).
isFamily(?y) :- areMarried(?x,?y).
isFamily(?y) :- hasSon(?x,?y).
isFamily(?y) :- hasDaughter(?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(?y) :- 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. wikipedia: Prolog syntax and semantics
  2. http://iris-reasoner.org/demo

See Also

Rule Engine | Semantic Web | AI | Machine Learning