JPL7,序言查询中的字符串列表

JPL7, list of strings in prolog-query

我有一个序言查询,它需要一个数组作为原子:

searchEventsOnCategory(类别、事件) Categories 是一个字符串列表。

示例输入: searchEventsOnCategory(['Bar','Disco'],事件)

输出: 事件 = [listOfEvents]

searchEventsOnCategory(Categories,Events):-
    findall([X,V], event(X,_,_,V), List),
    compareCategories(List,Categories,Events1),
    Events = Events1.

我的 java-代码是:

public ArrayList<String> getEventsByPrologWithCategories(ArrayList<String> Categories){
    ArrayList<String> events = new ArrayList<String>();

    //(Persons,Budget,Categories,Events)
    Variable X = new Variable("X");
    Compound V = new Compound("[Bar]");

    Query q4 =
            new Query(
                "searchEventsOnCategory",
                new Term[] {V,X}
            );

    ... 

    return events;

}

我如何设计 V,prolog 将 V 作为字符串列表获取?

您应该使用 Term

而不是 Compound
Variable X = new Variable("X");

Term t = Util.textToTerm("[Bar]");

Query q4 =
    new Query(
        "searchEventsOnCategory",
        new Term[] {t,X}
        );