working with sets

  • I am using ResearchCyc 4.0p.

    When I run the following query:
    (relatedToVia Cat Dog (TheSet genls) 2)
    it quickly returns True.

    However, when I run the following query:
    (#$relatedToVia #$Dog #$Cat
    (#$TheSetOf ?Z
    (and (#$isa ?Z #$TaxonomicSlotForCollections) (isa ?Z Basics-Fundamental-Topic))) 2)

    it is not able to conclude that it is True, even though the phrase (TheSetOf ?Z ... ) is able to be quickly resolved into (TheSet genls).

    How can I create a set of predicates (for use with relatedToVia), besides explicitly listing each predicate I want in the set?

    Last edit: Douglas Summers-Stay 2014-06-30
  • relatedToVia does require that the predicates be enumerated, but you should be able to achieve what you want as follows:

    (thereExists ?SET 
        (evaluate ?SET 
             (TheSetOf ?Z
                 (isa ?Z TaxonomicSlotForCollections)
                 (isa ?Z Basics-Fundamental-Topic)))))
      (relatedToVia Dog Cat ?SET 2)))
  • Thanks, that was exactly what I needed.

  • I thought maybe someone would be interested to know you can use a similar method to count results:
    (thereExists SET
    (#$evaluate ?SET
    (#$TheSetOf ?Z
    (#$isa ?Z #$Dog))))
    (#$cardinality ?SET ?SIZE))