Difference between revisions of "Description Logic"

From BC$ MobileTV Wiki
Jump to: navigation, search
Line 9: Line 9:
 
man('homer').
 
man('homer').
 
woman('marge').
 
woman('marge').
 +
lastname('simpson').
 
hasSon('homer','bart').
 
hasSon('homer','bart').
 
hasSon('marge','bart').
 
hasSon('marge','bart').
Line 15: Line 16:
 
hasDaughter('homer','maggie').
 
hasDaughter('homer','maggie').
 
hasDaughter('marge','maggie').
 
hasDaughter('marge','maggie').
hasPet('simpsons','santas little helper').
+
dog('santas little helper').
 +
hasPet('simpson','santas little helper').
 
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).
 +
isFemale(?x) :- doe(?x).
 
isMale(?y) :- hasSon(?x,?y).
 
isMale(?y) :- hasSon(?x,?y).
isFamily('') :- hasSon(?x,?y).
+
isFamily(?x) :- married(?x,?y).
isFamily('') :- hasDaughter(?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) :- hasPet(?x,?y).
 
</pre>
 
</pre>
  
'''QUERY'''
+
'''EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart is male from "son" relationship)'''
 
<pre>
 
<pre>
 
?-isMale(?x).
 
?-isMale(?x).
 +
</pre>
 +
 +
 +
'''EXAMPLE QUERY #2 - Who has a son? (Explicitly stated)'''
 +
<pre>
 +
?-hasSon(?x).
 +
</pre>
 +
 +
 +
'''EXAMPLE QUERY #3 - Who are in the Simpson family? (infered from son/daughter/marriage reciprocal relationships)'''
 +
<pre>
 +
?-isFamily(?x).
 +
</pre>
 +
 +
 +
'''EXAMPLE QUERY #4 - Who are in the Simpson's "extended" family? (infered from family relationship and Pets, Grandparents, etc)'''
 +
<pre>
 +
?-isFamily(?x).
 
</pre>
 
</pre>
  

Revision as of 01:54, 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

man('homer').
woman('marge').
lastname('simpson').
hasSon('homer','bart').
hasSon('marge','bart').
hasDaughter('homer','lisa').
hasDaughter('marge','lisa').
hasDaughter('homer','maggie').
hasDaughter('marge','maggie').
dog('santas little helper').
hasPet('simpson','santas little helper').
married('homer','marge').
isMale(?x) :- man(?x).
isFemale(?x) :- woman(?x).
isMale(?x) :- dog(?x).
isFemale(?x) :- doe(?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) :- hasPet(?x,?y).

EXAMPLE QUERY #1 - Which Simpsons are male? (infers that Bart is male from "son" 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 in the Simpson's "extended" family? (infered from family relationship and Pets, Grandparents, etc)

?-isFamily(?x).



Tools


Resources


Tutorials


External Links

References

  1. http://iris-reasoner.org/demo

See Also

Rule Engine | Semantic Web | AI | Machine Learning