How to count for each element how many times it repeats in a list and display the element that repeats more than three times?

Hi, I tried to do it this way:

This is the list:

getListaTestimoniUdienza(ListaTestimone):- 
   findall(Y,testimonePartecipaudienza(Y,X),ListaTestimone).
?- getListaTestimoniUdienza(ListaTestimone).
ListaTestimone = [
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Pippo_Testimone', 
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Pippo_Testimone',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Sempronio_Testimone',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#TestimoneB',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Pippo_Testimone',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Pippo_Testimone',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Sempronio_Testimone',
'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#TestimoneB'
].

I’m trying to use this rule, but I can’t replace the various values:

count(_,[],0).
count(X,[X|T],N):-!,count(X,T,N1), N is N1+1.
count(X,[_|T],N):-count(X,T,N).

This kind of homework questions are more appropriate on StackOverflow, and please remember to post a MCVE question (that is, you should give us a testimonePartecipaudienza/2 subset to play with, insted of an useless ListaTestimone), but anyway…

getListaTestimoniUdienza(ListaTestimone):-
    findall(N*T,
            (aggregate(count, Y^testimonePartecipaudienza(Y,T), N),
             N >= 3
            ), ListaTestimone).
?- getListaTestimoniUdienza(L).
L = [4*'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Pippo_Testimone'].

Before asking more you should take some time to dig deeper into library(aggregate) and library(solution_sequences).

Ciao

OT (@EricGT, @jamesnvc)

Above I was expecting library(aggregate) to be linked to docs, more or less as I did manually for library(solution_sequences), given the recent work about the linkify plugin.
Is my expectation unrealistic, or plain wrong ?

thank you so much for your help, I needed it so much

A post was merged into an existing topic: Added Linkify words in post Theme

A post was merged into an existing topic: Added Linkify words in post Theme