Re: error out of global stack prolog

Wouter Beek <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <CAE1un7Pmr+TfVtrhbjket=_WrGOxnFXHDeKzjWmGGVnMvperqw@mail.gmail.com>
Hi Batselem, Jan,

It's not straightforward how one would calculate the number of distinct
triples accros multiple graphs, e.g.:
~~~
?- rdf_assert(rdf:a, rdf:b, rdf:c, g1).
?- rdf_assert(rdf:a, rdf:b, rdf:c, g2).
?- rdf_statistics(triples(T)).
T = 2.
~~~
Or is there another way?

---
Cheers!,
Wouter Beek.

E-mail: [email protected]
WWW: www.wouterbeek.com
Tel.: 0647674624


On Thu, Jan 9, 2014 at 9:56 AM, Wielemaker, J. <[email protected]> wrote:

> On 01/09/2014 01:59 AM, atom meta wrote:
> > Hi, I am currently learning Prolog. when I apply a query such as
> >  findall(A, rdf(A,_,_), Y), length(Y, L), prolog throws out of global
> > stack, error. How could I fix this problem?
>
> You are creating a list with all subjects.  If you have a really big
> RDF store, that costs a lot of memory.  There are some options:
>
>   - Raise the stack limit using set_prolog_stack/2.
>   - Use aggregate_all(count, rdf(_,_,_), Triples).
>   - Use rdf_statistics(triples(Triples)).
>
> For really counting the triples, the latter is the best (it just
> looks up the number that is maintained in the store).  In similar
> cases you may need to do one of the first two.
>
>         Success --- Jan
>
> >
> > Thank you,
> > Batselem Jagvaral
> >
> >
> >
> >
> > 2 ?- findall(A, rdf(A,_,_), Y), length(Y, L).ERROR: Out of global stack
> >    Call: (13) rdf_db:rdf_update_duplicates_thread ? No previous search
> >    Call: (13) rdf_db:rdf_update_duplicates_thread ? No previous search
> >    Call: (13) rdf_db:rdf_update_duplicates_thread ? creep
> > ^  Call: (14) thread_create(rdf_update_duplicates, _G75, [detached(true),
> > alias('__rdf_duplicate_detecter')]) ? creep
> > ^  Exit: (14) thread_create(rdf_update_duplicates,
> > '__rdf_duplicate_detecter', [detached(true),
> > alias('__rdf_duplicate_detecter')]) ?
> >    Call: (1) rdf_db:rdf_update_duplicates ? creep
> > |:
> >    Exit: (13) rdf_db:rdf_update_duplicates_thread ?
> > -------------- next part --------------
> > HTML attachment scrubbed and removed
> > _______________________________________________
> > SWI-Prolog mailing list
> > [email protected]
> > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
> >
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
>
-------------- next part --------------
HTML attachment scrubbed and removed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.