
Begin with a bounded collection and a question that needs connected context.
For New Zealand legislation, a useful first project could bring a selected group of provisions together with their definitions, express references and qualifications. Make the boundaries visible from the start.
The working method
Set the scopeChoose the collection and the questions it should support.
Name the Acts, sections and dates you intend to cover. Write a small set of research questions with a reviewer who knows the subject. Identify the context each question requires before choosing the storage technology.
The supplied example is a teaching slice of two Acts. Its 15 provision records are too narrow to support a complete consumer-law research service.
Keep the sourcesRetain the exact material behind each record.
Use the official source service to discover a work, its available versions and a source format. Save the original bytes with the returned identifier, source URL, retrieval time and a checksum that can reveal a later change.
Validate the parser against representative files. A file with no usable content must fail the import. The handover’s full-text importer remains unfinished because it has not been validated against official XML fixtures.
Separate identity from versionThe same section can have different text over time.
Give the Act and each provision a stable identity. Store each text revision separately. Keep the date the file was retrieved apart from the version label and the dates on which the provision has legal effect.
The supplied engine uses hashes to detect changes to text. A hash can identify changed content; determining the legal effect of the change requires further evidence.
Record the relationshipsAttach evidence, direction and review status.
Extract explicit cross-references first. Store which provision refers to which. Then add reviewed editorial relationships such as a scoped definition or a qualification, with the reasoning and conditions alongside them.
An ontology is the agreed vocabulary for these record and relationship types. Keep it small enough for contributors to apply consistently. A connection labelled “related” needs an explanation of why it belongs.
Retrieve the contextReturn an evidence bundle with stated limits.
Search finds candidate starting records. Graph traversal follows a limited number of saved connections. Keep track of the route taken so the reader can see why each record was included.
Return the source versions, the relationship evidence and the known missing material together. If the system cannot establish coverage for a requested date, return that limitation explicitly.
Review and maintainTest what the system misses as well as what it finds.
Compare the results with the reviewer’s expected context. Check missing definitions, omitted exceptions, wrong versions and unsupported relationships. Compare the graph-assisted result with ordinary search to find whether the extra structure helps.
Assign responsibility for changes. New source versions should trigger review of the records and relationships that depend on them. Keep the audit history and a way to correct an error in the live collection.
The records behind the picture
| Record | What it holds |
|---|---|
| Work | The Act’s identity and official source identifiers. |
| Provision | A section’s stable identity within the Act. |
| Revision | The selected text, source version, checksum and retrieval record. |
| Relationship | From, type, to, evidence, conditions and review status. |
| Coverage | Included material, missing dependencies and supported dates. |
The handover uses Python and SQLite, with JSON to move records into the browser. A graph is a way of modelling connected information. It can be stored in ordinary tables with identifiers linking the rows.
The next stage for this example
The immediate work would be verified source acquisition, a tested XML parser and a declared collection with its dependencies accounted for. Legal review would then check the provision summaries and the meaning of the relationships.
A maintained service would also need update monitoring, historical coverage, an evaluated retrieval API and access controls for any private material. Cases and parliamentary material could become further source layers once each has its own identifiers and evidence rules.
These are further development steps. The interactive example runs on the selected handover records in the browser.
Sources and method
- W3C RDF 1.1 Primer: resources, directed statements and connected graphs.
- PCO developer API guide: official source discovery.
- PCO XML data guide: the structure of legislative source files.
- The supplied New Zealand legislation handover: the selected corpus, graph model, Python/SQLite engine and coverage record.