Re: error out of global stack prolog
Jan Wielemaker <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 01/09/2014 10:10 AM, Wouter Beek wrote: > 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? If you want a precise number, ?- aggregate_all(count, rdf(_,_,_), Triples). is the only way. The statistics give you only an approximation. There is an internal notion of `possible duplicates' that would help here, but after removing g2, the triple in g1 is still marked as a `possible duplicate'. Note that transaction and snapshot isolation make the global notion of the number of triples rather complicated. The `triples' statistics contains all triples in all existing `worlds'. In a particular snapshot, you may see fewer. But, I don't think that the precise number of triples is a very interesting property of an RDF graph. Cheers --- Jan > > --- > Cheers!, > Wouter Beek. > > E-mail: [email protected] <mailto:[email protected]> > WWW: www.wouterbeek.com <http://www.wouterbeek.com> > Tel.: 0647674624 > > > On Thu, Jan 9, 2014 at 9:56 AM, Wielemaker, J. <[email protected] > <mailto:[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] > <mailto:[email protected]> > > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > > > _______________________________________________ > SWI-Prolog mailing list > [email protected] > <mailto:[email protected]> > https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog > >