Hy, to search for an element in a list I did it this way:
getListaPersoneUdienza(ListaPersone) :-
findall(Y,personaPartecipaudienza(X,Y),ListaPersone).
trovaElementoLista(X,[X|_]).
trovaElementoLista(X,[_ | ListaPersone]) :-
getListaPersoneUdienza(ListaPersone),trovaElementoLista(X,ListaPersone).
esempio(X) :-
getListaPersoneUdienza(ListaPersone),trovaElementoLista(X,ListaPersone).
where the list is:
ListaPersone = [_14722, 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AttoreA', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AvvocatoA', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AvvocatoB', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#CancelliereA', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Catello_Maresca', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#ConvenutoA', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#Ufficiale_GiudiziarioA', 'http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AttoreA'|...] ;
if I find :
?- esempio('http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AttoreA').
the result is right, but if I enter this:
?- esempio('http://www.semanticweb.org/luigi/ontologies/2020/2/untitled-ontology-11#AvvocatoB').
the result is false
, but it should be true
.