You could achieve this with ontologies. You can use Protege which is a free ontology editor equipped with reasoners to infer implicit knowledge. Specifying an ontology as follows will achieve the desired result:
ObjectProperty: hasOrientation
Domain: Object
Range: Orientation
ObjectProperty: isParallel
Domain: Object
Range: Surface
Class: Object
Class: Orientation
EquivalentTo: {Horizontal , Vertical}
Class: Pen
SubClassOf: Object
Class: Surface
EquivalentTo: {Ground , Rock , Wall}
Individual: Ground
Types: Surface
Individual: Horizontal
Types: Orientation
DifferentFrom: Vertical
Individual: Rock
Types: Surface
Individual: Vertical
Types: Orientation
DifferentFrom: Horizontal
Individual: Wall
Types: Surface
Individual: myPen
Types: Pen
Facts: isParallel Ground
Rule:
Pen(?aPen), isParallel(?aPen, Ground) -> hasOrientation(?aPen, Horizontal)
Pen(?aPen), isParallel(?aPen, Wall) -> hasOrientation(?aPen, Vertical)
The inference is achieved with Pen(?aPen), isParallel(?aPen, Ground) -> hasOrientation(?aPen, Horizontal)
which basically states that if aPen
is a Pen
and aPen
is in a isParallel
relation with Ground
then aPen
has a Horizontal
orientation.
As an aside, you may find this research of interest.