So I have a set of facts and a query written in ASP to be run on DLV,
%Q1 : Find the implicit "is_a" relationship between terms
%ex: if term A is is_a term B, term B is_a term C, then term A is_a term C
%is_a One level
triple1(TermA, "go:is_a", TermB):- triple(TermA, "go:is_a", TermB), TermA != TermB.
%is_a MultiLevel
triple1(TermA, "go:is_a", TermC) :-
triple(TermA, "go:is_a", TermB),
triple(TermB, "go:is_a", TermC),
TermA != TermC.
triple1(TermA, "go:is_a", TermC) :-
triple1(TermA, "go:is_a", TermB),
triple1(TermB, "go:is_a", TermC),
TermA != TermC.
then I want to count how many of triple1
triples are in my answer set not included the facts. then I made this kind of aggregate #count query:
triple1nr(X) :- #count{TermA : triple1(TermA,"go:is_a",TermC)} = X.
but what I obtained was only the number of variable TermA
appear as my result. And when I changed my query as this:
triple1nr(X) :- #count{triple1(TermA,"go:is_a",TermC)} = X.
it gives me error. How should I do this query?