From: <dm...@us...> - 2008-08-05 00:39:39
|
Change (NEW-CYC-QUERY (LIST #$isa ?X #$SpatialThing) #$PeopleDataMt (LIST :MAX-NUMBER 1)) to (NEW-CYC-QUERY (LIST #$isa '?X #$SpatialThing) #$PeopleDataMt (LIST :MAX-NUMBER 1)) Thats a single QUOTE on ?X Here are some other legal forms: (NEW-CYC-QUERY '(#$isa ?X #$SpatialThing) #$PeopleDataMt (LIST :MAX-NUMBER 1)) (NEW-CYC-QUERY (QUOTE (#$isa ?X #$SpatialThing)) #$PeopleDataMt ;; identical to the above (LIST :MAX-NUMBER 1)) (NEW-CYC-QUERY `(#$isa ?X #$SpatialThing) #$PeopleDataMt ;;; Backquote reader (LIST :MAX-NUMBER 1)) Here is probly the most prefered: (NEW-CYC-QUERY '(#$isa ?X #$SpatialThing) #$PeopleDataMt '(:MAX-NUMBER 1)) Here is a backquoted "`" way the backquote means to take the item litteral the "," in front of COL mean (EVAL COL) -> #$SpatialThing (CLET ((COL #$SpatialThing)(NUM 1)) (NEW-CYC-QUERY `(#$isa ?X ,COL) #$PeopleDataMt `(:MAX-NUMBER ,NUM))) ----- Original Message ----- From: Paul Fodor To: OpenCyc developers Sent: Monday, August 04, 2008 4:17 PM Subject: [OpenCyc-devel] Query for all instances of a predicate Dear Sir, I am a OpenCyc newbie and I have some questions that I could not figure out yet. If anyone has time and can respond to my questions, please let me know. Question 1: I access OpenCyc from Java and I wonder how can I query for all instances of a predicate or class. I want to collect a list of all results. For instance, I want to collect all spatial things: (#$isa ?X #$SpatialThing) or, I want to collect all pairs of people liking other people: (#$likesAsFriend ?X ?Y) For example, (NEW-CYC-QUERY (LIST #$isa #$BillClinton #$SpatialThing) #$PeopleDataMt (LIST :MAX-NUMBER 1)) works, but (NEW-CYC-QUERY (LIST #$isa ?X #$SpatialThing) #$PeopleDataMt (LIST :MAX-NUMBER 1)) tells me that ?X is unbound. Question 2: How do I collect this list in Java? Thank you, Paul. ------------------------------------------------------------------------------ ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ ------------------------------------------------------------------------------ _______________________________________________ OpenCyc-devel mailing list Ope...@li... https://lists.sourceforge.net/lists/listinfo/opencyc-devel |