1

I am trying to run the prolog rules which are implemented in lisp. In the lisp code I am having the following problems:

  1. I query the persons from AG knowledgebase, the output is in string format such as

    "http://www.myweb.com/myns/Person1" "http://www.myweb.com/myns/Person2"

  2. I convert the above string into Resource as follows

(setq p1 (resource "http://www.myweb.com/myns/Person1"))

(setq p2 (resource "http://www.myweb.com/myns/Person2"))

After converting string to resource the output is like this:

!ns:Person1
!ns:Person2
  1. I take the above two persons (resource) and run the rule through query to find the relation between them. please note that p1 and p2 are known and ?relation is unknown variables. Query goes to AG knowlegebase and find the relation

    (select-distinct

    (p1 ?relation p2)

    (MyRulesfunction p1 ?relation p2)

    )

The problem is that when the query run in step 2 with select-distinct. it does not take the resource as arguments and complaining about UPI conversion. I have also tried with (value->upi) function to convert into UPI but was unsuccessful.

Can anyone please help me out? What format of p1 and p2 values I can pass in MyRulesfunction to find the relation. Your help would highly be appreciated. I have rule funtion defined as follows: ;; the rule for persons if both persons live in the same city

  (<--(MyrulesFunction ?p1 !ns:SameCityWith ?p2) 

  (q ?p1 !ns:hasCity ?city)
    (q ?p2 !ns:hasCity ?city)
    )
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
user3356568
  • 119
  • 2
  • 14

1 Answers1

0

This should do it:

(select-distinct ?relation (MyRulesFunction (?? p1) ?relation (?? p2)))

The '??' syntax marker is described in the documentation here. I know my answer is probably 5 years too late for the OP, but hope somebody will benefit.

osearbhain
  • 11
  • 1
  • 2