I'm a new-comer to OpenCyc, and to start off, I'm trying to compute the distances between "features". For example, lets say I have two orange construction cones in a one dimentional world, with specified coordinates: I want to know how far apart they are.
I've been playing with this for two days now, and I haven't gotten it to work. I'll post my "code" below, and I'd appreciate any insight as to why it's not working.
Assert (#$isa Feature Collection)
Assert (#$isa #$Cone1 #$Feature)
Assert (#$isa #$Cone2 #$Feature)
Assert (#$isa Location AsymmetricBinaryPredicate)
Assert (#$arg1Isa Location Feature)
Assert (#$arg2Isa Location RealNumber)
Assert (#$Location #$Cone1 50)
Assert (#$Location #$Cone2 25)
Assert (#$isa DistanceBetweenFeatures TernaryPredicate)
Assert (#$arg1Isa DistanceBetweenFeatures RealNumber)
Assert (#$arg2Isa DistanceBetweenFeatures Feature)
Assert (#$arg3Isa DistanceBetweenFeatures Feature)
Assert (#$implies (and
(Location ?THING1 ?LOC1)
(Location ?THING2 ?LOC2)
(evaluate ?DIST (AbsoluteValueFn (DifferenceFn ?LOC1 ?LOC2))))
(DistanceBetweenFeatures ?DIST ?THING1 ?THING2))
All the above gets entered into the KB nicely, but when I try to test the DistanceBetweenFeatures predicate, it exhausts all paths before it comes up with an answer. I've tried the following:
Ask (#$DistanceBetweenFeatures ?DIST #$Cone1 #$Cone2)
Ask (#$DistanceBetweenFeatures 25 #$Cone1 #$Cone2)
The problem was that the Cones didn't have a slot for storing location.
If you queried thier location, they didn't have any.
Ask (Location Cone1 ?LOC1)
Didn't return anything
The problem was the Cones were not correctly defined. It turns out that cyc has a exiting collection: Cone
So I also defined them:
Assert (isa Cone1 Cone)
Assert (isa Cone2 Cone)
Once I defined them as Cone then I got this query to work:
(Location Cone1 ?LOC1)
(Location Cone2 ?LOC2)
(DifferenceFn ?LOC1 ?LOC2))))
I am also new to cyc too, but I think your predicate function is not fully defined.
I have been trying to figure out how to add values to the instances and haven't quite figured it out yet.
Please post your code once you get it fully working. There is not enough examples of cyc code to use as examples. You should probably also create a microTheory to put your stuff in when functional.
- Tom aka nanoguy
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.