# Threaded queries? Rulebase independence?

**URL:** <https://swi-prolog.discourse.group/t/threaded-queries-rulebase-independence/1236>\
**Category:** Help!\
**Created:** [September 11, 2019, 11:27pm UTC](https://swi-prolog.discourse.group/t/threaded-queries-rulebase-independence/1236 "2019-09-11T23:27:13Z")\
**Posts on this page:** 1\
**Showing post:** 24

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 6, 2020, 9:12am UTC](https://swi-prolog.discourse.group/t/threaded-queries-rulebase-independence/1236/24 "2020-05-06T09:12:00Z")

</div>

> [@jan](#):
>
> Use the SWI-Prolog stack introspection to get some goal on the stack from which we can derive _self_ .

Here is a demo of the idea to manage _self_ on the stack. Start as

```
swipl oo.pl facts.pl
?- facts::rule(X).
X = yip.

```

[oo.pl](https://swi-prolog.discourse.group/uploads/short-url/gn19IzwIJJ6t0EYuulWrbDic5Nz.pl) (423 Bytes) [facts.pl](https://swi-prolog.discourse.group/uploads/short-url/qIyoycsdbHFg8iT99UtghQK4wSk.pl) (66 Bytes) [rules.pl](https://swi-prolog.discourse.group/uploads/short-url/8vRf2Pw6CBuftMsWKejDVPJWbQ6.pl) (96 Bytes)

---

_[View the full topic](https://swi-prolog.discourse.group/t/threaded-queries-rulebase-independence/1236)._
