docs← Back to article

Markdown for LLMs

Who produces and who reads a predicate

The source Markdown for this article. Copy it into your assistant or download it as a text file.

Download this articlePlain text ↗
# Who produces and who reads a predicate

Two questions answer most investigations into a model: which rules conclude a predicate, and which bodies mention it. The first query lists the heads with their strength and anchors; the second lists the body uses outside heads, across packages when the scope is a glob.

```lawq
from r in corpus("demo.lawqlbase").rules
where r.head_predicate == "urn:law:demo:lawqlbase#eligible"
select r.id as producer, r.strength as strength, anchor(r.id) as anchors
```

```lawq
from l in corpus("demo.lawql*").literals
where l.predicate == "urn:law:demo:lawqlbase#eligible" and l.context != "head"
select l.node as reader, l.package as package, l.context as context
```

The same two questions are stored ready-made in the catalog: producers takes a predicate and a package, readers takes a predicate and a package or a glob, and shows reads from other packages. The [questions](/lawql/questions/producers/) page lists both with their parameters.