@@ -26,8 +26,9 @@ these), and the shape you write depends on which:
2626 don't write these; you load them and validate against them to check the model * uses*
2727 the ontology correctly. ` model.validate([brick.get_shape_collection()]) ` .
28282 . ** Manifest shapes** — your model's * standing* requirements: "this site has exactly 1
29- AHU, 1 supply fan, …". A manifest is a shape collection you associate with the model
30- via ` model.add_to_manifest(...) ` . Written with the ` constraint: ` vocabulary (below).
29+ AHU, 1 supply fan, …". You write them into a library and add that library to the
30+ model's manifest with ` model.manifest.add(lib) ` ; the manifest is the set of libraries
31+ the model claims to satisfy. Written with the ` constraint: ` vocabulary (below).
31323 . ** Application / use-case shapes** — "to run G36 §4.8, an AHU must have these points."
3233 These are the pointlist/equipment shapes that answer "is my model sufficient for X?"
3334 and are what most of this file is about. Libraries tag them as
@@ -214,17 +215,31 @@ associate it:
214215
215216``` python
216217manifest = Library.from_ontology(" my_manifest.ttl" )
217- model.add_to_manifest( manifest.get_shape_collection() )
218+ model.manifest.add(manifest )
218219ctx = model.validate() # validates against the manifest by default
219220```
220221
221- ` add_to_manifest ` ** merges** into whatever the model already has — call it twice and you get
222- the union, so a manifest can grow but never shrink. To swap the requirements out wholesale,
223- use ` model.replace_manifest(sc) ` , which discards the previous contents. Reach for ` replace_ `
224- when re-running a script that would otherwise accumulate stale requirements across runs.
222+ The manifest is a ** set of libraries** , so it behaves like one:
225223
226- (` update_manifest ` is the old name for ` add_to_manifest ` . It still works and warns; the name
227- was misleading, since it never replaced anything.)
224+ ``` python
225+ model.manifest.add(manifest, g36) # Libraries, names, or iterables of either
226+ model.manifest.remove(g36) # KeyError if absent; .discard() forgives
227+ model.manifest.library_names # ['urn:my/manifest', ...]
228+ " urn:my/manifest" in model.manifest
229+ model.manifest.replace([manifest]) # the whole set at once
230+ model.manifest.libraries # the Library objects
231+ ```
232+
233+ Shapes only ever reach a manifest * through a library* — there is no way to append loose
234+ shapes to it. That is what makes the set inspectable and subtractable: a manifest that
235+ had absorbed a copy of some shapes could grow but never shrink, and could not say where
236+ anything came from. A name that is not a loaded library is resolved through the ontology
237+ environment (cache first, then a fetch if it is a URL), so
238+ ` model.manifest.add("https://brickschema.org/schema/1.4/Brick") ` loads Brick if it has
239+ to; a name that resolves nowhere raises rather than failing later at validation time.
240+
241+ Storage-wise the manifest is a graph of ` owl:imports ` and nothing else —
242+ ` model.manifest.graph ` hands you a copy to serialize or diff.
228243
229244### ⚠ ` constraint: ` components validate but block repair
230245
0 commit comments