From 9695cf21d086510b9e7e32a01dc6675bbf440516 Mon Sep 17 00:00:00 2001 From: Rob Atkinson Date: Sat, 17 Oct 2026 16:30:11 +1100 Subject: [PATCH 01/11] Group SOSA spec examples by target bblock with JSON-LD transform Regenerate _sources/spec-examples from the current SOSA/SSN document and split it into child blocks (observations, observation-collections, samplings, deployments, ...). Each block $refs its target SOSA properties bblock, so its Turtle examples are validated against the target's SHACL. A ttl-to-jsonld python transform frames each example's root resource with the target context, and output profile validation checks the result against the target bblock. Adds the 9 document examples that were missing (OCrule1-5, AgeOfAir/CO2InAir i-adopt, ex6, ex7). Fix sosa-ssn.jsonld: hasSimpleResult is a literal, not an @id, and resultTime/startTime/endTime are coerced to xsd:dateTime to match the schemas' format: date-time. Fix features examples that used "resultTime": "1999", which is not a valid xsd:dateTime. Fix the sh: prefix in spec-examples/examples.yaml. Add project skills spec-examples-check (doc vs bblocks sync check) and spec-examples-jsonld (classify, generate blocks, install transform, summarise results). Co-Authored-By: Claude Opus 5.5 --- .claude/skills/spec-examples-check/SKILL.md | 66 ++++ .../scripts/check_spec_examples.py | 236 +++++++++++++ .claude/skills/spec-examples-jsonld/SKILL.md | 110 +++++++ .../assets/ttl_to_sosa_json.py | 145 ++++++++ .../scripts/classify_examples.py | 162 +++++++++ .../scripts/summarize_results.py | 103 ++++++ .../scripts/sync_spec_example_blocks.py | 219 +++++++++++++ .../observation/examples/hasResult.json | 2 +- .../observation/examples/observation.json | 2 +- .../observationCollection/example.json | 2 +- .../examples/observationCollection.json | 2 +- .../observationCollection-props-fail.json | 2 +- .../tests/observationCollection-props.json | 2 +- _sources/spec-examples/actuations/bblock.json | 28 ++ .../spec-examples/actuations/description.md | 11 + .../spec-examples/actuations/examples.yaml | 33 ++ _sources/spec-examples/actuations/schema.yaml | 3 + .../spec-examples/actuations/transforms.yaml | 26 ++ .../spec-examples/deployments/bblock.json | 28 ++ .../spec-examples/deployments/description.md | 11 + .../spec-examples/deployments/examples.yaml | 49 +++ .../spec-examples/deployments/schema.yaml | 3 + .../spec-examples/deployments/transforms.yaml | 27 ++ _sources/spec-examples/examples.yaml | 309 ++++-------------- .../observation-collections/bblock.json | 28 ++ .../observation-collections/description.md | 11 + .../observation-collections/examples.yaml | 126 +++++++ .../observation-collections/schema.yaml | 3 + .../observation-collections/transforms.yaml | 22 ++ .../spec-examples/observations/bblock.json | 28 ++ .../spec-examples/observations/description.md | 11 + .../spec-examples/observations/examples.yaml | 223 +++++++++++++ .../spec-examples/observations/schema.yaml | 3 + .../observations/transforms.yaml | 24 ++ _sources/spec-examples/platforms/bblock.json | 28 ++ .../spec-examples/platforms/description.md | 11 + .../spec-examples/platforms/examples.yaml | 33 ++ _sources/spec-examples/platforms/schema.yaml | 3 + .../spec-examples/platforms/transforms.yaml | 30 ++ .../sample-collections/bblock.json | 28 ++ .../sample-collections/description.md | 11 + .../sample-collections/examples.yaml | 40 +++ .../sample-collections/schema.yaml | 3 + .../sample-collections/transforms.yaml | 23 ++ _sources/spec-examples/samples/bblock.json | 28 ++ _sources/spec-examples/samples/description.md | 11 + _sources/spec-examples/samples/examples.yaml | 49 +++ _sources/spec-examples/samples/schema.yaml | 3 + .../spec-examples/samples/transforms.yaml | 30 ++ _sources/spec-examples/samplings/bblock.json | 28 ++ .../spec-examples/samplings/description.md | 11 + .../spec-examples/samplings/examples.yaml | 49 +++ _sources/spec-examples/samplings/schema.yaml | 3 + .../spec-examples/samplings/transforms.yaml | 25 ++ _sources/spec-examples/systems/bblock.json | 28 ++ _sources/spec-examples/systems/description.md | 11 + _sources/spec-examples/systems/examples.yaml | 33 ++ _sources/spec-examples/systems/schema.yaml | 3 + .../spec-examples/systems/transforms.yaml | 37 +++ .../transforms/ttl_to_sosa_json.py | 145 ++++++++ sosa-ssn.jsonld | 20 +- 61 files changed, 2533 insertions(+), 251 deletions(-) create mode 100644 .claude/skills/spec-examples-check/SKILL.md create mode 100644 .claude/skills/spec-examples-check/scripts/check_spec_examples.py create mode 100644 .claude/skills/spec-examples-jsonld/SKILL.md create mode 100644 .claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py create mode 100644 .claude/skills/spec-examples-jsonld/scripts/classify_examples.py create mode 100644 .claude/skills/spec-examples-jsonld/scripts/summarize_results.py create mode 100644 .claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py create mode 100644 _sources/spec-examples/actuations/bblock.json create mode 100644 _sources/spec-examples/actuations/description.md create mode 100644 _sources/spec-examples/actuations/examples.yaml create mode 100644 _sources/spec-examples/actuations/schema.yaml create mode 100644 _sources/spec-examples/actuations/transforms.yaml create mode 100644 _sources/spec-examples/deployments/bblock.json create mode 100644 _sources/spec-examples/deployments/description.md create mode 100644 _sources/spec-examples/deployments/examples.yaml create mode 100644 _sources/spec-examples/deployments/schema.yaml create mode 100644 _sources/spec-examples/deployments/transforms.yaml create mode 100644 _sources/spec-examples/observation-collections/bblock.json create mode 100644 _sources/spec-examples/observation-collections/description.md create mode 100644 _sources/spec-examples/observation-collections/examples.yaml create mode 100644 _sources/spec-examples/observation-collections/schema.yaml create mode 100644 _sources/spec-examples/observation-collections/transforms.yaml create mode 100644 _sources/spec-examples/observations/bblock.json create mode 100644 _sources/spec-examples/observations/description.md create mode 100644 _sources/spec-examples/observations/examples.yaml create mode 100644 _sources/spec-examples/observations/schema.yaml create mode 100644 _sources/spec-examples/observations/transforms.yaml create mode 100644 _sources/spec-examples/platforms/bblock.json create mode 100644 _sources/spec-examples/platforms/description.md create mode 100644 _sources/spec-examples/platforms/examples.yaml create mode 100644 _sources/spec-examples/platforms/schema.yaml create mode 100644 _sources/spec-examples/platforms/transforms.yaml create mode 100644 _sources/spec-examples/sample-collections/bblock.json create mode 100644 _sources/spec-examples/sample-collections/description.md create mode 100644 _sources/spec-examples/sample-collections/examples.yaml create mode 100644 _sources/spec-examples/sample-collections/schema.yaml create mode 100644 _sources/spec-examples/sample-collections/transforms.yaml create mode 100644 _sources/spec-examples/samples/bblock.json create mode 100644 _sources/spec-examples/samples/description.md create mode 100644 _sources/spec-examples/samples/examples.yaml create mode 100644 _sources/spec-examples/samples/schema.yaml create mode 100644 _sources/spec-examples/samples/transforms.yaml create mode 100644 _sources/spec-examples/samplings/bblock.json create mode 100644 _sources/spec-examples/samplings/description.md create mode 100644 _sources/spec-examples/samplings/examples.yaml create mode 100644 _sources/spec-examples/samplings/schema.yaml create mode 100644 _sources/spec-examples/samplings/transforms.yaml create mode 100644 _sources/spec-examples/systems/bblock.json create mode 100644 _sources/spec-examples/systems/description.md create mode 100644 _sources/spec-examples/systems/examples.yaml create mode 100644 _sources/spec-examples/systems/schema.yaml create mode 100644 _sources/spec-examples/systems/transforms.yaml create mode 100644 _sources/spec-examples/transforms/ttl_to_sosa_json.py diff --git a/.claude/skills/spec-examples-check/SKILL.md b/.claude/skills/spec-examples-check/SKILL.md new file mode 100644 index 00000000..c4c7b756 --- /dev/null +++ b/.claude/skills/spec-examples-check/SKILL.md @@ -0,0 +1,66 @@ +--- +name: spec-examples-check +description: Check that the spec-examples building blocks (_sources/spec-examples/**) are up to date with the examples in the latest SOSA/SSN specification document (w3c/sdw-sosa-ssn gh-pages). Reports examples missing from the bblocks, bblock examples no longer in the spec, duplicates, broken refs, non-passing builds. Use when asked whether spec-examples is current, after the SOSA spec changes, or before regenerating spec-example blocks. +--- + +# Check spec-examples against the SOSA/SSN document + +The spec-examples blocks reference example files by URL +(`https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/...`), so file *content* is always the latest. +What drifts is the **set** of examples. This skill compares that set with the document. + +## What counts as "in the document" + +The document is the respec source in `w3c/sdw-sosa-ssn`, branch `gh-pages`, folder `ssn/`: + +| kind | how it is found | required in bblocks? | +|------|-----------------|----------------------| +| `included` | `
` in a chapter that `index.html` includes via `data-include` | yes |
+| `linked` | `` in an included chapter | yes |
+| `folder` | file in `ssn/rdf/examples/`, when a chapter links to the folder itself (CompleteExamples does) | no, allowed |
+
+HTML comments are ignored. Chapters not included by `index.html` (e.g. `System-capabilities-0.html`)
+are ignored.
+
+## Run it
+
+From the repo root:
+
+```bash
+python .claude/skills/spec-examples-check/scripts/check_spec_examples.py
+```
+
+Needs Python with `pyyaml`. By default it reads the live `gh-pages` source from
+raw.githubusercontent.com and lists the examples folder through the GitHub API.
+Options:
+
+- `--spec-dir ../sdw-sosa-ssn/ssn`: use a local clone instead. Run `git fetch` first and check it
+  is at `origin/gh-pages`, otherwise the result is not "latest".
+- `--no-network`: skip the HEAD check of every bblock ref.
+- `--strict`: also flag bblock examples that are only in the examples folder.
+- `--build-dir build-local`: read test results from a local build instead of the committed `build/`.
+- `--json`: machine-readable report.
+
+Exit code: 0 in sync, 1 out of date, 2 error.
+
+## Reading the report
+
+- **MISSING from bblocks**: in the document, not in any `examples.yaml`. To add them, run the
+  `spec-examples-jsonld` skill. It classifies the examples and regenerates the grouped blocks.
+  Do not hand-add them to the parent block.
+- **IN bblocks but NOT included in document**:
+  - `[in examples folder]`: still published and reachable from the document's examples folder
+    link. Keep it.
+  - `[STALE: not in spec]`: the file is gone from the spec. Remove it (regenerating removes it).
+- **DUPLICATED across blocks**: the same URL appears in two group blocks. Usually a sign that the
+  blocks were hand-edited after generation.
+- **BROKEN refs**: the URL no longer resolves. The spec renamed or moved the file.
+- **Build status not 'passed'**: reads `/tests/sosa/spec-examples//.validation_*.txt`
+  (default: the committed `build/`). "not built" means the example was added after the last CI build.
+
+## Reporting back
+
+Summarise counts and list each missing or stale example with its spec chapter. If anything is
+missing, offer to run `spec-examples-jsonld`. If the classifier (run by that skill) warns about a
+non-standard SOSA namespace, that is a bug in the spec example. Report it upstream to
+w3c/sdw-sosa-ssn. Don't work around it here.
diff --git a/.claude/skills/spec-examples-check/scripts/check_spec_examples.py b/.claude/skills/spec-examples-check/scripts/check_spec_examples.py
new file mode 100644
index 00000000..2362959d
--- /dev/null
+++ b/.claude/skills/spec-examples-check/scripts/check_spec_examples.py
@@ -0,0 +1,236 @@
+#!/usr/bin/env python3
+"""
+Check that the spec-examples building blocks are up to date with the examples
+included in the SOSA/SSN specification document.
+
+The "document" is the respec source of https://w3c.github.io/sdw-sosa-ssn/ssn/ :
+index.html includes chapters via data-include; each chapter includes example
+files via 
. Plain links to
+example files () are reported as "linked".
+
+Compared against every examples.yaml under _sources/spec-examples/ (the parent
+block plus any grouped child blocks).
+
+Usage:
+  python check_spec_examples.py [--repo .] [--spec-dir PATH | --spec-url URL]
+                                [--no-network] [--json] [--strict] [--build-dir build]
+
+Exit code: 0 = in sync, 1 = differences found, 2 = error.
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+from urllib.parse import urljoin
+from urllib.request import Request, urlopen
+
+import yaml
+
+PUBLISHED_BASE = 'https://w3c.github.io/sdw-sosa-ssn/ssn/'
+RAW_BASE = 'https://raw.githubusercontent.com/w3c/sdw-sosa-ssn/gh-pages/ssn/'
+
+COMMENT_RE = re.compile(r'', re.S)
+INCLUDE_RE = re.compile(r'data-include="([^"]+)"')
+EXAMPLE_PRE_RE = re.compile(r']*\bclass="[^"]*\bexample\b[^"]*"[^>]*>', re.S)
+LINK_RE = re.compile(r'href="([^"]*rdf/examples/[^"#?]+\.(?:ttl|jsonld|json))"')
+FOLDER_RE = re.compile(r'href="([^"]*rdf/examples/?)"')
+GH_CONTENTS = 'https://api.github.com/repos/w3c/sdw-sosa-ssn/contents/ssn/rdf/examples?ref=gh-pages'
+EXAMPLE_EXT = ('.ttl', '.jsonld', '.json')
+
+
+def _read(source: str, rel: str) -> str:
+    if source.startswith(('http://', 'https://')):
+        with urlopen(urljoin(source, rel), timeout=30) as r:
+            return r.read().decode('utf-8')
+    return (Path(source) / rel).read_text(encoding='utf-8')
+
+
+def _normalise(href: str) -> str | None:
+    """Map a chapter-relative or GitHub href to the published spec URL."""
+    href = href.strip()
+    m = re.search(r'github\.com/w3c/sdw-sosa-ssn/(?:blob|tree)/gh-pages/ssn/(.+)$', href)
+    if m:
+        return PUBLISHED_BASE + m.group(1)
+    if href.startswith(PUBLISHED_BASE):
+        return href
+    if href.startswith(('http://', 'https://')):
+        return None
+    return urljoin(PUBLISHED_BASE, href)
+
+
+def folder_examples(source: str) -> list[str]:
+    """Top-level example files in ssn/rdf/examples (the folder the document links to)."""
+    if source.startswith(('http://', 'https://')):
+        with urlopen(Request(GH_CONTENTS, headers={'Accept': 'application/vnd.github+json'}), timeout=30) as r:
+            names = [i['name'] for i in json.load(r) if i['type'] == 'file']
+    else:
+        names = [f.name for f in (Path(source) / 'rdf' / 'examples').iterdir() if f.is_file()]
+    return [PUBLISHED_BASE + 'rdf/examples/' + n for n in sorted(names) if n.endswith(EXAMPLE_EXT)]
+
+
+def doc_examples(source: str) -> list[dict]:
+    """Return examples referenced by the spec document, in document order.
+
+    kind: 'included' (rendered in the document), 'linked' (explicit link to the file),
+    'folder' (only reachable via a document link to the examples folder)."""
+    index = COMMENT_RE.sub('', _read(source, 'index.html'))
+    chapters = [c for c in INCLUDE_RE.findall(index) if c.endswith('.html')]
+    found: dict[str, dict] = {}
+    folder_linked_from = []
+    for chapter in chapters:
+        html = COMMENT_RE.sub('', _read(source, chapter.lstrip('./')))
+        chapter_name = Path(chapter).stem
+        for tag in EXAMPLE_PRE_RE.findall(html):
+            inc = INCLUDE_RE.search(tag)
+            if not inc or not inc.group(1).endswith(EXAMPLE_EXT):
+                continue
+            url = _normalise(inc.group(1))
+            entry = found.setdefault(url, {'url': url, 'kind': 'included', 'chapters': []})
+            entry['kind'] = 'included'
+            if chapter_name not in entry['chapters']:
+                entry['chapters'].append(chapter_name)
+        for href in LINK_RE.findall(html):
+            url = _normalise(href)
+            if not url:
+                continue
+            entry = found.setdefault(url, {'url': url, 'kind': 'linked', 'chapters': []})
+            if chapter_name not in entry['chapters']:
+                entry['chapters'].append(chapter_name)
+        if FOLDER_RE.search(html):
+            folder_linked_from.append(chapter_name)
+    if folder_linked_from:
+        for url in folder_examples(source):
+            found.setdefault(url, {'url': url, 'kind': 'folder', 'chapters': folder_linked_from})
+    return list(found.values())
+
+
+def bblock_examples(repo: Path) -> list[dict]:
+    """Return every snippet ref in _sources/spec-examples/**/examples.yaml."""
+    root = repo / '_sources' / 'spec-examples'
+    result = []
+    for ex_file in sorted(root.rglob('examples.yaml')):
+        block_dir = ex_file.parent
+        block = '.'.join(('spec-examples', *block_dir.relative_to(root).parts))
+        data = yaml.safe_load(ex_file.read_text(encoding='utf-8')) or {}
+        for example in data.get('examples') or []:
+            for snippet in example.get('snippets') or []:
+                ref = snippet.get('ref')
+                if not ref:
+                    continue
+                url = ref if ref.startswith(('http://', 'https://')) else None
+                result.append({
+                    'url': url or ref,
+                    'block': block,
+                    'block_dir': str(block_dir.relative_to(repo)).replace('\\', '/'),
+                    'title': example.get('title'),
+                    'base_output_filename': example.get('base-output-filename'),
+                    'language': snippet.get('language'),
+                })
+    return result
+
+
+def url_ok(url: str) -> bool:
+    try:
+        with urlopen(Request(url, method='HEAD'), timeout=20) as r:
+            return r.status < 400
+    except Exception:
+        return False
+
+
+def build_status(build_dir: Path, entry: dict) -> str:
+    """Look for the validation report of a bblock example in build/tests."""
+    base = entry.get('base_output_filename')
+    if not base:
+        return 'unknown (no base-output-filename)'
+    tests_dir = build_dir / 'tests' / 'sosa' / Path(*entry['block'].split('.'))
+    if (tests_dir / f'{base}.validation_failed.txt').exists():
+        return 'failed'
+    if (tests_dir / f'{base}.validation_passed.txt').exists():
+        return 'passed'
+    return 'not built'
+
+
+def main() -> int:
+    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+    ap.add_argument('--repo', default='.', help='ogcapi-sosa repository root')
+    src = ap.add_mutually_exclusive_group()
+    src.add_argument('--spec-dir', help='local clone of sdw-sosa-ssn/ssn (must be up to date with gh-pages)')
+    src.add_argument('--spec-url', default=RAW_BASE, help=f'spec source base URL (default {RAW_BASE})')
+    ap.add_argument('--strict', action='store_true',
+                    help="flag bblock examples that are only in the linked examples folder as extra")
+    ap.add_argument('--no-network', action='store_true', help='skip HEAD checks of bblock refs')
+    ap.add_argument('--build-dir', default='build', help='build output to read test results from (e.g. build-local)')
+    ap.add_argument('--json', action='store_true', help='machine-readable output')
+    args = ap.parse_args()
+
+    repo = Path(args.repo).resolve()
+    source = args.spec_dir if args.spec_dir else args.spec_url
+    if args.spec_dir and not source.endswith(('/', '\\')):
+        source += '/'
+
+    doc = doc_examples(source)
+    required = {d['url']: d for d in doc if d['kind'] in ('included', 'linked')}
+    folder = {d['url']: d for d in doc if d['kind'] == 'folder'}
+    bb = bblock_examples(repo)
+    bb_by_url: dict[str, list[dict]] = {}
+    for e in bb:
+        bb_by_url.setdefault(e['url'], []).append(e)
+
+    missing = [required[u] for u in required if u not in bb_by_url]
+    extra = [dict(url=u, blocks=[e['block'] for e in es], in_folder=u in folder)
+             for u, es in bb_by_url.items() if u not in required]
+    available = [folder[u] for u in folder if u not in bb_by_url]
+    duplicates = [dict(url=u, blocks=[e['block'] for e in es])
+                  for u, es in bb_by_url.items() if len({e['block'] for e in es}) > 1]
+    broken = [] if args.no_network else [u for u in bb_by_url if u.startswith('http') and not url_ok(u)]
+    builds = {u: [dict(block=e['block'], status=build_status(repo / args.build_dir, e)) for e in es]
+              for u, es in bb_by_url.items()}
+    not_passing = {u: s for u, s in builds.items() if any(x['status'] != 'passed' for x in s)}
+
+    report = dict(source=source, doc_examples=len(doc), required=len(required),
+                  bblock_refs=len(bb), missing=missing, extra=extra,
+                  folder_not_in_bblocks=available, duplicates=duplicates,
+                  broken_refs=broken, build_not_passing=not_passing)
+    in_sync = not (missing or [e for e in extra if args.strict or not e['in_folder']] or duplicates or broken)
+
+    if args.json:
+        print(json.dumps(dict(report, in_sync=in_sync), indent=2))
+    else:
+        print(f"Spec source: {source}")
+        print(f"Examples in document: {len(required)} included/linked, "
+              f"{len(folder)} more in the linked examples folder; bblock snippet refs: {len(bb)}")
+        print(f"\nMISSING from bblocks ({len(missing)}):")
+        for m in missing:
+            print(f"  + {m['url']}   [{', '.join(m['chapters'])}]")
+        print(f"\nIN bblocks but NOT included in document ({len(extra)}):")
+        for e in extra:
+            print(f"  - {e['url']}   ({', '.join(e['blocks'])})"
+                  f"{'  [in examples folder]' if e['in_folder'] else '  [STALE: not in spec]'}")
+        if available:
+            print(f"\nIn examples folder, not in bblocks ({len(available)}) [informational]:")
+            for a in available:
+                print(f"  ~ {a['url']}")
+        if duplicates:
+            print(f"\nDUPLICATED across blocks ({len(duplicates)}):")
+            for d in duplicates:
+                print(f"  * {d['url']}   ({', '.join(d['blocks'])})")
+        if not args.no_network:
+            print(f"\nBROKEN refs ({len(broken)}):")
+            for u in broken:
+                print(f"  ! {u}")
+        print(f"\nBuild status not 'passed' ({len(not_passing)}):")
+        for u, s in not_passing.items():
+            print(f"  ? {u.rsplit('/', 1)[-1]}: " + ', '.join(f"{x['block']}={x['status']}" for x in s))
+        print('\nRESULT: ' + ('in sync' if in_sync else 'OUT OF DATE'))
+    return 0 if in_sync else 1
+
+
+if __name__ == '__main__':
+    try:
+        sys.exit(main())
+    except Exception as exc:  # noqa
+        print(f'ERROR: {type(exc).__name__}: {exc}', file=sys.stderr)
+        sys.exit(2)
diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
new file mode 100644
index 00000000..da398d4b
--- /dev/null
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -0,0 +1,110 @@
+---
+name: spec-examples-jsonld
+description: Build and install the Turtle-to-JSON-LD transform for the SOSA spec examples, and (re)generate _sources/spec-examples/ as grouped child bblocks (observations, observation-collections, samplings, deployments, ...). Each group validates its transform output against a different target SOSA properties bblock using output profile validation. Use to add new spec examples, regroup them, or change the JSON-LD conversion.
+---
+
+# Spec examples → JSON-LD against the SOSA bblocks
+
+The SOSA/SSN spec examples are Turtle. This skill converts each one into JSON that follows the
+schema of the matching SOSA bblock (e.g. `ogc.sosa.properties.observation`). The output carries
+an `@context` that holds only the prefixes it needs. Output profile validation then checks it
+against that bblock: JSON Schema, then JSON-LD uplift with the target's context, then SHACL. The
+uplifted `.jsonld` written by the validator is the canonical JSON-LD. Its `@context` is
+`[, {prefixes}]`.
+
+Run `spec-examples-check` first to see what is missing.
+
+## Pieces
+
+| file | role |
+|------|------|
+| `scripts/classify_examples.py` | collects document examples and existing bblock examples, parses each one, finds its **root** SOSA resource(s), assigns a group, writes `plan.yaml` |
+| `scripts/sync_spec_example_blocks.py` | turns the plan into the child blocks and installs the transform |
+| `assets/ttl_to_sosa_json.py` | the transform (python, runs inside bblocks-postprocess: rdflib + pyld) |
+
+Generated under `_sources/spec-examples/`:
+
+```
+examples.yaml                    'other' examples (no SOSA root): Turtle validation only
+transforms/ttl_to_sosa_json.py   installed copy of the transform
+/bblock.json              ogc.sosa.spec-examples.
+/schema.yaml              $ref: bblocks://  (inherits target context + SHACL)
+/examples.yaml            URL refs into the spec, base-output-filename per example
+/transforms.yaml          ttl-to-jsonld, ref ../transforms/ttl_to_sosa_json.py,
+                                 outputs.profiles: [bblocks://]
+/description.md
+```
+
+## Grouping rules (classify_examples.py `GROUPS`)
+
+Groups are checked in priority order. The first group with at least one root wins:
+observation-collections → sample-collections → observations → samplings → actuations →
+deployments → samples (incl. MaterialSample) → platforms → systems (Sensor/Actuator/Sampler/System).
+Anything else goes to `other`.
+
+An instance counts as a **root** unless it is embedded:
+- it is a blank node that something else references, or
+- something references it through a non-SOSA/SSN predicate (e.g. `owl:hasValue` in a restriction,
+  as in the system-type examples), or
+- an instance of the same or a higher-priority class references it through a SOSA/SSN predicate.
+  Inverse links from lower-priority resources don't count, so a Sample's `isResultOf` does not
+  hide its Sampling.
+
+If an example has several roots, the sync step writes one example per root, each with
+`x-root: `, which the transform reads from `context.example`. JSON-LD originals (e.g.
+`forecast.jsonld`) stay in the parent block as RDF-only examples, with output name `-jsonld`.
+
+## Transform behaviour (transforms.yaml `metadata`)
+
+- `rootClasses` / `containerClasses`: root selection, the same rule as the classifier.
+- Frames the root (`@embed: @once`), compacts it with the block's own assembled context (from
+  `jsonld_context_path`, which is the target's context because of the schema `$ref`), then drops
+  that context.
+- `coerce`: optional typed-literal coercions added to the local `@context`, for terms a target
+  schema constrains to plain strings but its context doesn't coerce. None are needed now:
+  `sosa-ssn.jsonld` coerces `resultTime`, `startTime` and `endTime` to `xsd:dateTime`.
+- `suppressTerms`: context terms to avoid. Default: `features`, the GeoJSON alias of
+  `sosa:hasMember`, so the schema's `hasMember` is used.
+- Blank-node roots are skolemised just long enough to frame them, then the `id` is removed.
+
+## Run it
+
+```bash
+# 1. plan (use a local clone for speed: git fetch it first)
+python .claude/skills/spec-examples-jsonld/scripts/classify_examples.py \
+    --spec-dir ../sdw-sosa-ssn/ssn --out /plan.yaml
+# review the stderr table; edit plan.yaml 'group' values to override a classification
+# 2. generate blocks + install transform
+python .claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py --plan /plan.yaml
+# 3. build locally (build-local/ is gitignored; don't overwrite the committed build/)
+MSYS_NO_PATHCONV=1 docker run --rm --pull=always --workdir /workspace -v "$(pwd -W):/workspace" \
+  ghcr.io/opengeospatial/bblocks-postprocess:latest --clean true \
+  --base-url http://localhost:9090/register/ --register-file build-local/register.json \
+  --annotated-path build-local/annotated --generated-docs-path build-local/generateddocs \
+  --test-outputs-path build-local/tests
+# 4. summarise
+python .claude/skills/spec-examples-jsonld/scripts/summarize_results.py --tests build-local/tests
+```
+
+Needs local Python with `rdflib` and `pyyaml`. `pyld` is only needed to try the transform outside
+the postprocessor. On Linux or macOS, use `$(pwd)` and drop `MSYS_NO_PATHCONV`.
+
+## Where results land
+
+`build-local/tests/sosa/spec-examples//`:
+- `.ttl` / `.validation_{passed,failed}.txt`: the Turtle example against the target's SHACL
+- `transforms/.ttl-to-jsonld.json`: the transform output
+- `transforms/ogc.sosa.properties./.ttl-to-jsonld.{jsonld,ttl}`: uplift with the target context
+- `transforms/ogc.sosa.properties./.ttl-to-jsonld.validation_*.txt` and `_report.json`: profile validation
+
+## Interpreting failures
+
+A failure in profile validation means one of three things:
+- **The target bblock's schema, context or shapes don't fit a spec-conformant example.** Report it
+  against the target bblock.
+- **The spec example is wrong.** Check the classifier warnings, e.g. a non-standard SOSA
+  namespace. Report it upstream.
+- **The transform's framing isn't right for that example.** Override its group in the plan, or set
+  `x-root`.
+
+Don't weaken the target schemas to make the outputs pass.
diff --git a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
new file mode 100644
index 00000000..5bae93b9
--- /dev/null
+++ b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
@@ -0,0 +1,145 @@
+# bblocks python transform: SOSA/SSN Turtle -> JSON-LD conforming to a target SOSA bblock.
+#
+# Installed by the spec-examples-jsonld skill. Referenced from transforms.yaml of each
+# _sources/spec-examples// block; runs inside bblocks-postprocess (rdflib + pyld).
+#
+# metadata (transforms.yaml):
+#   rootClasses: [IRI, ...]   classes whose instances become the root object
+#   containerClasses: [IRI]   classes whose SOSA links embed a root candidate (default rootClasses)
+#   coerce: {term: datatype}  typed-literal coercions added to the output's local @context, for
+#                             terms the target schema constrains to plain strings (e.g. resultTime
+#                             with format: date-time) but the target context does not coerce
+#   suppressTerms: [term]     context terms not to use when compacting (e.g. the GeoJSON alias
+#                             'features' for sosa:hasMember, so the schema's 'hasMember' is used)
+# per example (examples.yaml):
+#   x-root: IRI               pick this resource as the root (multi-root examples)
+#
+# Output: the root resource framed and compacted with the block's own JSON-LD context
+# (which is the target bblock's context, inherited via schema.yaml $ref), with that
+# context removed and replaced by a prefix-only @context for any non-SOSA terms. Output
+# profile validation re-applies the target block's context, so the JSON Schema, JSON-LD
+# context and SHACL shapes of the target are all exercised.
+import json
+from pathlib import Path
+
+from pyld import jsonld
+from rdflib import BNode, Graph, RDF, URIRef
+
+SOSA_SSN = ('http://www.w3.org/ns/sosa/', 'http://www.w3.org/ns/ssn/')
+
+
+def _get(obj, key, default=None):
+    if obj is None:
+        return default
+    if isinstance(obj, dict):
+        return obj.get(key, default)
+    return getattr(obj, key, default)
+
+
+meta = transform_metadata.metadata
+tctx = transform_metadata.context
+root_classes = [URIRef(c) for c in _get(meta, 'rootClasses', [])]
+container_classes = [URIRef(c) for c in (_get(meta, 'containerClasses') or [])] or root_classes
+example = _get(tctx, 'example') or {}
+wanted_root = _get(example, 'x-root')
+
+# --- block JSON-LD context (assembled by the postprocessor for this block) ---------------
+ctx_path = None
+if _get(tctx, 'jsonld_context_path'):
+    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(tctx, 'jsonld_context_path')
+if (ctx_path is None or not ctx_path.is_file()) and _get(meta, 'context'):
+    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(meta, 'context')
+if ctx_path is None or not ctx_path.is_file():
+    raise FileNotFoundError(f'JSON-LD context for this block not found ({ctx_path})')
+block_context = json.loads(ctx_path.read_text(encoding='utf-8'))['@context']
+
+# --- parse --------------------------------------------------------------------------------
+src = transform_metadata.source_mime_type or 'text/turtle'
+try:
+    g = Graph(bind_namespaces='none')
+except TypeError:  # rdflib < 7
+    g = Graph()
+g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle')
+prefixes = {p: str(ns) for p, ns in g.namespaces()
+            if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
+for p, ns in (_get(meta, '_prefixes') or {}).items():
+    prefixes.setdefault(p, ns)
+local_context = dict(prefixes)
+for term, datatype in (_get(meta, 'coerce') or {}).items():
+    term_def = block_context.get(term) if isinstance(block_context, dict) else None
+    term_id = term_def.get('@id') if isinstance(term_def, dict) else term_def
+    if term_id:
+        local_context[term] = {'@id': term_id, '@type': datatype}
+        prefixes.setdefault('xsd', 'http://www.w3.org/2001/XMLSchema#')
+        local_context.setdefault('xsd', prefixes['xsd'])
+
+
+def _instances(classes):
+    return {s for c in classes for s in g.subjects(RDF.type, c)}
+
+
+def _roots():
+    inst = _instances(root_classes)
+    containers = _instances(container_classes)
+    nested = set()
+    for s, p, o in g:
+        if o not in inst or s == o or p == RDF.type:
+            continue
+        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
+            nested.add(o)
+    return sorted(inst - nested, key=str)
+
+
+if wanted_root:
+    root = URIRef(wanted_root)
+    if (root, None, None) not in g:
+        raise ValueError(f'x-root {wanted_root} has no statements in the example')
+else:
+    roots = _roots()
+    if not roots:
+        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
+    root = roots[0]
+
+# Blank-node roots cannot be addressed by @id in a frame: skolemize just that node.
+if isinstance(root, BNode):
+    skolem = URIRef(f'urn:x-bnode:{root}')
+    for p, o in list(g.predicate_objects(root)):
+        g.remove((root, p, o)); g.add((skolem, p, o))
+    for s, p in list(g.subject_predicates(root)):
+        g.remove((s, p, root)); g.add((s, p, skolem))
+    root = skolem
+
+# --- frame + compact ----------------------------------------------------------------------
+expanded = json.loads(g.serialize(format='json-ld'))
+frame_context = dict(local_context, **{t: None for t in (_get(meta, 'suppressTerms') or [])})
+context = [block_context, frame_context] if frame_context else block_context
+framed = jsonld.frame(expanded, {'@context': context, '@id': str(root)},
+                      {'embed': '@once', 'omitGraph': True})
+framed.pop('@context', None)
+if '@graph' in framed:  # defensive: omitGraph should have collapsed a single match
+    framed = framed['@graph'][0]
+if str(framed.get('id', '')).startswith('urn:x-bnode:'):
+    framed.pop('id')
+
+
+
+def _usage(node, prefixes_used, keys_used):
+    if isinstance(node, dict):
+        for k, v in node.items():
+            keys_used.add(k)
+            _usage(k, prefixes_used, keys_used); _usage(v, prefixes_used, keys_used)
+    elif isinstance(node, list):
+        for v in node:
+            _usage(v, prefixes_used, keys_used)
+    elif isinstance(node, str) and ':' in node:
+        prefixes_used.add(node.split(':', 1)[0])
+
+
+used_prefixes, used_keys = set(), set()
+_usage(framed, used_prefixes, used_keys)
+local_context = {k: v for k, v in local_context.items()
+                 if (k in used_prefixes if isinstance(v, str) else k in used_keys)}
+if any(not isinstance(v, str) for v in local_context.values()):
+    local_context['xsd'] = 'http://www.w3.org/2001/XMLSchema#'
+out = {'@context': local_context, **framed} if local_context else framed
+output_data = json.dumps(out, indent=2, ensure_ascii=False)
diff --git a/.claude/skills/spec-examples-jsonld/scripts/classify_examples.py b/.claude/skills/spec-examples-jsonld/scripts/classify_examples.py
new file mode 100644
index 00000000..1f6aab47
--- /dev/null
+++ b/.claude/skills/spec-examples-jsonld/scripts/classify_examples.py
@@ -0,0 +1,162 @@
+#!/usr/bin/env python3
+"""
+Classify SOSA spec examples by the SOSA/SSN class of their root resources, and
+assign each to a target building block for JSON-LD conversion + output profile
+validation.
+
+The candidate set is the document's examples (via check_spec_examples.doc_examples)
+plus the examples already in the bblocks, so nothing is dropped.
+
+Usage:
+  python classify_examples.py [--repo .] [--spec-dir PATH] [--out plan.yaml]
+
+Writes a grouping plan (YAML) consumed by sync_spec_example_blocks.py.
+"""
+from __future__ import annotations
+
+import argparse
+import sys
+from collections import Counter
+from pathlib import Path
+from urllib.request import urlopen
+
+import yaml
+from rdflib import BNode, Graph, RDF, URIRef, Namespace
+
+sys.path.insert(0, str(Path(__file__).resolve().parents[2] / 'spec-examples-check' / 'scripts'))
+from check_spec_examples import doc_examples, bblock_examples, RAW_BASE, PUBLISHED_BASE  # noqa: E402
+
+SOSA = Namespace('http://www.w3.org/ns/sosa/')
+
+# Target groups in priority order: the first group whose root class has an
+# instance that is not nested inside another instance (see roots()) wins.
+# group -> (target bblock, root classes)
+GROUPS = {
+    'observation-collections': ('ogc.sosa.properties.observationCollection', [SOSA.ObservationCollection]),
+    'sample-collections': ('ogc.sosa.properties.sampleCollection', [SOSA.SampleCollection]),
+    'observations': ('ogc.sosa.properties.observation', [SOSA.Observation]),
+    'samplings': ('ogc.sosa.properties.sampling', [SOSA.Sampling]),
+    'actuations': ('ogc.sosa.properties.actuation', [SOSA.Actuation]),
+    'deployments': ('ogc.sosa.properties.deployment', [SOSA.Deployment]),
+    'samples': ('ogc.sosa.properties.sample', [SOSA.Sample, SOSA.MaterialSample]),
+    'platforms': ('ogc.sosa.properties.platform', [SOSA.Platform]),
+    'systems': ('ogc.sosa.properties.system',
+                [SOSA.Sensor, SOSA.Actuator, SOSA.Sampler, SOSA.System]),
+}
+OTHER = 'other'
+SOSA_SSN = ('http://www.w3.org/ns/sosa/', 'http://www.w3.org/ns/ssn/')
+
+
+def load(url: str, spec_dir: Path | None) -> tuple[Graph, str]:
+    text = None
+    if spec_dir and url.startswith(PUBLISHED_BASE):
+        local = spec_dir / url[len(PUBLISHED_BASE):]
+        if local.is_file():
+            text = local.read_text(encoding='utf-8')
+    if text is None:
+        raw = RAW_BASE + url[len(PUBLISHED_BASE):] if url.startswith(PUBLISHED_BASE) else url
+        with urlopen(raw, timeout=30) as r:
+            text = r.read().decode('utf-8')
+    g = Graph().parse(data=text, format='turtle' if url.endswith('.ttl') else 'json-ld', publicID=url)
+    return g, text
+
+
+SUBCLASSES = {SOSA.MaterialSample: SOSA.Sample}
+BAD_SOSA_NS = ('http://www.w3.org/ns/sosa#', 'https://www.w3.org/TR/vocab-ssn/', 'https://www.w3.org/ns/sosa/')
+
+
+def instances(g: Graph, classes: list[URIRef]) -> set:
+    wanted = set(classes) | {sub for sub, sup in SUBCLASSES.items() if sup in classes}
+    return {s for c in wanted for s in g.subjects(RDF.type, c)}
+
+
+def roots(g: Graph, classes: list[URIRef], container_classes: list[URIRef]) -> list:
+    """Instances of the classes that would be top-level when framed. An instance is
+    embedded (not a root) if it is
+      - a blank node referenced from anything else, or
+      - referenced through a non-SOSA/SSN predicate (e.g. owl:hasValue in a restriction), or
+      - referenced through a SOSA/SSN predicate by another instance of a class of the
+        same or higher priority (container_classes), so inverse links from lower-priority
+        resources (e.g. a Sample's isResultOf its Sampling) do not hide the root."""
+    inst = instances(g, classes)
+    targets = instances(g, container_classes)
+    nested = set()
+    for s, p, o in g.triples((None, None, None)):
+        if o not in inst or s == o or p == RDF.type:
+            continue
+        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in targets:
+            nested.add(o)
+    return sorted(inst - nested, key=str)
+
+
+def lint(g: Graph, text: str) -> list[str]:
+    warnings = []
+    for ns in BAD_SOSA_NS:
+        if ns in text:
+            warnings.append(f'non-standard SOSA namespace <{ns}> (expected <{SOSA}>)')
+    return warnings
+
+
+def classify(g: Graph) -> tuple[str, list, Counter]:
+    types = Counter(str(o) for o in g.objects(None, RDF.type) if str(o).startswith(SOSA_SSN))
+    seen: list[URIRef] = []
+    for group, (_, classes) in GROUPS.items():
+        seen += classes
+        r = roots(g, classes, seen)
+        if r:
+            return group, [str(x) for x in r], types
+    return OTHER, [], types
+
+
+def main() -> int:
+    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+    ap.add_argument('--repo', default='.')
+    ap.add_argument('--spec-dir', help='local clone of sdw-sosa-ssn/ssn (faster; must be current)')
+    ap.add_argument('--out', default='-', help='plan file (default stdout)')
+    args = ap.parse_args()
+    repo = Path(args.repo).resolve()
+    spec_dir = Path(args.spec_dir).resolve() if args.spec_dir else None
+    source = (str(spec_dir) + '/') if spec_dir else RAW_BASE
+
+    doc = doc_examples(source)
+    existing = bblock_examples(repo)
+    candidates: dict[str, dict] = {}
+    for d in doc:
+        candidates[d['url']] = {'url': d['url'], 'in_document': d['kind'], 'chapters': d['chapters']}
+    for e in existing:
+        candidates.setdefault(e['url'], {'url': e['url'], 'in_document': 'no', 'chapters': []})
+    # only examples that are in the doc (included/linked) or already in the bblocks
+    candidates = {u: c for u, c in candidates.items()
+                  if c['in_document'] in ('included', 'linked') or any(e['url'] == u for e in existing)}
+
+    plan = {'groups': {g: {'target': t, 'rootClasses': [str(c) for c in cs]} for g, (t, cs) in GROUPS.items()},
+            'examples': []}
+    plan['groups'][OTHER] = {'target': None, 'rootClasses': []}
+    for url, c in candidates.items():
+        entry = dict(c)
+        try:
+            g, text = load(url, spec_dir)
+            group, rts, types = classify(g)
+            entry.update(group=group, roots=rts,
+                         types={k.rsplit('/', 1)[-1]: v for k, v in sorted(types.items())})
+            if warnings := lint(g, text):
+                entry['warnings'] = warnings
+        except Exception as exc:  # unparseable examples are still tested as-is
+            entry.update(group=OTHER, roots=[], error=f'{type(exc).__name__}: {exc}')
+        if url.endswith('.jsonld'):
+            entry['group'] = OTHER  # JSON-LD originals are kept alongside the TTL, not re-converted
+        plan['examples'].append(entry)
+        print(f"{entry['group']:24} {len(entry.get('roots', [])):3} roots  {url.rsplit('/', 1)[-1]}"
+              + (f"  ERROR {entry['error']}" if 'error' in entry else '')
+              + ''.join(f"  WARNING {w}" for w in entry.get('warnings', [])), file=sys.stderr)
+
+    text = yaml.safe_dump(plan, sort_keys=False, allow_unicode=True, width=120)
+    if args.out == '-':
+        print(text)
+    else:
+        Path(args.out).write_text(text, encoding='utf-8')
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/.claude/skills/spec-examples-jsonld/scripts/summarize_results.py b/.claude/skills/spec-examples-jsonld/scripts/summarize_results.py
new file mode 100644
index 00000000..88063ddd
--- /dev/null
+++ b/.claude/skills/spec-examples-jsonld/scripts/summarize_results.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python3
+"""
+Summarise spec-examples validation after a postprocessor run: per group, the Turtle
+example validation and the ttl-to-jsonld output profile validation, with the first
+error lines of each failure.
+
+Usage:
+  python summarize_results.py [--tests build-local/tests] [--errors N] [--json]
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import re
+import sys
+from pathlib import Path
+
+ERROR_LINE = re.compile(r'^\s*(?:\*|ERROR|Validation Result|Message|Focus Node|Result Path|Value Node)', re.I)
+
+
+def status_of(base: Path, stem: str) -> tuple[str, Path | None]:
+    for st in ('failed', 'passed'):
+        f = base / f'{stem}.validation_{st}.txt'
+        if f.exists():
+            return st, f
+    return 'missing', None
+
+
+def errors(path: Path | None, n: int) -> list[str]:
+    if not path:
+        return []
+    lines, section = [], None
+    for line in path.read_text(encoding='utf-8', errors='replace').splitlines():
+        if line.startswith('=== ') and not line.startswith('=== End'):
+            section = line.strip('= ').strip()
+        if section in ('JSON Schema', 'SHACL', 'JSON-LD', 'Unknown', 'Turtle') and line.strip() \
+                and not line.startswith('===') and (ERROR_LINE.search(line) or section != 'SHACL'):
+            lines.append(f'[{section}] {line.strip()}')
+    return lines[:n]
+
+
+def main() -> int:
+    ap = argparse.ArgumentParser()
+    ap.add_argument('--tests', default='build-local/tests')
+    ap.add_argument('--errors', type=int, default=4, help='error lines shown per failure')
+    ap.add_argument('--json', action='store_true')
+    args = ap.parse_args()
+    root = Path(args.tests) / 'sosa' / 'spec-examples'
+    if not root.is_dir():
+        print(f'No spec-examples test outputs under {root}', file=sys.stderr)
+        return 2
+
+    result = {}
+    for d in sorted([root] + [p for p in root.iterdir() if p.is_dir() and p.name != 'transforms']):
+        group = 'other' if d == root else d.name
+        rows = []
+        for ttl_report in sorted(d.glob('*.validation_*.txt')):
+            stem = ttl_report.name.split('.validation_')[0]
+            if '.ttl-to-jsonld' in stem:
+                continue
+            ex_status, ex_file = status_of(d, stem)
+            row = {'example': stem, 'ttl': ex_status, 'ttl_errors': errors(ex_file, args.errors)
+                   if ex_status == 'failed' else []}
+            tdir = d / 'transforms'
+            out = tdir / f'{stem}.ttl-to-jsonld.json'
+            if group != 'other':
+                row['transform'] = 'ok' if out.exists() else 'no output'
+                for prof in [p for p in tdir.iterdir() if p.is_dir()] if tdir.is_dir() else []:
+                    pst, pfile = status_of(prof, f'{stem}.ttl-to-jsonld')
+                    row['profile'] = prof.name
+                    row['profile_status'] = pst
+                    row['profile_errors'] = errors(pfile, args.errors) if pst == 'failed' else []
+            rows.append(row)
+        if rows:
+            result[group] = rows
+
+    if args.json:
+        print(json.dumps(result, indent=2))
+        return 0
+    totals = {'ttl': [0, 0], 'profile': [0, 0], 'no output': 0}
+    for group, rows in result.items():
+        print(f'\n## {group}')
+        for r in rows:
+            line = f"  {r['example']:46} ttl={r['ttl']:7}"
+            totals['ttl'][r['ttl'] == 'passed'] += 1
+            if 'transform' in r:
+                if r['transform'] != 'ok':
+                    totals['no output'] += 1
+                    line += ' transform=NO OUTPUT'
+                else:
+                    line += f" profile={r.get('profile_status', 'missing')}"
+                    totals['profile'][r.get('profile_status') == 'passed'] += 1
+            print(line)
+            for e in r['ttl_errors'] + r.get('profile_errors', []):
+                print(f'      {e[:220]}')
+    print(f"\nTurtle examples: {totals['ttl'][1]} passed, {totals['ttl'][0]} failed/missing")
+    print(f"JSON-LD outputs: {totals['profile'][1]} passed profile validation, "
+          f"{totals['profile'][0]} failed/missing, {totals['no output']} transform produced no output")
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
new file mode 100644
index 00000000..2a4a72bb
--- /dev/null
+++ b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
@@ -0,0 +1,219 @@
+#!/usr/bin/env python3
+"""
+Generate grouped spec-example building blocks from a classification plan
+(classify_examples.py) and install the Turtle -> JSON-LD transform.
+
+Layout written under _sources/spec-examples/:
+  examples.yaml                    examples with no SOSA root ('other'), Turtle validation only
+  transforms/ttl_to_sosa_json.py   the installed transform script
+  /bblock.json              child block  ogc.sosa.spec-examples.
+  /schema.yaml              $ref to the target bblock (inherits its context + SHACL)
+  /examples.yaml            the group's examples (by URL ref into the spec)
+  /transforms.yaml          ttl-to-jsonld transform, output profile = target bblock
+  /description.md
+
+Generated files are overwritten; group directories no longer in the plan are reported,
+not deleted.
+
+Usage:
+  python sync_spec_example_blocks.py --plan plan.yaml [--repo .] [--dry-run]
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import shutil
+import sys
+from pathlib import Path
+
+import yaml
+
+SKILL_DIR = Path(__file__).resolve().parents[1]
+TRANSFORM_ASSET = SKILL_DIR / 'assets' / 'ttl_to_sosa_json.py'
+TRANSFORM_FILE = 'transforms/ttl_to_sosa_json.py'
+GENERATED_NOTE = 'Generated by the spec-examples-jsonld skill (sync_spec_example_blocks.py); edit the plan, not this file.'
+
+# extra typed-literal coercions for the transform's local context (none needed since
+# sosa-ssn.jsonld coerces resultTime/startTime/endTime to xsd:dateTime)
+COERCE: dict[str, str] = {}
+# GeoJSON alias of sosa:hasMember in sosa-ssn.jsonld; properties schemas use 'hasMember'
+SUPPRESS = ['features']
+
+GROUP_TITLES = {
+    'observation-collections': 'Observation Collections',
+    'sample-collections': 'Sample Collections',
+    'observations': 'Observations',
+    'samplings': 'Samplings',
+    'actuations': 'Actuations',
+    'deployments': 'Deployments',
+    'samples': 'Samples',
+    'platforms': 'Platforms',
+    'systems': 'Systems (Sensors, Actuators, Samplers)',
+}
+
+
+def stem(url: str) -> str:
+    return url.rsplit('/', 1)[-1].rsplit('.', 1)[0]
+
+
+def local_name(iri: str) -> str:
+    return iri.rstrip('/#').replace('#', '/').rsplit('/', 1)[-1]
+
+
+def lang(url: str) -> str:
+    return 'ttl' if url.endswith('.ttl') else 'jsonld'
+
+
+def example_entries(entry: dict, siblings: dict[str, dict]) -> list[dict]:
+    """examples.yaml entries for one classified example (one per root if several)."""
+    url, name = entry['url'], stem(entry['url'])
+    snippets = [{'language': lang(url), 'ref': url}]
+    if (sib := siblings.get(name)) is not None:
+        snippets.append({'language': lang(sib['url']), 'ref': sib['url']})
+    content = None
+    if entry.get('chapters'):
+        where = 'included in' if entry.get('in_document') == 'included' else 'referenced from'
+        content = (f"Example {where} the SOSA/SSN specification section(s): "
+                   + ', '.join(f"[{c}](https://w3c.github.io/sdw-sosa-ssn/ssn/)" for c in entry['chapters'])
+                   + f". Source: [{url.rsplit('/', 1)[-1]}]({url})")
+    roots = entry.get('roots') or []
+    out = []
+    for i, root in enumerate(roots or [None]):
+        e = {'title': f"Example {url.rsplit('/', 1)[-1]}"}
+        if len(roots) > 1:
+            e['title'] += f" (root {local_name(root)})"
+        if content:
+            e['content'] = content
+        base = name if url.endswith('.ttl') else f"{name}-{url.rsplit('.', 1)[-1]}"
+        e['base-output-filename'] = base if i == 0 else f"{base}--{local_name(root)}"
+        if len(roots) > 1:
+            e['x-root'] = root
+        e['snippets'] = snippets
+        out.append(e)
+    return out
+
+
+def bblock_json(parent: dict, group: str, target: str) -> dict:
+    title = GROUP_TITLES.get(group, group)
+    return {
+        'name': f"SOSA specification examples: {title}",
+        'abstract': (f"Examples from the SOSA/SSN specification whose root resource is a {title.lower()}"
+                     f" resource. Each Turtle example is validated against the SHACL rules of `{target}`, "
+                     f"and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated "
+                     f"against the `{target}` building block (JSON Schema, JSON-LD context and SHACL)."),
+        **{k: parent[k] for k in ('status', 'dateTimeAddition', 'itemClass', 'register', 'version',
+                                  'dateOfLastChange', 'sources', 'maturity', 'scope', 'tags', 'group')
+           if k in parent},
+        'highlighted': False,
+    }
+
+
+def write(path: Path, text: str, dry: bool, written: list):
+    written.append(path)
+    if dry:
+        return
+    path.parent.mkdir(parents=True, exist_ok=True)
+    path.write_text(text, encoding='utf-8', newline='\n')
+
+
+class _NoAliasDumper(yaml.SafeDumper):
+    def ignore_aliases(self, data):
+        return True
+
+
+def dump_yaml(data) -> str:
+    return yaml.dump(data, Dumper=_NoAliasDumper, sort_keys=False, allow_unicode=True, width=120)
+
+
+def main() -> int:
+    ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+    ap.add_argument('--plan', required=True)
+    ap.add_argument('--repo', default='.')
+    ap.add_argument('--dry-run', action='store_true')
+    args = ap.parse_args()
+
+    repo = Path(args.repo).resolve()
+    root = repo / '_sources' / 'spec-examples'
+    plan = yaml.safe_load(Path(args.plan).read_text(encoding='utf-8'))
+    parent_meta = json.loads((root / 'bblock.json').read_text(encoding='utf-8'))
+    parent_examples = yaml.safe_load((root / 'examples.yaml').read_text(encoding='utf-8')) or {}
+    prefixes = parent_examples.get('prefixes') or {}
+
+    examples = plan['examples']
+    # JSON-LD originals stay separate examples (in 'other': they are RDF documents, not
+    # schema-shaped JSON) with their own output name, so their reports don't overwrite the
+    # Turtle example of the same name.
+    siblings: dict[str, dict] = {}
+
+    by_group: dict[str, list[dict]] = {}
+    for e in examples:
+        by_group.setdefault(e['group'], []).append(e)
+
+    written: list[Path] = []
+    groups = plan['groups']
+    order = list(groups)
+    for group, entries in by_group.items():
+        yaml_examples = [x for e in entries for x in example_entries(e, siblings)]
+        if group == 'other':
+            write(root / 'examples.yaml', dump_yaml({'prefixes': prefixes, 'examples': yaml_examples}),
+                  args.dry_run, written)
+            continue
+        target = groups[group]['target']
+        container = [c for g in order[:order.index(group) + 1] for c in groups[g]['rootClasses']]
+        d = root / group
+        write(d / 'bblock.json', json.dumps(bblock_json(parent_meta, group, target), indent=2) + '\n',
+              args.dry_run, written)
+        write(d / 'schema.yaml', dump_yaml({
+            '$schema': 'https://json-schema.org/draft/2020-12/schema',
+            'description': f"SOSA specification examples conforming to {target}",
+            '$ref': f'bblocks://{target}',
+        }), args.dry_run, written)
+        write(d / 'examples.yaml', dump_yaml({'prefixes': prefixes, 'examples': yaml_examples}),
+              args.dry_run, written)
+        write(d / 'transforms.yaml', dump_yaml({'transforms': [{
+            'id': 'ttl-to-jsonld',
+            'description': (f"Frames the root resource ({', '.join(c.rsplit('/', 1)[-1] for c in groups[group]['rootClasses'])}) of a SOSA Turtle "
+                            f"example and compacts it with the `{target}` JSON-LD context. The output is "
+                            f"validated against `{target}`."),
+            'type': 'python',
+            'ref': f'../{TRANSFORM_FILE}',
+            'inputs': {'mediaTypes': ['text/turtle']},
+            'outputs': {'mediaTypes': [{'mimeType': 'application/json', 'defaultExtension': 'json'}],
+                        'profiles': [f'bblocks://{target}']},
+            'metadata': {'rootClasses': groups[group]['rootClasses'], 'containerClasses': container,
+                         **({'coerce': COERCE} if COERCE else {}), 'suppressTerms': SUPPRESS},
+        }]}), args.dry_run, written)
+        write(d / 'description.md', (
+            f"## SOSA specification examples: {GROUP_TITLES.get(group, group)}\n\n"
+            f"Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose "
+            f"root resource is validated against `{target}`.\n\n"
+            "Each Turtle example is:\n\n"
+            f"1. validated as RDF against the SHACL shapes inherited from `{target}`;\n"
+            "2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted "
+            f"with the `{target}` JSON-LD context;\n"
+            f"3. the transform output is validated against `{target}` (output profile validation): JSON "
+            "Schema, JSON-LD uplift with the target context, and SHACL.\n\n"
+            f"\n"), args.dry_run, written)
+
+    if 'other' not in by_group:
+        write(root / 'examples.yaml', dump_yaml({'prefixes': prefixes, 'examples': []}), args.dry_run, written)
+
+    # install the transform script
+    written.append(root / TRANSFORM_FILE)
+    if not args.dry_run:
+        (root / 'transforms').mkdir(exist_ok=True)
+        shutil.copyfile(TRANSFORM_ASSET, root / TRANSFORM_FILE)
+
+    for p in written:
+        print(('would write ' if args.dry_run else 'wrote ') + str(p.relative_to(repo)).replace('\\', '/'))
+    stale = [d.name for d in root.iterdir()
+             if d.is_dir() and (d / 'bblock.json').exists() and d.name not in by_group]
+    for s in stale:
+        print(f"NOTE: group block '{s}' is not in the plan any more - review and delete it manually")
+    print(f"\n{sum(len(v) for v in by_group.values())} examples in {len(by_group)} groups: "
+          + ', '.join(f"{g}={len(v)}" for g, v in by_group.items()))
+    return 0
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff --git a/_sources/features/observation/examples/hasResult.json b/_sources/features/observation/examples/hasResult.json
index 9ffb999f..df9ef51c 100644
--- a/_sources/features/observation/examples/hasResult.json
+++ b/_sources/features/observation/examples/hasResult.json
@@ -13,7 +13,7 @@
   },
   "properties": {
     "observedProperty": "https://dbpedia.org/ontology/population",
-    "resultTime": "1999",
+    "resultTime": "1999-01-01T00:00:00Z",
     "comment": "A complex result example",
     "hasFeatureOfInterest": "https://demo.pygeoapi.io/master/collections/dutch_windmills/items/Molens.2",
     "hasResult": {
diff --git a/_sources/features/observation/examples/observation.json b/_sources/features/observation/examples/observation.json
index 68b2a2dc..6cc57bea 100644
--- a/_sources/features/observation/examples/observation.json
+++ b/_sources/features/observation/examples/observation.json
@@ -8,7 +8,7 @@
   },
   "properties": {
     "observedProperty": "https://dbpedia.org/ontology/population",
-    "resultTime": "1999",
+    "resultTime": "1999-01-01T00:00:00Z",
     "comment": "Example of an inline membership - would entail hasMember relations",
     "hasFeatureOfInterest": "https://demo.pygeoapi.io/master/collections/dutch_windmills/items/Molens.2",
     "hasSimpleResult": 15555.0
diff --git a/_sources/features/observationCollection/example.json b/_sources/features/observationCollection/example.json
index 9a7ff821..030ecb12 100644
--- a/_sources/features/observationCollection/example.json
+++ b/_sources/features/observationCollection/example.json
@@ -5,7 +5,7 @@
     "featureType": "sosa:ObservationCollection",
     "properties": {
         "observedProperty": "http://dbpedia.org/ontology/population",
-        "resultTime": "1999",
+        "resultTime": "1999-01-01T00:00:00Z",
         "features": [
             {
                 "@id": "pop1999",
diff --git a/_sources/features/observationCollection/examples/observationCollection.json b/_sources/features/observationCollection/examples/observationCollection.json
index c34e46ad..5337f8c3 100644
--- a/_sources/features/observationCollection/examples/observationCollection.json
+++ b/_sources/features/observationCollection/examples/observationCollection.json
@@ -15,7 +15,7 @@
   "featureType": "sosa:ObservationCollection",
   "bbox": [5.057482747807393, 52.17198007698048, 5.092297735992092, 52.23651108372093],
   "properties": {
-    "resultTime": "1999"
+    "resultTime": "1999-01-01T00:00:00Z"
   },
   "features": [
     {
diff --git a/_sources/features/observationCollection/tests/observationCollection-props-fail.json b/_sources/features/observationCollection/tests/observationCollection-props-fail.json
index 92e9f4be..1aa0ff2f 100644
--- a/_sources/features/observationCollection/tests/observationCollection-props-fail.json
+++ b/_sources/features/observationCollection/tests/observationCollection-props-fail.json
@@ -3,7 +3,7 @@
   "type": "FeatureCollection",
   "featureType": "sosa:ObservationCollection",
   "properties": {
-    "resultTime": "1999"
+    "resultTime": "1999-01-01T00:00:00Z"
   },
   "features": [
     {
diff --git a/_sources/features/observationCollection/tests/observationCollection-props.json b/_sources/features/observationCollection/tests/observationCollection-props.json
index 731d3464..815bb1ed 100644
--- a/_sources/features/observationCollection/tests/observationCollection-props.json
+++ b/_sources/features/observationCollection/tests/observationCollection-props.json
@@ -15,7 +15,7 @@
   "featureType": "sosa:ObservationCollection",
   "properties": {
     "observedProperty": "https://example.org/someproperty",
-    "resultTime": "1999"
+    "resultTime": "1999-01-01T00:00:00Z"
   },
   "features": [
     {
diff --git a/_sources/spec-examples/actuations/bblock.json b/_sources/spec-examples/actuations/bblock.json
new file mode 100644
index 00000000..e19634e3
--- /dev/null
+++ b/_sources/spec-examples/actuations/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Actuations",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a actuations resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.actuation`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.actuation` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/actuations/description.md b/_sources/spec-examples/actuations/description.md
new file mode 100644
index 00000000..5b134996
--- /dev/null
+++ b/_sources/spec-examples/actuations/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Actuations
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.actuation`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.actuation`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.actuation` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.actuation` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/actuations/examples.yaml b/_sources/spec-examples/actuations/examples.yaml
new file mode 100644
index 00000000..f5fe2b4f
--- /dev/null
+++ b/_sources/spec-examples/actuations/examples.yaml
@@ -0,0 +1,33 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example open-window.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelFOI](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [open-window.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/open-window.ttl)'
+  base-output-filename: open-window
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/open-window.ttl
diff --git a/_sources/spec-examples/actuations/schema.yaml b/_sources/spec-examples/actuations/schema.yaml
new file mode 100644
index 00000000..0acb4605
--- /dev/null
+++ b/_sources/spec-examples/actuations/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.actuation
+$ref: bblocks://ogc.sosa.properties.actuation
diff --git a/_sources/spec-examples/actuations/transforms.yaml b/_sources/spec-examples/actuations/transforms.yaml
new file mode 100644
index 00000000..8e87fe6c
--- /dev/null
+++ b/_sources/spec-examples/actuations/transforms.yaml
@@ -0,0 +1,26 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Actuation) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.actuation`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.actuation`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.actuation
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Actuation
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    - http://www.w3.org/ns/sosa/Actuation
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/deployments/bblock.json b/_sources/spec-examples/deployments/bblock.json
new file mode 100644
index 00000000..7d84256b
--- /dev/null
+++ b/_sources/spec-examples/deployments/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Deployments",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a deployments resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.deployment`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.deployment` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/deployments/description.md b/_sources/spec-examples/deployments/description.md
new file mode 100644
index 00000000..7dbe4c82
--- /dev/null
+++ b/_sources/spec-examples/deployments/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Deployments
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.deployment`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.deployment`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.deployment` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.deployment` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/deployments/examples.yaml b/_sources/spec-examples/deployments/examples.yaml
new file mode 100644
index 00000000..1794a096
--- /dev/null
+++ b/_sources/spec-examples/deployments/examples.yaml
@@ -0,0 +1,49 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example LocatedDeployment.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [LocatedDeployment.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedDeployment.ttl)'
+  base-output-filename: LocatedDeployment
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedDeployment.ttl
+- title: Example dht22-deployment.ttl (root Room145Deployment)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [dht22-deployment.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22-deployment.ttl)'
+  base-output-filename: dht22-deployment
+  x-root: https://example.org/data/Room145Deployment
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22-deployment.ttl
+- title: Example dht22-deployment.ttl (root Room245Deployment)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [dht22-deployment.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22-deployment.ttl)'
+  base-output-filename: dht22-deployment--Room245Deployment
+  x-root: https://example.org/data/Room245Deployment
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22-deployment.ttl
diff --git a/_sources/spec-examples/deployments/schema.yaml b/_sources/spec-examples/deployments/schema.yaml
new file mode 100644
index 00000000..401381b0
--- /dev/null
+++ b/_sources/spec-examples/deployments/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.deployment
+$ref: bblocks://ogc.sosa.properties.deployment
diff --git a/_sources/spec-examples/deployments/transforms.yaml b/_sources/spec-examples/deployments/transforms.yaml
new file mode 100644
index 00000000..8df838db
--- /dev/null
+++ b/_sources/spec-examples/deployments/transforms.yaml
@@ -0,0 +1,27 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Deployment) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.deployment`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.deployment`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.deployment
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Deployment
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    - http://www.w3.org/ns/sosa/Actuation
+    - http://www.w3.org/ns/sosa/Deployment
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/examples.yaml b/_sources/spec-examples/examples.yaml
index b7df2957..19f021d9 100644
--- a/_sources/spec-examples/examples.yaml
+++ b/_sources/spec-examples/examples.yaml
@@ -16,7 +16,7 @@ prefixes:
   schema: http://schema.org/
   seas: https://w3id.org/seas/
   sensor: https://example.org/sensor/
-  sh: http://www.w3.org/ns/shacl
+  sh: http://www.w3.org/ns/shacl#
   skos: http://www.w3.org/2004/02/skos/core#
   sosa: http://www.w3.org/ns/sosa/
   system: http://www.w3.org/ns/ssn/systems/
@@ -24,240 +24,73 @@ prefixes:
   unit: http://qudt.org/vocab/unit/
   xsd: http://www.w3.org/2001/XMLSchema#
 examples:
-  - title: Example sample-relations.ttl
-    base-output-filename: sample-relations
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sample-relations.ttl
-  - title: Example ip68.ttl
-    base-output-filename: ip68
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl
-  - title: Example sunspots.ttl
-    base-output-filename: sunspots
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sunspots.ttl
-  - title: Example spinning-cups.ttl
-    base-output-filename: spinning-cups
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl
-  - title: Example seismograph.ttl
-    base-output-filename: seismograph
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/seismograph.ttl
-  - title: Example apartment-134.ttl
-    base-output-filename: apartment-134
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
-  - title: Example dht22-deployment.ttl
-    base-output-filename: dht22-deployment
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22-deployment.ttl
-  - title: Example dht22.ttl
-    base-output-filename: dht22
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl
-  - title: Example diet.ttl
-    base-output-filename: diet
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/diet.ttl
-  - title: Example forecast.ttl
-    base-output-filename: forecast
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.ttl
-      - language: json
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.jsonld
-  - title: Example GeometryResult.ttl
-    base-output-filename: GeometryResult
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResult.ttl
-  - title: Example GeometryResultSimple.ttl
-    base-output-filename: GeometryResultSimple
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResultSimple.ttl
-  - title: Example historical-airtemp.ttl
-    base-output-filename: historical-airtemp
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/historical-airtemp.ttl
-  - title: Example IBS-TH2-PLUS-brief.ttl
-    base-output-filename: IBS-TH2-PLUS-brief
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-brief.ttl
-  - title: Example IBS-TH2-PLUS.ttl
-    base-output-filename: IBS-TH2-PLUS
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS.ttl
-  - title: Example IDEAS.ttl
-    base-output-filename: IDEAS
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IDEAS.ttl
-  - title: Example InkBird-IBS-TH2-Range.ttl
-    base-output-filename: InkBird-IBS-TH2-Range
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-Range.ttl
-  - title: Example iphone_barometer-sosa.ttl
-    base-output-filename: iphone_barometer-sosa
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl
-  - title: Example LocatedDeployment.ttl
-    base-output-filename: LocatedDeployment
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedDeployment.ttl
-  - title: Example LocatedPlatform.ttl
-    base-output-filename: LocatedPlatform
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedPlatform.ttl
-  - title: Example LocatedSample.ttl
-    base-output-filename: LocatedSample
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSample.ttl
-  - title: Example LocatedSampling.ttl
-    base-output-filename: LocatedSampling
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSampling.ttl
-  - title: Example LocatedSensor.ttl
-    base-output-filename: LocatedSensor
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSensor.ttl
-  - title: Example obs-sample-foi.ttl
-    base-output-filename: obs-sample-foi
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/obs-sample-foi.ttl
-  - title: Example open-window.ttl
-    base-output-filename: open-window
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/open-window.ttl
-  - title: Example paleo-atmosphere.ttl
-    base-output-filename: paleo-atmosphere
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/paleo-atmosphere.ttl
-  - title: Example smiley.ttl
-    base-output-filename: smiley
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/smiley.ttl
-  - title: Example Temperature-i-adopt.ttl
-    base-output-filename: Temperature-i-adopt
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-i-adopt.ttl
-  - title: Example Temperature-of-interest-specialization.ttl
-    base-output-filename: Temperature-of-interest-specialization
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-of-interest-specialization.ttl
-  - title: Example Thermometer.ttl
-    base-output-filename: Thermometer
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Thermometer.ttl
-  - title: Example timeseries-oc.ttl
-    base-output-filename: timeseries-oc
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-oc.ttl
-  - title: Example timeseries-result-inline.ttl
-    base-output-filename: timeseries-result-inline
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-inline.ttl
-  - title: Example timeseries-result-link.ttl
-    base-output-filename: timeseries-result-link
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-link.ttl
-  - title: Example tree-height.ttl
-    base-output-filename: tree-height
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/tree-height.ttl
-  - title: Example UOM-cdt.ttl
-    base-output-filename: UOM-cdt
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-cdt.ttl
-  - title: Example UOM-qudt-object.ttl
-    base-output-filename: UOM-qudt-object
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-object.ttl
-  - title: Example IBS-TH2-PLUS-capabilities.ttl
-    base-output-filename: IBS-TH2-PLUS-capabilities
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-capabilities.ttl
-  - title: Example InkBird-IBS-TH2-properties.ttl
-    base-output-filename: InkBird-IBS-TH2-properties
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-properties.ttl
-  - title: Example InkBird-IBS-TH2-survivable-conditions.ttl
-    base-output-filename: InkBird-IBS-TH2-survivable-conditions
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-survivable-conditions.ttl
-  - title: Example battery-lifetime.ttl
-    base-output-filename: battery-lifetime
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/battery-lifetime.ttl
-  - title: Example dqv.ttl
-    base-output-filename: dqv
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dqv.ttl
-  - title: Example i-adopt.ttl
-    base-output-filename: i-adopt
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/i-adopt.ttl
-  - title: Example PlannedDeployment.ttl
-    base-output-filename: PlannedDeployment
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedDeployment.ttl
-  - title: Example PlannedObservationCollection.ttl
-    base-output-filename: PlannedObservationCollection
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedObservationCollection.ttl
-  - title: Example PlannedSampleCollection.ttl
-    base-output-filename: PlannedSampleCollection
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedSampleCollection.ttl
-  - title: Example UOM-qudt-collection.ttl
-    base-output-filename: UOM-qudt-collection
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-collection.ttl
-  - title: Example bubble-provenance.ttl
-    base-output-filename: bubble-provenance
-    snippets:
-      - language: ttl
-        ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/bubble-provenance.ttl
+- title: Example forecast.jsonld
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimes](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [forecast.jsonld](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.jsonld)'
+  base-output-filename: forecast-jsonld
+  snippets:
+  - language: jsonld
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.jsonld
+- title: Example Temperature-of-interest-specialization.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPropertyDefinition](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [Temperature-of-interest-specialization.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-of-interest-specialization.ttl)'
+  base-output-filename: Temperature-of-interest-specialization
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-of-interest-specialization.ttl
+- title: Example IBS-TH2-PLUS-brief.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelComplexSystem](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [IBS-TH2-PLUS-brief.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-brief.ttl)'
+  base-output-filename: IBS-TH2-PLUS-brief
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-brief.ttl
+- title: Example IBS-TH2-PLUS.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSystemType](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [IBS-TH2-PLUS.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS.ttl)'
+  base-output-filename: IBS-TH2-PLUS
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS.ttl
+- title: Example InkBird-IBS-TH2-properties.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [InkBird-IBS-TH2-properties.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-properties.ttl)'
+  base-output-filename: InkBird-IBS-TH2-properties
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-properties.ttl
+- title: Example i-adopt.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [i-adopt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/i-adopt.ttl)'
+  base-output-filename: i-adopt
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/i-adopt.ttl
+- title: Example dqv.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [dqv.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dqv.ttl)'
+  base-output-filename: dqv
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dqv.ttl
+- title: Example InkBird-IBS-TH2-Range.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [InkBird-IBS-TH2-Range.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-Range.ttl)'
+  base-output-filename: InkBird-IBS-TH2-Range
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-Range.ttl
+- title: Example IDEAS.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [IDEAS.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IDEAS.ttl)'
+  base-output-filename: IDEAS
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IDEAS.ttl
+- title: Example Temperature-i-adopt.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [Temperature-i-adopt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-i-adopt.ttl)'
+  base-output-filename: Temperature-i-adopt
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Temperature-i-adopt.ttl
diff --git a/_sources/spec-examples/observation-collections/bblock.json b/_sources/spec-examples/observation-collections/bblock.json
new file mode 100644
index 00000000..99e4615e
--- /dev/null
+++ b/_sources/spec-examples/observation-collections/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Observation Collections",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a observation collections resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.observationCollection`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.observationCollection` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/observation-collections/description.md b/_sources/spec-examples/observation-collections/description.md
new file mode 100644
index 00000000..173529d2
--- /dev/null
+++ b/_sources/spec-examples/observation-collections/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Observation Collections
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.observationCollection`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.observationCollection`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.observationCollection` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.observationCollection` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/observation-collections/examples.yaml b/_sources/spec-examples/observation-collections/examples.yaml
new file mode 100644
index 00000000..6c2a4f33
--- /dev/null
+++ b/_sources/spec-examples/observation-collections/examples.yaml
@@ -0,0 +1,126 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example UOM-qudt-collection.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelQuantity](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [UOM-qudt-collection.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-collection.ttl)'
+  base-output-filename: UOM-qudt-collection
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-collection.ttl
+- title: Example timeseries-oc.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimeSeries](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [timeseries-oc.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-oc.ttl)'
+  base-output-filename: timeseries-oc
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-oc.ttl
+- title: Example OCrule1.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelCollectionRules](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [OCrule1.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule1.ttl)'
+  base-output-filename: OCrule1
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule1.ttl
+- title: Example OCrule2.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelCollectionRules](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [OCrule2.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule2.ttl)'
+  base-output-filename: OCrule2
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule2.ttl
+- title: Example OCrule3.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelCollectionRules](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [OCrule3.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule3.ttl)'
+  base-output-filename: OCrule3
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule3.ttl
+- title: Example OCrule4.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelCollectionRules](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [OCrule4.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule4.ttl)'
+  base-output-filename: OCrule4
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule4.ttl
+- title: Example OCrule5.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelCollectionRules](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [OCrule5.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule5.ttl)'
+  base-output-filename: OCrule5
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/tests/ObservationCollection/OCrule5.ttl
+- title: Example PlannedObservationCollection.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPlan](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [PlannedObservationCollection.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedObservationCollection.ttl)'
+  base-output-filename: PlannedObservationCollection
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedObservationCollection.ttl
+- title: Example ex6.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSystemInstance](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [ex6.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex6.ttl)'
+  base-output-filename: ex6
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex6.ttl
+- title: Example ex7.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSystemInstance](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [ex7.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex7.ttl)'
+  base-output-filename: ex7
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex7.ttl
+- title: Example InkBird-IBS-TH2-survivable-conditions.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [InkBird-IBS-TH2-survivable-conditions.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-survivable-conditions.ttl)'
+  base-output-filename: InkBird-IBS-TH2-survivable-conditions
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-survivable-conditions.ttl
+- title: Example IBS-TH2-PLUS-capabilities.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [IBS-TH2-PLUS-capabilities.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-capabilities.ttl)'
+  base-output-filename: IBS-TH2-PLUS-capabilities
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-capabilities.ttl
+- title: Example dht22.ttl (root DHT22_4578_HumiditySensorCapabilities)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [dht22.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl)'
+  base-output-filename: dht22
+  x-root: https://example.org/data/DHT22_4578_HumiditySensorCapabilities
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl
+- title: Example dht22.ttl (root DHT22_4578_TemperatureSensorCapabilities)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [dht22.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl)'
+  base-output-filename: dht22--DHT22_4578_TemperatureSensorCapabilities
+  x-root: https://example.org/data/DHT22_4578_TemperatureSensorCapabilities
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl
diff --git a/_sources/spec-examples/observation-collections/schema.yaml b/_sources/spec-examples/observation-collections/schema.yaml
new file mode 100644
index 00000000..562703f4
--- /dev/null
+++ b/_sources/spec-examples/observation-collections/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.observationCollection
+$ref: bblocks://ogc.sosa.properties.observationCollection
diff --git a/_sources/spec-examples/observation-collections/transforms.yaml b/_sources/spec-examples/observation-collections/transforms.yaml
new file mode 100644
index 00000000..ea1bd760
--- /dev/null
+++ b/_sources/spec-examples/observation-collections/transforms.yaml
@@ -0,0 +1,22 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (ObservationCollection) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.observationCollection`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.observationCollection`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.observationCollection
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/observations/bblock.json b/_sources/spec-examples/observations/bblock.json
new file mode 100644
index 00000000..ce66afea
--- /dev/null
+++ b/_sources/spec-examples/observations/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Observations",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a observations resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.observation`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.observation` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/observations/description.md b/_sources/spec-examples/observations/description.md
new file mode 100644
index 00000000..c51c119a
--- /dev/null
+++ b/_sources/spec-examples/observations/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Observations
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.observation`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.observation`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.observation` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.observation` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/observations/examples.yaml b/_sources/spec-examples/observations/examples.yaml
new file mode 100644
index 00000000..44b9576c
--- /dev/null
+++ b/_sources/spec-examples/observations/examples.yaml
@@ -0,0 +1,223 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example UOM-qudt-object.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelQuantity](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [UOM-qudt-object.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-object.ttl)'
+  base-output-filename: UOM-qudt-object
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-object.ttl
+- title: Example obs-sample-foi.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelFOI](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [obs-sample-foi.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/obs-sample-foi.ttl)'
+  base-output-filename: obs-sample-foi
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/obs-sample-foi.ttl
+- title: Example timeseries-result-inline.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimeSeries](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [timeseries-result-inline.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-inline.ttl)'
+  base-output-filename: timeseries-result-inline
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-inline.ttl
+- title: Example timeseries-result-link.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimeSeries](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [timeseries-result-link.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-link.ttl)'
+  base-output-filename: timeseries-result-link
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-link.ttl
+- title: Example GeometryResult.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [GeometryResult.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResult.ttl)'
+  base-output-filename: GeometryResult
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResult.ttl
+- title: Example GeometryResultSimple.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [GeometryResultSimple.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResultSimple.ttl)'
+  base-output-filename: GeometryResultSimple
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/GeometryResultSimple.ttl
+- title: Example forecast.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimes](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [forecast.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.ttl)'
+  base-output-filename: forecast
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/forecast.ttl
+- title: Example diet.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimes](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [diet.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/diet.ttl)'
+  base-output-filename: diet
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/diet.ttl
+- title: Example historical-airtemp.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimes](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [historical-airtemp.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/historical-airtemp.ttl)'
+  base-output-filename: historical-airtemp
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/historical-airtemp.ttl
+- title: Example paleo-atmosphere.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelTimes](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [paleo-atmosphere.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/paleo-atmosphere.ttl)'
+  base-output-filename: paleo-atmosphere
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/paleo-atmosphere.ttl
+- title: Example AgeOfAir-i-adopt.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPropertyDefinition](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [AgeOfAir-i-adopt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/AgeOfAir-i-adopt.ttl)'
+  base-output-filename: AgeOfAir-i-adopt
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/AgeOfAir-i-adopt.ttl
+- title: Example CO2InAir-i-adopt.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPropertyDefinition](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [CO2InAir-i-adopt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/CO2InAir-i-adopt.ttl)'
+  base-output-filename: CO2InAir-i-adopt
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/CO2InAir-i-adopt.ttl
+- title: Example Thermometer.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSystemType](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [Thermometer.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Thermometer.ttl)'
+  base-output-filename: Thermometer
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Thermometer.ttl
+- title: Example battery-lifetime.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [battery-lifetime.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/battery-lifetime.ttl)'
+  base-output-filename: battery-lifetime
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/battery-lifetime.ttl
+- title: Example ip68.ttl (root Observation_5872357_battery)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [ip68.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl)'
+  base-output-filename: ip68
+  x-root: https://example.org/data/Observation_5872357_battery
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl
+- title: Example ip68.ttl (root Observation_5872357_temperature)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [ip68.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl)'
+  base-output-filename: ip68--Observation_5872357_temperature
+  x-root: https://example.org/data/Observation_5872357_temperature
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl
+- title: Example UOM-cdt.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [UOM-cdt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-cdt.ttl)'
+  base-output-filename: UOM-cdt
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-cdt.ttl
+- title: Example apartment-134.ttl (root Observation_235714)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [apartment-134.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl)'
+  base-output-filename: apartment-134
+  x-root: https://example.org/data/Observation_235714
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
+- title: Example apartment-134.ttl (root Observation_235754)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [apartment-134.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl)'
+  base-output-filename: apartment-134--Observation_235754
+  x-root: https://example.org/data/Observation_235754
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
+- title: Example iphone_barometer-sosa.ttl (root Observation_346344)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [iphone_barometer-sosa.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl)'
+  base-output-filename: iphone_barometer-sosa
+  x-root: https://example.org/data/Observation_346344
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl
+- title: Example iphone_barometer-sosa.ttl (root 346345)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [iphone_barometer-sosa.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl)'
+  base-output-filename: iphone_barometer-sosa--346345
+  x-root: https://example.org/data/iphone_barometer/Observation/346345
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl
+- title: Example seismograph.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [seismograph.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/seismograph.ttl)'
+  base-output-filename: seismograph
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/seismograph.ttl
+- title: Example smiley.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [smiley.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/smiley.ttl)'
+  base-output-filename: smiley
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/smiley.ttl
+- title: Example spinning-cups.ttl (root observation_147)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [spinning-cups.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl)'
+  base-output-filename: spinning-cups
+  x-root: https://example.org/data/observation_147
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl
+- title: Example spinning-cups.ttl (root observation_148)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [spinning-cups.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl)'
+  base-output-filename: spinning-cups--observation_148
+  x-root: https://example.org/data/observation_148
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl
+- title: Example sunspots.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [sunspots.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sunspots.ttl)'
+  base-output-filename: sunspots
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sunspots.ttl
+- title: Example tree-height.ttl
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [tree-height.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/tree-height.ttl)'
+  base-output-filename: tree-height
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/tree-height.ttl
diff --git a/_sources/spec-examples/observations/schema.yaml b/_sources/spec-examples/observations/schema.yaml
new file mode 100644
index 00000000..914eabf8
--- /dev/null
+++ b/_sources/spec-examples/observations/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.observation
+$ref: bblocks://ogc.sosa.properties.observation
diff --git a/_sources/spec-examples/observations/transforms.yaml b/_sources/spec-examples/observations/transforms.yaml
new file mode 100644
index 00000000..a8b677e2
--- /dev/null
+++ b/_sources/spec-examples/observations/transforms.yaml
@@ -0,0 +1,24 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Observation) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.observation`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.observation`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.observation
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Observation
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/platforms/bblock.json b/_sources/spec-examples/platforms/bblock.json
new file mode 100644
index 00000000..091c0fd8
--- /dev/null
+++ b/_sources/spec-examples/platforms/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Platforms",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a platforms resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.platform`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.platform` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/platforms/description.md b/_sources/spec-examples/platforms/description.md
new file mode 100644
index 00000000..3293a80a
--- /dev/null
+++ b/_sources/spec-examples/platforms/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Platforms
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.platform`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.platform`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.platform` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.platform` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/platforms/examples.yaml b/_sources/spec-examples/platforms/examples.yaml
new file mode 100644
index 00000000..a7939fae
--- /dev/null
+++ b/_sources/spec-examples/platforms/examples.yaml
@@ -0,0 +1,33 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example LocatedPlatform.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [LocatedPlatform.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedPlatform.ttl)'
+  base-output-filename: LocatedPlatform
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedPlatform.ttl
diff --git a/_sources/spec-examples/platforms/schema.yaml b/_sources/spec-examples/platforms/schema.yaml
new file mode 100644
index 00000000..84a9cb4a
--- /dev/null
+++ b/_sources/spec-examples/platforms/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.platform
+$ref: bblocks://ogc.sosa.properties.platform
diff --git a/_sources/spec-examples/platforms/transforms.yaml b/_sources/spec-examples/platforms/transforms.yaml
new file mode 100644
index 00000000..666b8c9a
--- /dev/null
+++ b/_sources/spec-examples/platforms/transforms.yaml
@@ -0,0 +1,30 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Platform) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.platform`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.platform`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.platform
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Platform
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    - http://www.w3.org/ns/sosa/Actuation
+    - http://www.w3.org/ns/sosa/Deployment
+    - http://www.w3.org/ns/sosa/Sample
+    - http://www.w3.org/ns/sosa/MaterialSample
+    - http://www.w3.org/ns/sosa/Platform
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/sample-collections/bblock.json b/_sources/spec-examples/sample-collections/bblock.json
new file mode 100644
index 00000000..306197f8
--- /dev/null
+++ b/_sources/spec-examples/sample-collections/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Sample Collections",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a sample collections resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.sampleCollection`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.sampleCollection` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/sample-collections/description.md b/_sources/spec-examples/sample-collections/description.md
new file mode 100644
index 00000000..853f7ae6
--- /dev/null
+++ b/_sources/spec-examples/sample-collections/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Sample Collections
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.sampleCollection`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.sampleCollection`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.sampleCollection` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.sampleCollection` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/sample-collections/examples.yaml b/_sources/spec-examples/sample-collections/examples.yaml
new file mode 100644
index 00000000..18f329d4
--- /dev/null
+++ b/_sources/spec-examples/sample-collections/examples.yaml
@@ -0,0 +1,40 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example PlannedDeployment.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPlan](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [PlannedDeployment.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedDeployment.ttl)'
+  base-output-filename: PlannedDeployment
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedDeployment.ttl
+- title: Example PlannedSampleCollection.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelPlan](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [PlannedSampleCollection.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedSampleCollection.ttl)'
+  base-output-filename: PlannedSampleCollection
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/PlannedSampleCollection.ttl
diff --git a/_sources/spec-examples/sample-collections/schema.yaml b/_sources/spec-examples/sample-collections/schema.yaml
new file mode 100644
index 00000000..9e361e1e
--- /dev/null
+++ b/_sources/spec-examples/sample-collections/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.sampleCollection
+$ref: bblocks://ogc.sosa.properties.sampleCollection
diff --git a/_sources/spec-examples/sample-collections/transforms.yaml b/_sources/spec-examples/sample-collections/transforms.yaml
new file mode 100644
index 00000000..2e9bbed0
--- /dev/null
+++ b/_sources/spec-examples/sample-collections/transforms.yaml
@@ -0,0 +1,23 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (SampleCollection) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sampleCollection`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.sampleCollection`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.sampleCollection
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/SampleCollection
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/samples/bblock.json b/_sources/spec-examples/samples/bblock.json
new file mode 100644
index 00000000..1d520d3d
--- /dev/null
+++ b/_sources/spec-examples/samples/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Samples",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a samples resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.sample`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.sample` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/samples/description.md b/_sources/spec-examples/samples/description.md
new file mode 100644
index 00000000..0f791907
--- /dev/null
+++ b/_sources/spec-examples/samples/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Samples
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.sample`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.sample`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.sample` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.sample` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/samples/examples.yaml b/_sources/spec-examples/samples/examples.yaml
new file mode 100644
index 00000000..39c00503
--- /dev/null
+++ b/_sources/spec-examples/samples/examples.yaml
@@ -0,0 +1,49 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example LocatedSample.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [LocatedSample.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSample.ttl)'
+  base-output-filename: LocatedSample
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSample.ttl
+- title: Example sample-relations.ttl (root CSRWA25569-mount7)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [sample-relations.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sample-relations.ttl)'
+  base-output-filename: sample-relations
+  x-root: https://example.org/data/sample-relations#CSRWA25569-mount7
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sample-relations.ttl
+- title: Example sample-relations.ttl (root CSRWA25569-mount7-spot1)
+  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [sample-relations.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sample-relations.ttl)'
+  base-output-filename: sample-relations--CSRWA25569-mount7-spot1
+  x-root: https://example.org/data/sample-relations#CSRWA25569-mount7-spot1
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sample-relations.ttl
diff --git a/_sources/spec-examples/samples/schema.yaml b/_sources/spec-examples/samples/schema.yaml
new file mode 100644
index 00000000..5d4c5a0c
--- /dev/null
+++ b/_sources/spec-examples/samples/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.sample
+$ref: bblocks://ogc.sosa.properties.sample
diff --git a/_sources/spec-examples/samples/transforms.yaml b/_sources/spec-examples/samples/transforms.yaml
new file mode 100644
index 00000000..4ab4a2d0
--- /dev/null
+++ b/_sources/spec-examples/samples/transforms.yaml
@@ -0,0 +1,30 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Sample, MaterialSample) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sample`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.sample`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.sample
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Sample
+    - http://www.w3.org/ns/sosa/MaterialSample
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    - http://www.w3.org/ns/sosa/Actuation
+    - http://www.w3.org/ns/sosa/Deployment
+    - http://www.w3.org/ns/sosa/Sample
+    - http://www.w3.org/ns/sosa/MaterialSample
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/samplings/bblock.json b/_sources/spec-examples/samplings/bblock.json
new file mode 100644
index 00000000..58865203
--- /dev/null
+++ b/_sources/spec-examples/samplings/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Samplings",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a samplings resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.sampling`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.sampling` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/samplings/description.md b/_sources/spec-examples/samplings/description.md
new file mode 100644
index 00000000..22deb83b
--- /dev/null
+++ b/_sources/spec-examples/samplings/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Samplings
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.sampling`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.sampling`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.sampling` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.sampling` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/samplings/examples.yaml b/_sources/spec-examples/samplings/examples.yaml
new file mode 100644
index 00000000..32c459ab
--- /dev/null
+++ b/_sources/spec-examples/samplings/examples.yaml
@@ -0,0 +1,49 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example bubble-provenance.ttl (root CoreEx1923)
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSampleChains](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [bubble-provenance.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/bubble-provenance.ttl)'
+  base-output-filename: bubble-provenance
+  x-root: https://example.org/data/CoreEx1923
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/bubble-provenance.ttl
+- title: Example bubble-provenance.ttl (root WellDrilling4578)
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelSampleChains](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [bubble-provenance.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/bubble-provenance.ttl)'
+  base-output-filename: bubble-provenance--WellDrilling4578
+  x-root: https://example.org/data/WellDrilling4578
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/bubble-provenance.ttl
+- title: Example LocatedSampling.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [LocatedSampling.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSampling.ttl)'
+  base-output-filename: LocatedSampling
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSampling.ttl
diff --git a/_sources/spec-examples/samplings/schema.yaml b/_sources/spec-examples/samplings/schema.yaml
new file mode 100644
index 00000000..09f4004c
--- /dev/null
+++ b/_sources/spec-examples/samplings/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.sampling
+$ref: bblocks://ogc.sosa.properties.sampling
diff --git a/_sources/spec-examples/samplings/transforms.yaml b/_sources/spec-examples/samplings/transforms.yaml
new file mode 100644
index 00000000..dc540f79
--- /dev/null
+++ b/_sources/spec-examples/samplings/transforms.yaml
@@ -0,0 +1,25 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Sampling) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sampling`
+    JSON-LD context. The output is validated against `ogc.sosa.properties.sampling`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.sampling
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Sampling
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/systems/bblock.json b/_sources/spec-examples/systems/bblock.json
new file mode 100644
index 00000000..36041b17
--- /dev/null
+++ b/_sources/spec-examples/systems/bblock.json
@@ -0,0 +1,28 @@
+{
+  "name": "SOSA specification examples: Systems (Sensors, Actuators, Samplers)",
+  "abstract": "Examples from the SOSA/SSN specification whose root resource is a systems (sensors, actuators, samplers) resource. Each Turtle example is validated against the SHACL rules of `ogc.sosa.properties.system`, and converted to JSON-LD by the `ttl-to-jsonld` transform, whose output is validated against the `ogc.sosa.properties.system` building block (JSON Schema, JSON-LD context and SHACL).",
+  "status": "under-development",
+  "dateTimeAddition": "2023-04-13T00:00:00Z",
+  "itemClass": "schema",
+  "register": "ogc-building-block-register",
+  "version": "1.0",
+  "dateOfLastChange": "2023-04-13",
+  "sources": [
+    {
+      "title": "Semantic Sensor Network Ontology",
+      "link": "https://www.w3.org/TR/vocab-ssn/"
+    }
+  ],
+  "maturity": "development",
+  "scope": "development",
+  "tags": [
+    "sosa",
+    "ssn",
+    "observations",
+    "o&m",
+    "OMS",
+    "OWA"
+  ],
+  "group": "SOSA",
+  "highlighted": false
+}
diff --git a/_sources/spec-examples/systems/description.md b/_sources/spec-examples/systems/description.md
new file mode 100644
index 00000000..8a1f50dd
--- /dev/null
+++ b/_sources/spec-examples/systems/description.md
@@ -0,0 +1,11 @@
+## SOSA specification examples: Systems (Sensors, Actuators, Samplers)
+
+Examples from the [SOSA/SSN specification](https://w3c.github.io/sdw-sosa-ssn/ssn/) whose root resource is validated against `ogc.sosa.properties.system`.
+
+Each Turtle example is:
+
+1. validated as RDF against the SHACL shapes inherited from `ogc.sosa.properties.system`;
+2. converted by the `ttl-to-jsonld` transform: the root resource is framed and compacted with the `ogc.sosa.properties.system` JSON-LD context;
+3. the transform output is validated against `ogc.sosa.properties.system` (output profile validation): JSON Schema, JSON-LD uplift with the target context, and SHACL.
+
+
diff --git a/_sources/spec-examples/systems/examples.yaml b/_sources/spec-examples/systems/examples.yaml
new file mode 100644
index 00000000..169a0874
--- /dev/null
+++ b/_sources/spec-examples/systems/examples.yaml
@@ -0,0 +1,33 @@
+prefixes:
+  cdt: http://w3id.org/lindt/custom_datatypes#
+  equipment: https://rdf.ag/o/equipment/
+  ex: https://example.org/data/
+  geo: http://www.opengis.net/ont/geosparql#
+  gr: http://purl.org/goodrelations/v1#
+  gs1: https://gs1.org/voc/
+  om: http://www.ontology-of-units-of-measure.org/resource/om-2/
+  owl: http://www.w3.org/2002/07/owl#
+  prov: http://www.w3.org/ns/prov#
+  qk: http://qudt.org/vocab/quantitykind/
+  qudt: http://qudt.org/schema/qudt/
+  rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns#
+  rdfp: https://w3id.org/rdfp/
+  rdfs: http://www.w3.org/2000/01/rdf-schema#
+  schema: http://schema.org/
+  seas: https://w3id.org/seas/
+  sensor: https://example.org/sensor/
+  sh: http://www.w3.org/ns/shacl#
+  skos: http://www.w3.org/2004/02/skos/core#
+  sosa: http://www.w3.org/ns/sosa/
+  system: http://www.w3.org/ns/ssn/systems/
+  time: http://www.w3.org/2006/time#
+  unit: http://qudt.org/vocab/unit/
+  xsd: http://www.w3.org/2001/XMLSchema#
+examples:
+- title: Example LocatedSensor.ttl
+  content: 'Example included in the SOSA/SSN specification section(s): [ModelLocation](https://w3c.github.io/sdw-sosa-ssn/ssn/).
+    Source: [LocatedSensor.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSensor.ttl)'
+  base-output-filename: LocatedSensor
+  snippets:
+  - language: ttl
+    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSensor.ttl
diff --git a/_sources/spec-examples/systems/schema.yaml b/_sources/spec-examples/systems/schema.yaml
new file mode 100644
index 00000000..68cc5b8b
--- /dev/null
+++ b/_sources/spec-examples/systems/schema.yaml
@@ -0,0 +1,3 @@
+$schema: https://json-schema.org/draft/2020-12/schema
+description: SOSA specification examples conforming to ogc.sosa.properties.system
+$ref: bblocks://ogc.sosa.properties.system
diff --git a/_sources/spec-examples/systems/transforms.yaml b/_sources/spec-examples/systems/transforms.yaml
new file mode 100644
index 00000000..f1241dd9
--- /dev/null
+++ b/_sources/spec-examples/systems/transforms.yaml
@@ -0,0 +1,37 @@
+transforms:
+- id: ttl-to-jsonld
+  description: Frames the root resource (Sensor, Actuator, Sampler, System) of a SOSA Turtle example and compacts it with
+    the `ogc.sosa.properties.system` JSON-LD context. The output is validated against `ogc.sosa.properties.system`.
+  type: python
+  ref: ../transforms/ttl_to_sosa_json.py
+  inputs:
+    mediaTypes:
+    - text/turtle
+  outputs:
+    mediaTypes:
+    - mimeType: application/json
+      defaultExtension: json
+    profiles:
+    - bblocks://ogc.sosa.properties.system
+  metadata:
+    rootClasses:
+    - http://www.w3.org/ns/sosa/Sensor
+    - http://www.w3.org/ns/sosa/Actuator
+    - http://www.w3.org/ns/sosa/Sampler
+    - http://www.w3.org/ns/sosa/System
+    containerClasses:
+    - http://www.w3.org/ns/sosa/ObservationCollection
+    - http://www.w3.org/ns/sosa/SampleCollection
+    - http://www.w3.org/ns/sosa/Observation
+    - http://www.w3.org/ns/sosa/Sampling
+    - http://www.w3.org/ns/sosa/Actuation
+    - http://www.w3.org/ns/sosa/Deployment
+    - http://www.w3.org/ns/sosa/Sample
+    - http://www.w3.org/ns/sosa/MaterialSample
+    - http://www.w3.org/ns/sosa/Platform
+    - http://www.w3.org/ns/sosa/Sensor
+    - http://www.w3.org/ns/sosa/Actuator
+    - http://www.w3.org/ns/sosa/Sampler
+    - http://www.w3.org/ns/sosa/System
+    suppressTerms:
+    - features
diff --git a/_sources/spec-examples/transforms/ttl_to_sosa_json.py b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
new file mode 100644
index 00000000..5bae93b9
--- /dev/null
+++ b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
@@ -0,0 +1,145 @@
+# bblocks python transform: SOSA/SSN Turtle -> JSON-LD conforming to a target SOSA bblock.
+#
+# Installed by the spec-examples-jsonld skill. Referenced from transforms.yaml of each
+# _sources/spec-examples// block; runs inside bblocks-postprocess (rdflib + pyld).
+#
+# metadata (transforms.yaml):
+#   rootClasses: [IRI, ...]   classes whose instances become the root object
+#   containerClasses: [IRI]   classes whose SOSA links embed a root candidate (default rootClasses)
+#   coerce: {term: datatype}  typed-literal coercions added to the output's local @context, for
+#                             terms the target schema constrains to plain strings (e.g. resultTime
+#                             with format: date-time) but the target context does not coerce
+#   suppressTerms: [term]     context terms not to use when compacting (e.g. the GeoJSON alias
+#                             'features' for sosa:hasMember, so the schema's 'hasMember' is used)
+# per example (examples.yaml):
+#   x-root: IRI               pick this resource as the root (multi-root examples)
+#
+# Output: the root resource framed and compacted with the block's own JSON-LD context
+# (which is the target bblock's context, inherited via schema.yaml $ref), with that
+# context removed and replaced by a prefix-only @context for any non-SOSA terms. Output
+# profile validation re-applies the target block's context, so the JSON Schema, JSON-LD
+# context and SHACL shapes of the target are all exercised.
+import json
+from pathlib import Path
+
+from pyld import jsonld
+from rdflib import BNode, Graph, RDF, URIRef
+
+SOSA_SSN = ('http://www.w3.org/ns/sosa/', 'http://www.w3.org/ns/ssn/')
+
+
+def _get(obj, key, default=None):
+    if obj is None:
+        return default
+    if isinstance(obj, dict):
+        return obj.get(key, default)
+    return getattr(obj, key, default)
+
+
+meta = transform_metadata.metadata
+tctx = transform_metadata.context
+root_classes = [URIRef(c) for c in _get(meta, 'rootClasses', [])]
+container_classes = [URIRef(c) for c in (_get(meta, 'containerClasses') or [])] or root_classes
+example = _get(tctx, 'example') or {}
+wanted_root = _get(example, 'x-root')
+
+# --- block JSON-LD context (assembled by the postprocessor for this block) ---------------
+ctx_path = None
+if _get(tctx, 'jsonld_context_path'):
+    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(tctx, 'jsonld_context_path')
+if (ctx_path is None or not ctx_path.is_file()) and _get(meta, 'context'):
+    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(meta, 'context')
+if ctx_path is None or not ctx_path.is_file():
+    raise FileNotFoundError(f'JSON-LD context for this block not found ({ctx_path})')
+block_context = json.loads(ctx_path.read_text(encoding='utf-8'))['@context']
+
+# --- parse --------------------------------------------------------------------------------
+src = transform_metadata.source_mime_type or 'text/turtle'
+try:
+    g = Graph(bind_namespaces='none')
+except TypeError:  # rdflib < 7
+    g = Graph()
+g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle')
+prefixes = {p: str(ns) for p, ns in g.namespaces()
+            if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
+for p, ns in (_get(meta, '_prefixes') or {}).items():
+    prefixes.setdefault(p, ns)
+local_context = dict(prefixes)
+for term, datatype in (_get(meta, 'coerce') or {}).items():
+    term_def = block_context.get(term) if isinstance(block_context, dict) else None
+    term_id = term_def.get('@id') if isinstance(term_def, dict) else term_def
+    if term_id:
+        local_context[term] = {'@id': term_id, '@type': datatype}
+        prefixes.setdefault('xsd', 'http://www.w3.org/2001/XMLSchema#')
+        local_context.setdefault('xsd', prefixes['xsd'])
+
+
+def _instances(classes):
+    return {s for c in classes for s in g.subjects(RDF.type, c)}
+
+
+def _roots():
+    inst = _instances(root_classes)
+    containers = _instances(container_classes)
+    nested = set()
+    for s, p, o in g:
+        if o not in inst or s == o or p == RDF.type:
+            continue
+        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
+            nested.add(o)
+    return sorted(inst - nested, key=str)
+
+
+if wanted_root:
+    root = URIRef(wanted_root)
+    if (root, None, None) not in g:
+        raise ValueError(f'x-root {wanted_root} has no statements in the example')
+else:
+    roots = _roots()
+    if not roots:
+        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
+    root = roots[0]
+
+# Blank-node roots cannot be addressed by @id in a frame: skolemize just that node.
+if isinstance(root, BNode):
+    skolem = URIRef(f'urn:x-bnode:{root}')
+    for p, o in list(g.predicate_objects(root)):
+        g.remove((root, p, o)); g.add((skolem, p, o))
+    for s, p in list(g.subject_predicates(root)):
+        g.remove((s, p, root)); g.add((s, p, skolem))
+    root = skolem
+
+# --- frame + compact ----------------------------------------------------------------------
+expanded = json.loads(g.serialize(format='json-ld'))
+frame_context = dict(local_context, **{t: None for t in (_get(meta, 'suppressTerms') or [])})
+context = [block_context, frame_context] if frame_context else block_context
+framed = jsonld.frame(expanded, {'@context': context, '@id': str(root)},
+                      {'embed': '@once', 'omitGraph': True})
+framed.pop('@context', None)
+if '@graph' in framed:  # defensive: omitGraph should have collapsed a single match
+    framed = framed['@graph'][0]
+if str(framed.get('id', '')).startswith('urn:x-bnode:'):
+    framed.pop('id')
+
+
+
+def _usage(node, prefixes_used, keys_used):
+    if isinstance(node, dict):
+        for k, v in node.items():
+            keys_used.add(k)
+            _usage(k, prefixes_used, keys_used); _usage(v, prefixes_used, keys_used)
+    elif isinstance(node, list):
+        for v in node:
+            _usage(v, prefixes_used, keys_used)
+    elif isinstance(node, str) and ':' in node:
+        prefixes_used.add(node.split(':', 1)[0])
+
+
+used_prefixes, used_keys = set(), set()
+_usage(framed, used_prefixes, used_keys)
+local_context = {k: v for k, v in local_context.items()
+                 if (k in used_prefixes if isinstance(v, str) else k in used_keys)}
+if any(not isinstance(v, str) for v in local_context.values()):
+    local_context['xsd'] = 'http://www.w3.org/2001/XMLSchema#'
+out = {'@context': local_context, **framed} if local_context else framed
+output_data = json.dumps(out, indent=2, ensure_ascii=False)
diff --git a/sosa-ssn.jsonld b/sosa-ssn.jsonld
index bd933c99..b1e48d82 100644
--- a/sosa-ssn.jsonld
+++ b/sosa-ssn.jsonld
@@ -111,7 +111,10 @@
       "@id": "sosa:detects",
       "@type": "@id"
     },
-    "endTime": "sosa:endTime",
+    "endTime": {
+      "@id": "sosa:endTime",
+      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+    },
     "features": {
       "@id": "sosa:hasMember",
       "@type": "@id"
@@ -168,10 +171,7 @@
       "@id": "sosa:hasSampledFeature",
       "@type": "@id"
     },
-    "hasSimpleResult": {
-      "@id": "sosa:hasSimpleResult",
-      "@type": "@id"
-    },
+    "hasSimpleResult": "sosa:hasSimpleResult",
     "hasSubSystem": {
       "@id": "sosa:hasSubSystem",
       "@type": "@id",
@@ -294,8 +294,14 @@
       "@id": "sosa:phenomenonTime",
       "@type": "@id"
     },
-    "resultTime": "sosa:resultTime",
-    "startTime": "sosa:startTime",
+    "resultTime": {
+      "@id": "sosa:resultTime",
+      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+    },
+    "startTime": {
+      "@id": "sosa:startTime",
+      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+    },
     "usedProcedure": {
       "@id": "sosa:usedProcedure",
       "@type": "@id"

From 6c9b79c51b8443f07545c9864b0d1d681276d141 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Mon, 19 Oct 2026 11:43:11 +1100
Subject: [PATCH 02/11] Support per-example SHACL closures for spec examples

closures/.ttl (or .ttl for all roots of a multi-root example)
under _sources/spec-examples/ is added as that example's snippet
shacl-closure. It applies to the Turtle validation and, with
opengeospatial/bblocks-postprocess#94, to the transform output profile
validation. The transform does not merge it into its output. Closures are
for facts about related resources only, not the example's own missing
mandatory fields.

Co-Authored-By: Claude Opus 5.5 
---
 .claude/skills/spec-examples-jsonld/SKILL.md  | 19 +++++++++++
 .../scripts/sync_spec_example_blocks.py       | 33 ++++++++++++++++---
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
index da398d4b..db2ee324 100644
--- a/.claude/skills/spec-examples-jsonld/SKILL.md
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -33,6 +33,7 @@ transforms/ttl_to_sosa_json.py   installed copy of the transform
 /transforms.yaml          ttl-to-jsonld, ref ../transforms/ttl_to_sosa_json.py,
                                  outputs.profiles: [bblocks://]
 /description.md
+closures/.ttl              hand-written, optional: see "Per-example SHACL closures"
 ```
 
 ## Grouping rules (classify_examples.py `GROUPS`)
@@ -67,6 +68,24 @@ If an example has several roots, the sync step writes one example per root, each
   `sosa:hasMember`, so the schema's `hasMember` is used.
 - Blank-node roots are skolemised just long enough to frame them, then the `id` is removed.
 
+## Per-example SHACL closures
+
+Put a Turtle file at `_sources/spec-examples/closures/.ttl`. A file named
+`.ttl` applies to every root of a multi-root example. The sync step adds it as the example
+snippet's `shacl-closure`. It is then used in two places:
+- when validating the Turtle example;
+- when profile-validating the transform output. This needs a postprocessor in which
+  `validate_transform_output` receives the snippet's closures.
+
+The transform does **not** merge closure triples into its output, so the JSON-LD stays a faithful
+conversion. The sync step lists the closures it used and warns about any that match no example.
+
+Only put facts about **related resources** in a closure: things the example refers to that are
+described elsewhere, such as the type of a referenced property, or a feature of interest held by
+a collection outside the example. Never use a closure to supply the example's own missing
+mandatory fields (`resultTime`, `hasFeatureOfInterest`, `observedProperty`, a result). That hides
+a real gap between the SOSA example and the OMS-strict target. Report the gap instead.
+
 ## Run it
 
 ```bash
diff --git a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
index 2a4a72bb..d122346a 100644
--- a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
+++ b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
@@ -11,6 +11,9 @@
   /examples.yaml            the group's examples (by URL ref into the spec)
   /transforms.yaml          ttl-to-jsonld transform, output profile = target bblock
   /description.md
+  closures/.ttl              (hand-written, optional) SHACL closure for one example: added
+                                   as the snippet's shacl-closure; .ttl applies to every
+                                   root of a multi-root example
 
 Generated files are overwritten; group directories no longer in the plan are reported,
 not deleted.
@@ -31,6 +34,7 @@
 SKILL_DIR = Path(__file__).resolve().parents[1]
 TRANSFORM_ASSET = SKILL_DIR / 'assets' / 'ttl_to_sosa_json.py'
 TRANSFORM_FILE = 'transforms/ttl_to_sosa_json.py'
+CLOSURES_DIR = 'closures'
 GENERATED_NOTE = 'Generated by the spec-examples-jsonld skill (sync_spec_example_blocks.py); edit the plan, not this file.'
 
 # extra typed-literal coercions for the transform's local context (none needed since
@@ -64,8 +68,18 @@ def lang(url: str) -> str:
     return 'ttl' if url.endswith('.ttl') else 'jsonld'
 
 
-def example_entries(entry: dict, siblings: dict[str, dict]) -> list[dict]:
-    """examples.yaml entries for one classified example (one per root if several)."""
+def closure_ref(closures: Path, rel: str, *names: str) -> str | None:
+    """Snippet shacl-closure path (relative to the block) for the first existing closures/.ttl."""
+    for n in names:
+        if (closures / f'{n}.ttl').is_file():
+            return f'{rel}{CLOSURES_DIR}/{n}.ttl'
+    return None
+
+
+def example_entries(entry: dict, siblings: dict[str, dict], closures: Path, rel: str) -> list[dict]:
+    """examples.yaml entries for one classified example (one per root if several).
+
+    rel is the path from the block directory to _sources/spec-examples/ ('' or '../')."""
     url, name = entry['url'], stem(entry['url'])
     snippets = [{'language': lang(url), 'ref': url}]
     if (sib := siblings.get(name)) is not None:
@@ -88,7 +102,11 @@ def example_entries(entry: dict, siblings: dict[str, dict]) -> list[dict]:
         e['base-output-filename'] = base if i == 0 else f"{base}--{local_name(root)}"
         if len(roots) > 1:
             e['x-root'] = root
-        e['snippets'] = snippets
+        e['snippets'] = [dict(sn) for sn in snippets]
+        if closure := closure_ref(closures, rel, e['base-output-filename'], base):
+            # validates the Turtle example and (postprocessor passes snippet closures on) the
+            # transform output; the transform itself does not merge it into its output
+            e['snippets'][0]['shacl-closure'] = [closure]
         out.append(e)
     return out
 
@@ -150,10 +168,14 @@ def main() -> int:
         by_group.setdefault(e['group'], []).append(e)
 
     written: list[Path] = []
+    used_closures: set[str] = set()
     groups = plan['groups']
     order = list(groups)
     for group, entries in by_group.items():
-        yaml_examples = [x for e in entries for x in example_entries(e, siblings)]
+        rel = '' if group == 'other' else '../'
+        yaml_examples = [x for e in entries for x in example_entries(e, siblings, root / CLOSURES_DIR, rel)]
+        used_closures.update(c.rsplit('/', 1)[-1] for x in yaml_examples
+                             for c in x['snippets'][0].get('shacl-closure', []))
         if group == 'other':
             write(root / 'examples.yaml', dump_yaml({'prefixes': prefixes, 'examples': yaml_examples}),
                   args.dry_run, written)
@@ -210,6 +232,9 @@ def main() -> int:
              if d.is_dir() and (d / 'bblock.json').exists() and d.name not in by_group]
     for s in stale:
         print(f"NOTE: group block '{s}' is not in the plan any more - review and delete it manually")
+    for c in sorted((root / CLOSURES_DIR).glob('*.ttl')) if (root / CLOSURES_DIR).is_dir() else []:
+        print(('using closure ' if c.name in used_closures else 'WARNING: closure matches no example: ')
+              + str(c.relative_to(repo)).replace('\\', '/'))
     print(f"\n{sum(len(v) for v in by_group.values())} examples in {len(by_group)} groups: "
           + ', '.join(f"{g}={len(v)}" for g, v in by_group.items()))
     return 0

From 619efa34bb4549d190669afe75f0cf37e8f34621 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Mon, 19 Oct 2026 11:47:10 +1100
Subject: [PATCH 03/11] Ignore Python __pycache__ directories

Co-Authored-By: Claude Opus 5.5 
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index bb5dfc8a..6ce9857a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 build-local
 build-local-export
 .idea/
+__pycache__/

From 6e7575c1697ebbc0314a02dd2094290186ed61f8 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Tue, 20 Oct 2026 15:05:56 +1100
Subject: [PATCH 04/11] Map spec-example JSON-LD to target contexts and tighten
 SOSA schemas

- The Turtle-to-JSON transform's output context now references the target
  bblock's generated context, plus only the example's own prefixes and
  literal coercions, so featureType and other terms map to SOSA.
- XSD times become plain date-time strings; only complex times such as
  intervals stay as objects, via a time context scoped to phenomenonTime
  in sosa-ssn.jsonld.
- Execution schemas reject incomplete objects: feature of interest, time,
  observedProperty and exactly one result are required, date-times must
  match a pattern, references must be non-empty, and featureType is
  checked. Collections validate embedded members against a member variant.
- Adds observation tests for the stricter rules.

Co-Authored-By: Claude Opus 5.5 
---
 .claude/skills/spec-examples-jsonld/SKILL.md  |  33 ++-
 .../assets/ttl_to_sosa_json.py                | 212 +++++++++++++++---
 .../scripts/sync_spec_example_blocks.py       |  12 +-
 _sources/features/actuation/schema.yaml       |  19 +-
 .../actuationCollection/examples.yaml         |   2 +
 .../features/actuationCollection/schema.yaml  |   2 +-
 _sources/features/observation/schema.yaml     |  12 +-
 .../observationCollection/schema.yaml         |   2 +-
 _sources/features/sampling/schema.yaml        |  19 +-
 .../features/samplingCollection/schema.yaml   |   2 +-
 _sources/properties/actuation/schema.yaml     |  39 +++-
 .../actuationCollection/examples.yaml         |   2 +
 _sources/properties/execution/schema.yaml     | 136 +++++++++--
 .../properties/observation-owa/schema.yaml    |   8 +-
 _sources/properties/observation/schema.yaml   |  33 ++-
 .../observation/tests/foi-empty-fail.json     |   6 +
 .../observation/tests/foi-missing-fail.json   |   5 +
 .../phenomenon-interval-unmapped-fail.json    |   6 +
 .../tests/phenomenon-time-instant.json        |   7 +
 .../tests/result-time-not-datetime-fail.json  |   6 +
 .../tests/times-phenomenon-interval.json      |  28 +++
 .../tests/times-phenomenon-interval.jsonld    |  34 ---
 .../observation/tests/wrong-type-fail.json    |   7 +
 _sources/properties/sampling/schema.yaml      |  33 ++-
 _sources/spec-examples/actuations/bblock.json |   2 +-
 .../spec-examples/actuations/transforms.yaml  |   4 +-
 _sources/spec-examples/bblock.json            |   2 +-
 .../spec-examples/deployments/bblock.json     |   2 +-
 .../spec-examples/deployments/transforms.yaml |   4 +-
 .../observation-collections/bblock.json       |   2 +-
 .../observation-collections/transforms.yaml   |   4 +-
 .../spec-examples/observations/bblock.json    |   2 +-
 .../observations/transforms.yaml              |   4 +-
 _sources/spec-examples/platforms/bblock.json  |   2 +-
 .../spec-examples/platforms/transforms.yaml   |   4 +-
 .../sample-collections/bblock.json            |   2 +-
 .../sample-collections/transforms.yaml        |   4 +-
 _sources/spec-examples/samples/bblock.json    |   2 +-
 .../spec-examples/samples/transforms.yaml     |   4 +-
 _sources/spec-examples/samplings/bblock.json  |   2 +-
 .../spec-examples/samplings/transforms.yaml   |   4 +-
 _sources/spec-examples/systems/bblock.json    |   2 +-
 .../spec-examples/systems/transforms.yaml     |   4 +-
 .../transforms/ttl_to_sosa_json.py            | 212 +++++++++++++++---
 sosa-ssn.jsonld                               |  36 ++-
 45 files changed, 777 insertions(+), 192 deletions(-)
 create mode 100644 _sources/properties/observation/tests/foi-empty-fail.json
 create mode 100644 _sources/properties/observation/tests/foi-missing-fail.json
 create mode 100644 _sources/properties/observation/tests/phenomenon-interval-unmapped-fail.json
 create mode 100644 _sources/properties/observation/tests/phenomenon-time-instant.json
 create mode 100644 _sources/properties/observation/tests/result-time-not-datetime-fail.json
 create mode 100644 _sources/properties/observation/tests/times-phenomenon-interval.json
 delete mode 100644 _sources/properties/observation/tests/times-phenomenon-interval.jsonld
 create mode 100644 _sources/properties/observation/tests/wrong-type-fail.json

diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
index db2ee324..0a4d9a5e 100644
--- a/.claude/skills/spec-examples-jsonld/SKILL.md
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -6,11 +6,14 @@ description: Build and install the Turtle-to-JSON-LD transform for the SOSA spec
 # Spec examples → JSON-LD against the SOSA bblocks
 
 The SOSA/SSN spec examples are Turtle. This skill converts each one into JSON that follows the
-schema of the matching SOSA bblock (e.g. `ogc.sosa.properties.observation`). The output carries
-an `@context` that holds only the prefixes it needs. Output profile validation then checks it
-against that bblock: JSON Schema, then JSON-LD uplift with the target's context, then SHACL. The
-uplifted `.jsonld` written by the validator is the canonical JSON-LD. Its `@context` is
-`[, {prefixes}]`.
+schema of the matching SOSA bblock (e.g. `ogc.sosa.properties.observation`). The output is
+self-describing JSON-LD: its `@context` is `[, {local}]`. The target's
+published context maps the schema terms (`featureType: Observation` → `sosa:Observation`, …).
+`{local}` holds only what that context does not define: the example's own prefixes and typed
+literal coercions for its non-SOSA properties. It never redefines a target term. Output profile
+validation then checks the output against the target: JSON Schema, then JSON-LD uplift, then
+SHACL. During uplift the postprocessor inlines the target context from the local build instead of
+fetching the URL; this needs a postprocessor with the "own context reference" fix.
 
 Run `spec-examples-check` first to see what is missing.
 
@@ -58,12 +61,20 @@ If an example has several roots, the sync step writes one example per root, each
 ## Transform behaviour (transforms.yaml `metadata`)
 
 - `rootClasses` / `containerClasses`: root selection, the same rule as the classifier.
-- Frames the root (`@embed: @once`), compacts it with the block's own assembled context (from
-  `jsonld_context_path`, which is the target's context because of the schema `$ref`), then drops
-  that context.
-- `coerce`: optional typed-literal coercions added to the local `@context`, for terms a target
-  schema constrains to plain strings but its context doesn't coerce. None are needed now:
-  `sosa-ssn.jsonld` coerces `resultTime`, `startTime` and `endTime` to `xsd:dateTime`.
+- `target`: the target bblock id. The transform compacts with that block's assembled context
+  (falling back to its own, which is the same because of the schema `$ref`) and references it by
+  URL: the build's base URL plus the target's annotated `context.jsonld` path.
+- Frames the root (`@embed: @once`) and compacts it.
+- Times become plain strings:
+  - `xsd:dateTimeStamp` values of SOSA time properties are retyped to `xsd:dateTime`;
+  - a `phenomenonTime` blank-node `time:Instant` with a single `inXSDDateTime` or
+    `inXSDDateTimeStamp` becomes an `xsd:dateTime` string.
+  An Interval or any other temporal entity stays an object, using the time terms scoped to
+  `phenomenonTime` in `sosa-ssn.jsonld` (`hasBeginning`, `hasEnd`, `inXSDDateTime`, …).
+- Other typed literals: a non-SOSA property whose values all share one datatype gets a local
+  coercion (e.g. `"qudt:value": {"@type": "xsd:decimal"}`), so its values are plain strings.
+  Integers, doubles and booleans are native JSON. Any value object that remains uses `@type`,
+  not the `featureType` alias.
 - `suppressTerms`: context terms to avoid. Default: `features`, the GeoJSON alias of
   `sosa:hasMember`, so the schema's `hasMember` is used.
 - Blank-node roots are skolemised just long enough to frame them, then the `id` is removed.
diff --git a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
index 5bae93b9..d94456da 100644
--- a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
+++ b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
@@ -4,28 +4,35 @@
 # _sources/spec-examples// block; runs inside bblocks-postprocess (rdflib + pyld).
 #
 # metadata (transforms.yaml):
+#   target: bblock id         the output profile; its published JSON-LD context is referenced
+#                             by the output's @context
 #   rootClasses: [IRI, ...]   classes whose instances become the root object
 #   containerClasses: [IRI]   classes whose SOSA links embed a root candidate (default rootClasses)
-#   coerce: {term: datatype}  typed-literal coercions added to the output's local @context, for
-#                             terms the target schema constrains to plain strings (e.g. resultTime
-#                             with format: date-time) but the target context does not coerce
-#   suppressTerms: [term]     context terms not to use when compacting (e.g. the GeoJSON alias
-#                             'features' for sosa:hasMember, so the schema's 'hasMember' is used)
+#   suppressTerms: [term]     target context terms not to use when compacting (e.g. the GeoJSON
+#                             alias 'features' for sosa:hasMember, so the schema's 'hasMember' is used)
 # per example (examples.yaml):
 #   x-root: IRI               pick this resource as the root (multi-root examples)
 #
-# Output: the root resource framed and compacted with the block's own JSON-LD context
-# (which is the target bblock's context, inherited via schema.yaml $ref), with that
-# context removed and replaced by a prefix-only @context for any non-SOSA terms. Output
-# profile validation re-applies the target block's context, so the JSON Schema, JSON-LD
-# context and SHACL shapes of the target are all exercised.
+# Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
+#   "@context": [, {}]
+# The local part holds the example's own prefixes and typed-literal coercions for its non-SOSA
+# properties; it never redefines a target term. Times are plain xsd:dateTime strings: a
+# phenomenonTime time:Instant with a single date-time position becomes a string, anything more
+# complex (e.g. a time:Interval) stays an object using the target's time terms.
 import json
+import re
 from pathlib import Path
+from urllib.parse import urljoin
 
 from pyld import jsonld
-from rdflib import BNode, Graph, RDF, URIRef
+from rdflib import BNode, Graph, Literal, Namespace, RDF, URIRef
 
 SOSA_SSN = ('http://www.w3.org/ns/sosa/', 'http://www.w3.org/ns/ssn/')
+SOSA = Namespace('http://www.w3.org/ns/sosa/')
+TIME = Namespace('http://www.w3.org/2006/time#')
+XSD = Namespace('http://www.w3.org/2001/XMLSchema#')
+TZ = re.compile(r'(Z|[+-]\d{2}:\d{2})$')
+PLAIN = (None, XSD.string, URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'))
 
 
 def _get(obj, key, default=None):
@@ -38,20 +45,58 @@ def _get(obj, key, default=None):
 
 meta = transform_metadata.metadata
 tctx = transform_metadata.context
+working_dir = Path(_get(tctx, 'working_dir') or '.')
 root_classes = [URIRef(c) for c in _get(meta, 'rootClasses', [])]
 container_classes = [URIRef(c) for c in (_get(meta, 'containerClasses') or [])] or root_classes
 example = _get(tctx, 'example') or {}
 wanted_root = _get(example, 'x-root')
 
-# --- block JSON-LD context (assembled by the postprocessor for this block) ---------------
-ctx_path = None
-if _get(tctx, 'jsonld_context_path'):
-    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(tctx, 'jsonld_context_path')
-if (ctx_path is None or not ctx_path.is_file()) and _get(meta, 'context'):
-    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(meta, 'context')
-if ctx_path is None or not ctx_path.is_file():
-    raise FileNotFoundError(f'JSON-LD context for this block not found ({ctx_path})')
-block_context = json.loads(ctx_path.read_text(encoding='utf-8'))['@context']
+# --- target JSON-LD context: local file (to compact with) and published URL (to reference) --
+own_ctx = _get(tctx, 'jsonld_context_path')
+if not own_ctx or not (working_dir / own_ctx).is_file():
+    raise FileNotFoundError(f'JSON-LD context for this block not found ({own_ctx})')
+target = _get(meta, 'target')
+target_ctx = own_ctx  # the block $refs the target schema, so its context is the target's
+if target:
+    # annotated///context.jsonld -> ...//...
+    id_prefix = _get(tctx, 'id_prefix') or ''
+    own_parts = _get(tctx, 'bblock_id')[len(id_prefix):].split('.')
+    target_parts = target[len(id_prefix):].split('.') if target.startswith(id_prefix) else None
+    ctx_parts = Path(own_ctx).parts
+    if target_parts and tuple(ctx_parts[-1 - len(own_parts):-1]) == tuple(own_parts):
+        candidate = Path(*ctx_parts[:-1 - len(own_parts)], *target_parts, ctx_parts[-1])
+        if (working_dir / candidate).is_file():
+            target_ctx = str(candidate.as_posix())
+target_context = json.loads((working_dir / target_ctx).read_text(encoding='utf-8'))['@context']
+base_url = _get(tctx, 'base_url')
+target_ctx_ref = urljoin(base_url, Path(target_ctx).as_posix()) if base_url else Path(target_ctx).as_posix()
+
+
+def _context_iris(ctx, prefixes=None):
+    """IRIs of all terms defined in a context, including property-scoped ones."""
+    if isinstance(ctx, list):
+        return set().union(*[_context_iris(c, prefixes) for c in ctx]) if ctx else set()
+    if not isinstance(ctx, dict):
+        return set()
+    prefixes = dict(prefixes or {})
+    prefixes.update({k: v for k, v in ctx.items() if isinstance(v, str) and v.endswith(('/', '#'))})
+
+    def expand(v):
+        if isinstance(v, str) and ':' in v and v.split(':', 1)[0] in prefixes:
+            return prefixes[v.split(':', 1)[0]] + v.split(':', 1)[1]
+        return v
+    iris = set()
+    for k, v in ctx.items():
+        if k.startswith('@'):
+            continue
+        iris.add(expand(v.get('@id', k) if isinstance(v, dict) else v))
+        if isinstance(v, dict) and '@context' in v:
+            iris |= _context_iris(v['@context'], prefixes)
+    return iris
+
+
+target_terms = set(target_context) if isinstance(target_context, dict) else set()
+target_iris = _context_iris(target_context)
 
 # --- parse --------------------------------------------------------------------------------
 src = transform_metadata.source_mime_type or 'text/turtle'
@@ -64,16 +109,67 @@ def _get(obj, key, default=None):
             if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
 for p, ns in (_get(meta, '_prefixes') or {}).items():
     prefixes.setdefault(p, ns)
+# never redefine a target term
+prefixes = {p: ns for p, ns in prefixes.items() if p not in target_terms}
+
+
+# --- times: plain xsd:dateTime strings where the value is a single date-time ----------------
+def _retype(p, wanted, accept):
+    for s, o in list(g.subject_objects(p)):
+        if isinstance(o, Literal) and o.datatype in accept and o.datatype != wanted:
+            if wanted == XSD.dateTimeStamp and not TZ.search(str(o)):
+                continue
+            g.remove((s, p, o))
+            g.add((s, p, Literal(str(o), datatype=wanted)))
+
+
+DATETIMES = (XSD.dateTime, XSD.dateTimeStamp)
+for p in (SOSA.resultTime, SOSA.phenomenonTime, SOSA.startTime, SOSA.endTime, TIME.inXSDDateTime):
+    _retype(p, XSD.dateTime, DATETIMES)
+_retype(TIME.inXSDDateTimeStamp, XSD.dateTimeStamp, DATETIMES)
+
+for s, inst in list(g.subject_objects(SOSA.phenomenonTime)):
+    if not isinstance(inst, BNode) or len(list(g.subject_predicates(inst))) != 1:
+        continue
+    po = list(g.predicate_objects(inst))
+    types = {o for p, o in po if p == RDF.type}
+    values = [(p, o) for p, o in po if p != RDF.type]
+    if (types <= {TIME.Instant} and len(values) == 1
+            and values[0][0] in (TIME.inXSDDateTime, TIME.inXSDDateTimeStamp)
+            and isinstance(values[0][1], Literal) and values[0][1].datatype in DATETIMES):
+        g.remove((inst, None, None))
+        g.remove((s, SOSA.phenomenonTime, inst))
+        g.add((s, SOSA.phenomenonTime, Literal(str(values[0][1]), datatype=XSD.dateTime)))
+
+# --- typed literals of the example's own properties: coerce in the local context -----------
+# (integers, doubles and booleans are serialized as native JSON values and need none)
+NATIVE = (XSD.integer, XSD.double, XSD.boolean)
+coercions = {}
+for p in set(g.predicates()):
+    if str(p) in target_iris or str(p).startswith(SOSA_SSN):
+        continue
+    dts = {o.datatype if isinstance(o, Literal) else 'node' for o in g.objects(None, p)}
+    if len(dts) == 1 and (dt := dts.pop()) not in PLAIN + NATIVE and dt != 'node':
+        coercions[p] = dt
+
+
+def _curie(iri):
+    for pfx, ns in sorted(prefixes.items(), key=lambda kv: -len(kv[1])):
+        if iri.startswith(ns) and re.fullmatch(r'[A-Za-z_][\w.-]*', iri[len(ns):] or '-'):
+            return f'{pfx}:{iri[len(ns):]}'
+    return None
+
+
 local_context = dict(prefixes)
-for term, datatype in (_get(meta, 'coerce') or {}).items():
-    term_def = block_context.get(term) if isinstance(block_context, dict) else None
-    term_id = term_def.get('@id') if isinstance(term_def, dict) else term_def
-    if term_id:
-        local_context[term] = {'@id': term_id, '@type': datatype}
-        prefixes.setdefault('xsd', 'http://www.w3.org/2001/XMLSchema#')
-        local_context.setdefault('xsd', prefixes['xsd'])
+for p, dt in coercions.items():
+    term = _curie(str(p))
+    if term and term not in target_terms:
+        dt = str(dt)
+        local_context[term] = {'@type': 'xsd:' + dt[len(str(XSD)):] if dt.startswith(str(XSD))
+                               and 'xsd' not in target_terms else _curie(dt) or dt}
 
 
+# --- root selection -----------------------------------------------------------------------
 def _instances(classes):
     return {s for c in classes for s in g.subjects(RDF.type, c)}
 
@@ -110,9 +206,17 @@ def _roots():
     root = skolem
 
 # --- frame + compact ----------------------------------------------------------------------
-expanded = json.loads(g.serialize(format='json-ld'))
+expanded = json.loads(g.serialize(format='json-ld', use_native_types=True))
+# A term coercing to a datatype (e.g. phenomenonTime -> xsd:dateTime) is not selected for an
+# object value (e.g. a time:Interval), so compact with those coercions removed and turn the
+# matching value objects back into plain strings afterwards (_plain): same JSON, same RDF.
+coerced = {t: d['@type'] for t, d in target_context.items()
+           if isinstance(d, dict) and d.get('@type') not in (None, '@id', '@vocab', '@json')} \
+    if isinstance(target_context, dict) else {}
+compact_target = {t: ({k: v for k, v in d.items() if k != '@type'} if t in coerced else d)
+                  for t, d in target_context.items()} if coerced else target_context
 frame_context = dict(local_context, **{t: None for t in (_get(meta, 'suppressTerms') or [])})
-context = [block_context, frame_context] if frame_context else block_context
+context = [compact_target, frame_context] if frame_context else compact_target
 framed = jsonld.frame(expanded, {'@context': context, '@id': str(root)},
                       {'embed': '@once', 'omitGraph': True})
 framed.pop('@context', None)
@@ -122,6 +226,44 @@ def _roots():
     framed.pop('id')
 
 
+def _tidy(node):
+    """Value objects keep the @type keyword rather than the 'featureType' alias of the target."""
+    if isinstance(node, list):
+        return [_tidy(v) for v in node]
+    if not isinstance(node, dict):
+        return node
+    node = {k: _tidy(v) for k, v in node.items()}
+    if '@value' in node:
+        node = {('@type' if k in ('featureType', 'type') else k): v for k, v in node.items()}
+    return node
+
+
+def _expand_type(t):
+    if isinstance(t, str) and ':' in t and t.split(':', 1)[0] in local_context:
+        return local_context[t.split(':', 1)[0]] + t.split(':', 1)[1]
+    return t
+
+
+def _plain(node):
+    """Values of datatype-coerced target terms as plain strings (see compact_target)."""
+    if isinstance(node, list):
+        return [_plain(v) for v in node]
+    if not isinstance(node, dict):
+        return node
+    out = {}
+    for k, v in node.items():
+        if k in coerced:
+            vs = [{'@value': x['@value']} if isinstance(x, dict) and set(x) == {'@value', '@type'}
+                  and _expand_type(x['@type']) == coerced[k] else x for x in (v if isinstance(v, list) else [v])]
+            vs = [x['@value'] if isinstance(x, dict) and set(x) == {'@value'} else _plain(x) for x in vs]
+            out[k] = vs if isinstance(v, list) else vs[0]
+        else:
+            out[k] = _plain(v)
+    return out
+
+
+framed = _plain(_tidy(framed))
+
 
 def _usage(node, prefixes_used, keys_used):
     if isinstance(node, dict):
@@ -139,7 +281,13 @@ def _usage(node, prefixes_used, keys_used):
 _usage(framed, used_prefixes, used_keys)
 local_context = {k: v for k, v in local_context.items()
                  if (k in used_prefixes if isinstance(v, str) else k in used_keys)}
-if any(not isinstance(v, str) for v in local_context.values()):
-    local_context['xsd'] = 'http://www.w3.org/2001/XMLSchema#'
-out = {'@context': local_context, **framed} if local_context else framed
+for k, v in list(local_context.items()):
+    if isinstance(v, dict):  # a used coercion needs its own prefixes
+        for c in (k, v['@type']):
+            pfx = c.split(':', 1)[0] if ':' in c else None
+            if pfx in prefixes:
+                local_context.setdefault(pfx, prefixes[pfx])
+            elif pfx == 'xsd':
+                local_context.setdefault('xsd', str(XSD))
+out = {'@context': [target_ctx_ref, local_context] if local_context else target_ctx_ref, **framed}
 output_data = json.dumps(out, indent=2, ensure_ascii=False)
diff --git a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
index d122346a..ee84dde8 100644
--- a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
+++ b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
@@ -37,9 +37,6 @@
 CLOSURES_DIR = 'closures'
 GENERATED_NOTE = 'Generated by the spec-examples-jsonld skill (sync_spec_example_blocks.py); edit the plan, not this file.'
 
-# extra typed-literal coercions for the transform's local context (none needed since
-# sosa-ssn.jsonld coerces resultTime/startTime/endTime to xsd:dateTime)
-COERCE: dict[str, str] = {}
 # GeoJSON alias of sosa:hasMember in sosa-ssn.jsonld; properties schemas use 'hasMember'
 SUPPRESS = ['features']
 
@@ -195,15 +192,16 @@ def main() -> int:
         write(d / 'transforms.yaml', dump_yaml({'transforms': [{
             'id': 'ttl-to-jsonld',
             'description': (f"Frames the root resource ({', '.join(c.rsplit('/', 1)[-1] for c in groups[group]['rootClasses'])}) of a SOSA Turtle "
-                            f"example and compacts it with the `{target}` JSON-LD context. The output is "
-                            f"validated against `{target}`."),
+                            f"example and compacts it with the `{target}` JSON-LD context, which the output's "
+                            f"`@context` references (plus only the example's own prefixes and literal types). "
+                            f"The output is validated against `{target}`."),
             'type': 'python',
             'ref': f'../{TRANSFORM_FILE}',
             'inputs': {'mediaTypes': ['text/turtle']},
             'outputs': {'mediaTypes': [{'mimeType': 'application/json', 'defaultExtension': 'json'}],
                         'profiles': [f'bblocks://{target}']},
-            'metadata': {'rootClasses': groups[group]['rootClasses'], 'containerClasses': container,
-                         **({'coerce': COERCE} if COERCE else {}), 'suppressTerms': SUPPRESS},
+            'metadata': {'target': target, 'rootClasses': groups[group]['rootClasses'],
+                         'containerClasses': container, 'suppressTerms': SUPPRESS},
         }]}), args.dry_run, written)
         write(d / 'description.md', (
             f"## SOSA specification examples: {GROUP_TITLES.get(group, group)}\n\n"
diff --git a/_sources/features/actuation/schema.yaml b/_sources/features/actuation/schema.yaml
index a1f0c379..ba29b486 100644
--- a/_sources/features/actuation/schema.yaml
+++ b/_sources/features/actuation/schema.yaml
@@ -1,9 +1,26 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Actuation Feature'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  member:
+    description: A Actuation Feature in a collection (mandatory properties may be provided by the collection)
+    allOf:
+      - $ref: bblocks://ogc.sosa.features.execution
+      - type: object
+        properties:
+          featureType:
+            oneOf:
+              - $ref: ../../properties/actuation/schema.yaml#/$defs/actuationType
+              - type: array
+                contains:
+                  $ref: ../../properties/actuation/schema.yaml#/$defs/actuationType
+      - type: object
+        properties:
+          properties:
+            $ref: ../../properties/actuation/schema.yaml#/$defs/member
 type: object
 allOf:
-  - $ref: bblocks://ogc.sosa.features.execution
+  - $ref: '#/$defs/member'
   - type: object
     properties:
       properties:
diff --git a/_sources/features/actuationCollection/examples.yaml b/_sources/features/actuationCollection/examples.yaml
index 9970b882..1c819e8d 100644
--- a/_sources/features/actuationCollection/examples.yaml
+++ b/_sources/features/actuationCollection/examples.yaml
@@ -17,6 +17,7 @@
               "type": "Feature",
               "geometry": null,
               "properties": {
+                "hasFeatureOfInterest": "window98",
                 "actsOnProperty": "window98/openState",
                 "hasSimpleResult": true,
                 "startTime": "2017-04-18T17:23:00+02:00",
@@ -28,6 +29,7 @@
               "type": "Feature",
               "geometry": null,
               "properties": {
+                "hasFeatureOfInterest": "window99",
                 "actsOnProperty": "window99/openState",
                 "hasSimpleResult": false,
                 "startTime": "2017-04-18T17:25:00+02:00",
diff --git a/_sources/features/actuationCollection/schema.yaml b/_sources/features/actuationCollection/schema.yaml
index 3c134ef3..e687c181 100644
--- a/_sources/features/actuationCollection/schema.yaml
+++ b/_sources/features/actuationCollection/schema.yaml
@@ -14,7 +14,7 @@ allOf:
         items:
           oneOf:
             # Embedded Actuations
-            - $ref: ../actuation/schema.yaml
+            - $ref: ../actuation/schema.yaml#/$defs/member
             # Embedded nested ActuationCollection. A FeatureCollection cannot itself be a `features`
             # member, so a nested collection is still a plain Feature - further nesting
             # continues via `properties.hasMember`.
diff --git a/_sources/features/observation/schema.yaml b/_sources/features/observation/schema.yaml
index 407a29bf..1f23346a 100644
--- a/_sources/features/observation/schema.yaml
+++ b/_sources/features/observation/schema.yaml
@@ -1,9 +1,19 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Observation Feature'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  member:
+    description: A Observation Feature in a collection (mandatory properties may be provided by the collection)
+    allOf:
+      - $ref: bblocks://ogc.sosa.features.execution
+      - $ref: ../../properties/observation/schema.yaml#/$defs/featureType
+      - type: object
+        properties:
+          properties:
+            $ref: ../../properties/observation/schema.yaml#/$defs/member
 type: object
 allOf:
-  - $ref: bblocks://ogc.sosa.features.execution
+  - $ref: '#/$defs/member'
   - type: object
     properties:
       properties:
diff --git a/_sources/features/observationCollection/schema.yaml b/_sources/features/observationCollection/schema.yaml
index f9f64e49..44e24a30 100644
--- a/_sources/features/observationCollection/schema.yaml
+++ b/_sources/features/observationCollection/schema.yaml
@@ -13,7 +13,7 @@ allOf:
         items:
           oneOf:
             # Embedded observations
-            - $ref: ../observation/schema.yaml
+            - $ref: ../observation/schema.yaml#/$defs/member
             # Embedded nested ObservationCollection. A FeatureCollection cannot itself
             # be a `features` member (json-fg.featureCollection-lenient constrains
             # `features` to Features only), so a nested collection is still a plain
diff --git a/_sources/features/sampling/schema.yaml b/_sources/features/sampling/schema.yaml
index e0b21f74..dbfe3b71 100644
--- a/_sources/features/sampling/schema.yaml
+++ b/_sources/features/sampling/schema.yaml
@@ -1,9 +1,26 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Sampling Feature'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  member:
+    description: A Sampling Feature in a collection (mandatory properties may be provided by the collection)
+    allOf:
+      - $ref: bblocks://ogc.sosa.features.execution
+      - type: object
+        properties:
+          featureType:
+            oneOf:
+              - $ref: ../../properties/sampling/schema.yaml#/$defs/samplingType
+              - type: array
+                contains:
+                  $ref: ../../properties/sampling/schema.yaml#/$defs/samplingType
+      - type: object
+        properties:
+          properties:
+            $ref: ../../properties/sampling/schema.yaml#/$defs/member
 type: object
 allOf:
-  - $ref: bblocks://ogc.sosa.features.execution
+  - $ref: '#/$defs/member'
   - type: object
     properties:
       properties:
diff --git a/_sources/features/samplingCollection/schema.yaml b/_sources/features/samplingCollection/schema.yaml
index eb4b337f..fad7ed51 100644
--- a/_sources/features/samplingCollection/schema.yaml
+++ b/_sources/features/samplingCollection/schema.yaml
@@ -14,7 +14,7 @@ allOf:
         items:
           oneOf:
             # Embedded Samplings
-            - $ref: ../sampling/schema.yaml
+            - $ref: ../sampling/schema.yaml#/$defs/member
             # Embedded nested SamplingCollection. A FeatureCollection cannot itself be a `features`
             # member, so a nested collection is still a plain Feature - further nesting
             # continues via `properties.hasMember`.
diff --git a/_sources/properties/actuation/schema.yaml b/_sources/properties/actuation/schema.yaml
index 11e4c4ce..373b0533 100644
--- a/_sources/properties/actuation/schema.yaml
+++ b/_sources/properties/actuation/schema.yaml
@@ -1,15 +1,32 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Actuation'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  actuationType:
+    enum:
+      - Actuation
+      - sosa:Actuation
+      - http://www.w3.org/ns/sosa/Actuation
+  member:
+    description: >-
+      An Actuation in an ActuationCollection: feature of interest and time may be provided by the
+      collection (checked by SHACL), the result may not.
+    allOf:
+      - $ref: bblocks://ogc.sosa.properties.execution
+      - type: object
+        properties:
+          featureType:
+            oneOf:
+              - $ref: '#/$defs/actuationType'
+              - type: array
+                contains:
+                  $ref: '#/$defs/actuationType'
+          actsOnProperty:
+            $ref: '../execution/schema.yaml#/$defs/reference'
+          madeByActuator:
+            $ref: '../execution/schema.yaml#/$defs/reference'
+      - $ref: '../execution/schema.yaml#/$defs/result'
+type: object
 allOf:
-  - $ref: bblocks://ogc.sosa.properties.execution
-  - type: object
-    properties:
-      actsOnProperty:
-        type:
-          - object
-          - string
-      madeByActuator:
-        type:
-          - object
-          - string
+  - $ref: '#/$defs/member'
+  - $ref: '../execution/schema.yaml#/$defs/required'
diff --git a/_sources/properties/actuationCollection/examples.yaml b/_sources/properties/actuationCollection/examples.yaml
index c55c23c3..f2791636 100644
--- a/_sources/properties/actuationCollection/examples.yaml
+++ b/_sources/properties/actuationCollection/examples.yaml
@@ -13,6 +13,7 @@
           "hasMember": [
             {
               "@id": "A188",
+              "hasFeatureOfInterest": "window98",
               "actsOnProperty": "window98/openState",
               "hasSimpleResult": true,
               "startTime": "2017-04-18T17:23:00+02:00",
@@ -20,6 +21,7 @@
             },
             {
               "@id": "A189",
+              "hasFeatureOfInterest": "window99",
               "actsOnProperty": "window99/openState",
               "hasSimpleResult": false,
               "startTime": "2017-04-18T17:25:00+02:00",
diff --git a/_sources/properties/execution/schema.yaml b/_sources/properties/execution/schema.yaml
index 4b96d076..ece7e0bf 100644
--- a/_sources/properties/execution/schema.yaml
+++ b/_sources/properties/execution/schema.yaml
@@ -1,35 +1,131 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Execution'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  # `format` is an annotation only (not asserted by the validator), so lexical forms are
+  # enforced with `pattern`.
+  dateTime:
+    description: xsd:dateTime lexical form (time zone optional)
+    type: string
+    format: date-time
+    pattern: '^-?[0-9]{4,}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})?$'
+  dateTimeStamp:
+    description: xsd:dateTimeStamp lexical form (time zone required)
+    type: string
+    format: date-time
+    pattern: '^-?[0-9]{4,}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$'
+  date:
+    description: xsd:date lexical form
+    type: string
+    pattern: '^-?[0-9]{4,}-[0-9]{2}-[0-9]{2}(Z|[+-][0-9]{2}:[0-9]{2})?$'
+  reference:
+    description: An IRI or CURIE, or an embedded (non-empty) object
+    oneOf:
+      - type: string
+        minLength: 1
+      - type: object
+        minProperties: 1
+  instant:
+    description: time:Instant with at least one position
+    type: object
+    properties:
+      inXSDDateTime:
+        $ref: '#/$defs/dateTime'
+      inXSDDateTimeStamp:
+        $ref: '#/$defs/dateTimeStamp'
+      inXSDDate:
+        $ref: '#/$defs/date'
+    anyOf:
+      - required: [inXSDDateTime]
+      - required: [inXSDDateTimeStamp]
+      - required: [inXSDDate]
+      - required: [inXSDgYear]
+      - required: [inXSDgYearMonth]
+      - required: [inTimePosition]
+      - required: [id]
+  temporalEntity:
+    description: >-
+      Time as a simple xsd:dateTime string, or a time:TemporalEntity object (e.g. a time:Interval)
+      when it is not a single date-time.
+    oneOf:
+      - $ref: '#/$defs/dateTime'
+      - type: object
+        properties:
+          hasBeginning:
+            $ref: '#/$defs/instant'
+          hasEnd:
+            $ref: '#/$defs/instant'
+          inXSDDateTime:
+            $ref: '#/$defs/dateTime'
+          inXSDDateTimeStamp:
+            $ref: '#/$defs/dateTimeStamp'
+          inXSDDate:
+            $ref: '#/$defs/date'
+        anyOf:
+          - required: [hasBeginning]
+          - required: [hasEnd]
+          - required: [inXSDDateTime]
+          - required: [inXSDDateTimeStamp]
+          - required: [inXSDDate]
+          - required: [inXSDgYear]
+          - required: [inXSDgYearMonth]
+          - required: [inTimePosition]
+          - required: [id]
+  simpleResult:
+    description: sosa:hasSimpleResult is a literal (a JSON value, or a JSON-LD typed or language-tagged value)
+    oneOf:
+      - type:
+          - string
+          - number
+          - integer
+          - boolean
+      - type: object
+        required: ['@value']
+        properties:
+          '@value':
+            type: [string, number, integer, boolean]
+          '@type':
+            type: string
+          '@language':
+            type: string
+        additionalProperties: false
+  # an Execution's mandatory properties (feature of interest, time) - required of a stand-alone
+  # Observation/Actuation/Sampling, but may be provided by the collection of a collection member
+  required:
+    allOf:
+      - required:
+          - hasFeatureOfInterest
+      # as the SHACL time rule: any of resultTime, phenomenonTime, startTime, endTime
+      - anyOf:
+          - required: [resultTime]
+          - required: [phenomenonTime]
+          - required: [startTime]
+          - required: [endTime]
+  # exactly one result: required of every Observation/Actuation/Sampling, collection member or not
+  result:
+    oneOf:
+      - required: [hasResult]
+      - required: [hasSimpleResult]
 type: object
 properties:
   resultTime:
-    type: string
-    format: date-time
+    $ref: '#/$defs/dateTime'
   phenomenonTime:
-    type:
-      - object
-      - string
+    $ref: '#/$defs/temporalEntity'
   hasFeatureOfInterest:
-    type:
-      - object
-      - string
+    $ref: '#/$defs/reference'
   hasUltimateFeatureOfInterest:
-    type:
-      - object
-      - string
+    $ref: '#/$defs/reference'
   usedProcedure:
-    type:
-      - object
-      - string
+    $ref: '#/$defs/reference'
   startTime:
-    type: string
-    format: date-time
+    $ref: '#/$defs/dateTime'
   endTime:
-    type: string
-    format: date-time
-  hasResult: true
+    $ref: '#/$defs/dateTime'
+  hasResult:
+    $ref: '#/$defs/reference'
   result: true
   result@links: true
-  hasSimpleResult: true
+  hasSimpleResult:
+    $ref: '#/$defs/simpleResult'
   hasInputValue: true
diff --git a/_sources/properties/observation-owa/schema.yaml b/_sources/properties/observation-owa/schema.yaml
index b5316275..ff9c7e10 100644
--- a/_sources/properties/observation-owa/schema.yaml
+++ b/_sources/properties/observation-owa/schema.yaml
@@ -6,10 +6,6 @@ allOf:
   - type: object
     properties:
       observedProperty:
-        type:
-          - object
-          - string
+        $ref: '../execution/schema.yaml#/$defs/reference'
       madeBySensor:
-        type:
-          - object
-          - string
+        $ref: '../execution/schema.yaml#/$defs/reference'
diff --git a/_sources/properties/observation/schema.yaml b/_sources/properties/observation/schema.yaml
index 96761ff3..543986f1 100644
--- a/_sources/properties/observation/schema.yaml
+++ b/_sources/properties/observation/schema.yaml
@@ -1,11 +1,32 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Observation'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  featureType:
+    description: if typed, the object is a sosa:Observation
+    properties:
+      featureType:
+        oneOf:
+          - $ref: '#/$defs/observationType'
+          - type: array
+            contains:
+              $ref: '#/$defs/observationType'
+  observationType:
+    enum:
+      - Observation
+      - sosa:Observation
+      - http://www.w3.org/ns/sosa/Observation
+  member:
+    description: >-
+      An Observation in an ObservationCollection: feature of interest, observed property and time
+      may be provided by the collection (checked by SHACL), the result may not.
+    allOf:
+      - $ref: bblocks://ogc.sosa.properties.observation-owa
+      - $ref: '#/$defs/featureType'
+      - $ref: '../execution/schema.yaml#/$defs/result'
 type: object
 allOf:
- - $ref: bblocks://ogc.sosa.properties.observation-owa
- - anyOf:
-   - required:
-     - hasResult
-   - required:
-     - hasSimpleResult
+  - $ref: '#/$defs/member'
+  - $ref: '../execution/schema.yaml#/$defs/required'
+  - required:
+      - observedProperty
diff --git a/_sources/properties/observation/tests/foi-empty-fail.json b/_sources/properties/observation/tests/foi-empty-fail.json
new file mode 100644
index 00000000..d07b0366
--- /dev/null
+++ b/_sources/properties/observation/tests/foi-empty-fail.json
@@ -0,0 +1,6 @@
+{
+  "hasFeatureOfInterest": {},
+  "observedProperty": "something",
+  "resultTime": "2016-05-04T02:27:02.0Z",
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/observation/tests/foi-missing-fail.json b/_sources/properties/observation/tests/foi-missing-fail.json
new file mode 100644
index 00000000..d844479d
--- /dev/null
+++ b/_sources/properties/observation/tests/foi-missing-fail.json
@@ -0,0 +1,5 @@
+{
+  "observedProperty": "something",
+  "resultTime": "2016-05-04T02:27:02.0Z",
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/observation/tests/phenomenon-interval-unmapped-fail.json b/_sources/properties/observation/tests/phenomenon-interval-unmapped-fail.json
new file mode 100644
index 00000000..755a66b1
--- /dev/null
+++ b/_sources/properties/observation/tests/phenomenon-interval-unmapped-fail.json
@@ -0,0 +1,6 @@
+{
+  "hasFeatureOfInterest": "http://something.org/1",
+  "observedProperty": "something",
+  "phenomenonTime": { "start": "2016-05-04T02:27:02.0Z", "end": "2016-05-04T03:33:33.0Z" },
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/observation/tests/phenomenon-time-instant.json b/_sources/properties/observation/tests/phenomenon-time-instant.json
new file mode 100644
index 00000000..0ed2426e
--- /dev/null
+++ b/_sources/properties/observation/tests/phenomenon-time-instant.json
@@ -0,0 +1,7 @@
+{
+  "featureType": "Observation",
+  "hasFeatureOfInterest": "http://something.org/1",
+  "observedProperty": "something",
+  "phenomenonTime": "2016-05-04T02:27:02Z",
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/observation/tests/result-time-not-datetime-fail.json b/_sources/properties/observation/tests/result-time-not-datetime-fail.json
new file mode 100644
index 00000000..2620f830
--- /dev/null
+++ b/_sources/properties/observation/tests/result-time-not-datetime-fail.json
@@ -0,0 +1,6 @@
+{
+  "hasFeatureOfInterest": "http://something.org/1",
+  "observedProperty": "something",
+  "resultTime": "1999",
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/observation/tests/times-phenomenon-interval.json b/_sources/properties/observation/tests/times-phenomenon-interval.json
new file mode 100644
index 00000000..a9acb717
--- /dev/null
+++ b/_sources/properties/observation/tests/times-phenomenon-interval.json
@@ -0,0 +1,28 @@
+{
+  "hasFeatureOfInterest": {
+    "id": "http://something.org/1"
+  },
+  "observedProperty": "something",
+  "resultTime": "2016-05-04T02:27:02.0Z",
+  "phenomenonTime": {
+    "featureType": "Interval",
+    "hasBeginning": { "inXSDDateTimeStamp": "2016-05-04T02:27:02.0Z" },
+    "hasEnd": { "inXSDDateTimeStamp": "2016-05-04T03:33:33.0Z" }
+  },
+   "hasResult": {
+    "@context": {
+      "resultschema": "http//example.org/resultschema/",
+      "a": "resultschema:a",
+      "b": {
+        "@id": "resultschema:b",
+        "@context": {
+          "b1": "resultschema:b1",
+          "b2": "resultschema:b2"
+        }
+      }
+    },
+    "a": -8150858,
+    "b": false
+  },
+  "madeBySensor": "ea est culpa esse"
+}
\ No newline at end of file
diff --git a/_sources/properties/observation/tests/times-phenomenon-interval.jsonld b/_sources/properties/observation/tests/times-phenomenon-interval.jsonld
deleted file mode 100644
index d9eed9ef..00000000
--- a/_sources/properties/observation/tests/times-phenomenon-interval.jsonld
+++ /dev/null
@@ -1,34 +0,0 @@
-{
-  "@context": {
-    "hasResult": "http://www.w3.org/ns/sosa/hasResult",
-    "hasSimpleResult": "http://www.w3.org/ns/sosa/hasSimpleResult",
-    "resultTime": "http://www.w3.org/ns/sosa/resultTime",
-    "phenomenonTime": "http://www.w3.org/ns/sosa/phenomenonTime",
-    "hasFeatureOfInterest": "http://www.w3.org/ns/sosa/hasFeatureOfInterest",
-    "observedProperty": "http://www.w3.org/ns/sosa/observedProperty",
-    "usedProcedure": "http://www.w3.org/ns/sosa/usedProcedure",
-    "madeBySensor": "http://www.w3.org/ns/sosa/madeBySensor"
-  },
-  "hasFeatureOfInterest": {
-    "id": "http://something.org/1"
-  },
-  "observedProperty": "something",
-  "resultTime": "2016-05-04T02:27:02.0Z",
-  "phenomenonTime": { "start": "2016-05-04T02:27:02.0Z", "end": "2016-05-04T03:33:33.0Z" },
-   "hasResult": {
-    "@context": {
-      "resultschema": "http//example.org/resultschema/",
-      "a": "resultschema:a",
-      "b": {
-        "@id": "resultschema:b",
-        "@context": {
-          "b1": "resultschema:b1",
-          "b2": "resultschema:b2"
-        }
-      }
-    },
-    "a": -8150858,
-    "b": false
-  },
-  "madeBySensor": "ea est culpa esse"
-}
\ No newline at end of file
diff --git a/_sources/properties/observation/tests/wrong-type-fail.json b/_sources/properties/observation/tests/wrong-type-fail.json
new file mode 100644
index 00000000..af707844
--- /dev/null
+++ b/_sources/properties/observation/tests/wrong-type-fail.json
@@ -0,0 +1,7 @@
+{
+  "featureType": "Sampling",
+  "hasFeatureOfInterest": "http://something.org/1",
+  "observedProperty": "something",
+  "resultTime": "2016-05-04T02:27:02Z",
+  "hasSimpleResult": 1
+}
diff --git a/_sources/properties/sampling/schema.yaml b/_sources/properties/sampling/schema.yaml
index 0c7518b2..f2b39c56 100644
--- a/_sources/properties/sampling/schema.yaml
+++ b/_sources/properties/sampling/schema.yaml
@@ -1,11 +1,30 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA Sampling'
 x-jsonld-context: ../../../sosa-ssn.jsonld
+$defs:
+  samplingType:
+    enum:
+      - Sampling
+      - sosa:Sampling
+      - http://www.w3.org/ns/sosa/Sampling
+  member:
+    description: >-
+      A Sampling in a SamplingCollection: feature of interest and time may be provided by the
+      collection (checked by SHACL), the result (the Sample) may not.
+    allOf:
+      - $ref: bblocks://ogc.sosa.properties.execution
+      - type: object
+        properties:
+          featureType:
+            oneOf:
+              - $ref: '#/$defs/samplingType'
+              - type: array
+                contains:
+                  $ref: '#/$defs/samplingType'
+          madeBySampler:
+            $ref: '../execution/schema.yaml#/$defs/reference'
+      - $ref: '../execution/schema.yaml#/$defs/result'
+type: object
 allOf:
-  - $ref: bblocks://ogc.sosa.properties.execution
-  - type: object
-    properties:
-      madeBySampler:
-        type:
-          - object
-          - string
+  - $ref: '#/$defs/member'
+  - $ref: '../execution/schema.yaml#/$defs/required'
diff --git a/_sources/spec-examples/actuations/bblock.json b/_sources/spec-examples/actuations/bblock.json
index e19634e3..560caac1 100644
--- a/_sources/spec-examples/actuations/bblock.json
+++ b/_sources/spec-examples/actuations/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/actuations/transforms.yaml b/_sources/spec-examples/actuations/transforms.yaml
index 8e87fe6c..e788c386 100644
--- a/_sources/spec-examples/actuations/transforms.yaml
+++ b/_sources/spec-examples/actuations/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Actuation) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.actuation`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.actuation`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.actuation`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.actuation
   metadata:
+    target: ogc.sosa.properties.actuation
     rootClasses:
     - http://www.w3.org/ns/sosa/Actuation
     containerClasses:
diff --git a/_sources/spec-examples/bblock.json b/_sources/spec-examples/bblock.json
index 310e0646..ec1d4726 100644
--- a/_sources/spec-examples/bblock.json
+++ b/_sources/spec-examples/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/deployments/bblock.json b/_sources/spec-examples/deployments/bblock.json
index 7d84256b..f24a0b59 100644
--- a/_sources/spec-examples/deployments/bblock.json
+++ b/_sources/spec-examples/deployments/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/deployments/transforms.yaml b/_sources/spec-examples/deployments/transforms.yaml
index 8df838db..94c257f6 100644
--- a/_sources/spec-examples/deployments/transforms.yaml
+++ b/_sources/spec-examples/deployments/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Deployment) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.deployment`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.deployment`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.deployment`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.deployment
   metadata:
+    target: ogc.sosa.properties.deployment
     rootClasses:
     - http://www.w3.org/ns/sosa/Deployment
     containerClasses:
diff --git a/_sources/spec-examples/observation-collections/bblock.json b/_sources/spec-examples/observation-collections/bblock.json
index 99e4615e..b97db06f 100644
--- a/_sources/spec-examples/observation-collections/bblock.json
+++ b/_sources/spec-examples/observation-collections/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/observation-collections/transforms.yaml b/_sources/spec-examples/observation-collections/transforms.yaml
index ea1bd760..438218bb 100644
--- a/_sources/spec-examples/observation-collections/transforms.yaml
+++ b/_sources/spec-examples/observation-collections/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (ObservationCollection) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.observationCollection`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.observationCollection`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.observationCollection`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.observationCollection
   metadata:
+    target: ogc.sosa.properties.observationCollection
     rootClasses:
     - http://www.w3.org/ns/sosa/ObservationCollection
     containerClasses:
diff --git a/_sources/spec-examples/observations/bblock.json b/_sources/spec-examples/observations/bblock.json
index ce66afea..e53c2c95 100644
--- a/_sources/spec-examples/observations/bblock.json
+++ b/_sources/spec-examples/observations/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/observations/transforms.yaml b/_sources/spec-examples/observations/transforms.yaml
index a8b677e2..5a323e23 100644
--- a/_sources/spec-examples/observations/transforms.yaml
+++ b/_sources/spec-examples/observations/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Observation) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.observation`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.observation`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.observation`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.observation
   metadata:
+    target: ogc.sosa.properties.observation
     rootClasses:
     - http://www.w3.org/ns/sosa/Observation
     containerClasses:
diff --git a/_sources/spec-examples/platforms/bblock.json b/_sources/spec-examples/platforms/bblock.json
index 091c0fd8..4b74b43a 100644
--- a/_sources/spec-examples/platforms/bblock.json
+++ b/_sources/spec-examples/platforms/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/platforms/transforms.yaml b/_sources/spec-examples/platforms/transforms.yaml
index 666b8c9a..af7ddd3d 100644
--- a/_sources/spec-examples/platforms/transforms.yaml
+++ b/_sources/spec-examples/platforms/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Platform) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.platform`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.platform`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.platform`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.platform
   metadata:
+    target: ogc.sosa.properties.platform
     rootClasses:
     - http://www.w3.org/ns/sosa/Platform
     containerClasses:
diff --git a/_sources/spec-examples/sample-collections/bblock.json b/_sources/spec-examples/sample-collections/bblock.json
index 306197f8..a0207a5a 100644
--- a/_sources/spec-examples/sample-collections/bblock.json
+++ b/_sources/spec-examples/sample-collections/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/sample-collections/transforms.yaml b/_sources/spec-examples/sample-collections/transforms.yaml
index 2e9bbed0..f980ce0b 100644
--- a/_sources/spec-examples/sample-collections/transforms.yaml
+++ b/_sources/spec-examples/sample-collections/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (SampleCollection) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sampleCollection`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.sampleCollection`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.sampleCollection`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.sampleCollection
   metadata:
+    target: ogc.sosa.properties.sampleCollection
     rootClasses:
     - http://www.w3.org/ns/sosa/SampleCollection
     containerClasses:
diff --git a/_sources/spec-examples/samples/bblock.json b/_sources/spec-examples/samples/bblock.json
index 1d520d3d..8dfc3a04 100644
--- a/_sources/spec-examples/samples/bblock.json
+++ b/_sources/spec-examples/samples/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/samples/transforms.yaml b/_sources/spec-examples/samples/transforms.yaml
index 4ab4a2d0..3a5312f4 100644
--- a/_sources/spec-examples/samples/transforms.yaml
+++ b/_sources/spec-examples/samples/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Sample, MaterialSample) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sample`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.sample`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.sample`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.sample
   metadata:
+    target: ogc.sosa.properties.sample
     rootClasses:
     - http://www.w3.org/ns/sosa/Sample
     - http://www.w3.org/ns/sosa/MaterialSample
diff --git a/_sources/spec-examples/samplings/bblock.json b/_sources/spec-examples/samplings/bblock.json
index 58865203..df5fc209 100644
--- a/_sources/spec-examples/samplings/bblock.json
+++ b/_sources/spec-examples/samplings/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/samplings/transforms.yaml b/_sources/spec-examples/samplings/transforms.yaml
index dc540f79..acb298dc 100644
--- a/_sources/spec-examples/samplings/transforms.yaml
+++ b/_sources/spec-examples/samplings/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Sampling) of a SOSA Turtle example and compacts it with the `ogc.sosa.properties.sampling`
-    JSON-LD context. The output is validated against `ogc.sosa.properties.sampling`.
+    JSON-LD context, which the output's `@context` references (plus only the example's own prefixes and literal types). The
+    output is validated against `ogc.sosa.properties.sampling`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.sampling
   metadata:
+    target: ogc.sosa.properties.sampling
     rootClasses:
     - http://www.w3.org/ns/sosa/Sampling
     containerClasses:
diff --git a/_sources/spec-examples/systems/bblock.json b/_sources/spec-examples/systems/bblock.json
index 36041b17..0969efb0 100644
--- a/_sources/spec-examples/systems/bblock.json
+++ b/_sources/spec-examples/systems/bblock.json
@@ -23,6 +23,6 @@
     "OMS",
     "OWA"
   ],
-  "group": "SOSA",
+  "group": "Spec Examples",
   "highlighted": false
 }
diff --git a/_sources/spec-examples/systems/transforms.yaml b/_sources/spec-examples/systems/transforms.yaml
index f1241dd9..cc443ef0 100644
--- a/_sources/spec-examples/systems/transforms.yaml
+++ b/_sources/spec-examples/systems/transforms.yaml
@@ -1,7 +1,8 @@
 transforms:
 - id: ttl-to-jsonld
   description: Frames the root resource (Sensor, Actuator, Sampler, System) of a SOSA Turtle example and compacts it with
-    the `ogc.sosa.properties.system` JSON-LD context. The output is validated against `ogc.sosa.properties.system`.
+    the `ogc.sosa.properties.system` JSON-LD context, which the output's `@context` references (plus only the example's own
+    prefixes and literal types). The output is validated against `ogc.sosa.properties.system`.
   type: python
   ref: ../transforms/ttl_to_sosa_json.py
   inputs:
@@ -14,6 +15,7 @@ transforms:
     profiles:
     - bblocks://ogc.sosa.properties.system
   metadata:
+    target: ogc.sosa.properties.system
     rootClasses:
     - http://www.w3.org/ns/sosa/Sensor
     - http://www.w3.org/ns/sosa/Actuator
diff --git a/_sources/spec-examples/transforms/ttl_to_sosa_json.py b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
index 5bae93b9..d94456da 100644
--- a/_sources/spec-examples/transforms/ttl_to_sosa_json.py
+++ b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
@@ -4,28 +4,35 @@
 # _sources/spec-examples// block; runs inside bblocks-postprocess (rdflib + pyld).
 #
 # metadata (transforms.yaml):
+#   target: bblock id         the output profile; its published JSON-LD context is referenced
+#                             by the output's @context
 #   rootClasses: [IRI, ...]   classes whose instances become the root object
 #   containerClasses: [IRI]   classes whose SOSA links embed a root candidate (default rootClasses)
-#   coerce: {term: datatype}  typed-literal coercions added to the output's local @context, for
-#                             terms the target schema constrains to plain strings (e.g. resultTime
-#                             with format: date-time) but the target context does not coerce
-#   suppressTerms: [term]     context terms not to use when compacting (e.g. the GeoJSON alias
-#                             'features' for sosa:hasMember, so the schema's 'hasMember' is used)
+#   suppressTerms: [term]     target context terms not to use when compacting (e.g. the GeoJSON
+#                             alias 'features' for sosa:hasMember, so the schema's 'hasMember' is used)
 # per example (examples.yaml):
 #   x-root: IRI               pick this resource as the root (multi-root examples)
 #
-# Output: the root resource framed and compacted with the block's own JSON-LD context
-# (which is the target bblock's context, inherited via schema.yaml $ref), with that
-# context removed and replaced by a prefix-only @context for any non-SOSA terms. Output
-# profile validation re-applies the target block's context, so the JSON Schema, JSON-LD
-# context and SHACL shapes of the target are all exercised.
+# Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
+#   "@context": [, {}]
+# The local part holds the example's own prefixes and typed-literal coercions for its non-SOSA
+# properties; it never redefines a target term. Times are plain xsd:dateTime strings: a
+# phenomenonTime time:Instant with a single date-time position becomes a string, anything more
+# complex (e.g. a time:Interval) stays an object using the target's time terms.
 import json
+import re
 from pathlib import Path
+from urllib.parse import urljoin
 
 from pyld import jsonld
-from rdflib import BNode, Graph, RDF, URIRef
+from rdflib import BNode, Graph, Literal, Namespace, RDF, URIRef
 
 SOSA_SSN = ('http://www.w3.org/ns/sosa/', 'http://www.w3.org/ns/ssn/')
+SOSA = Namespace('http://www.w3.org/ns/sosa/')
+TIME = Namespace('http://www.w3.org/2006/time#')
+XSD = Namespace('http://www.w3.org/2001/XMLSchema#')
+TZ = re.compile(r'(Z|[+-]\d{2}:\d{2})$')
+PLAIN = (None, XSD.string, URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'))
 
 
 def _get(obj, key, default=None):
@@ -38,20 +45,58 @@ def _get(obj, key, default=None):
 
 meta = transform_metadata.metadata
 tctx = transform_metadata.context
+working_dir = Path(_get(tctx, 'working_dir') or '.')
 root_classes = [URIRef(c) for c in _get(meta, 'rootClasses', [])]
 container_classes = [URIRef(c) for c in (_get(meta, 'containerClasses') or [])] or root_classes
 example = _get(tctx, 'example') or {}
 wanted_root = _get(example, 'x-root')
 
-# --- block JSON-LD context (assembled by the postprocessor for this block) ---------------
-ctx_path = None
-if _get(tctx, 'jsonld_context_path'):
-    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(tctx, 'jsonld_context_path')
-if (ctx_path is None or not ctx_path.is_file()) and _get(meta, 'context'):
-    ctx_path = Path(_get(tctx, 'working_dir') or '.') / _get(meta, 'context')
-if ctx_path is None or not ctx_path.is_file():
-    raise FileNotFoundError(f'JSON-LD context for this block not found ({ctx_path})')
-block_context = json.loads(ctx_path.read_text(encoding='utf-8'))['@context']
+# --- target JSON-LD context: local file (to compact with) and published URL (to reference) --
+own_ctx = _get(tctx, 'jsonld_context_path')
+if not own_ctx or not (working_dir / own_ctx).is_file():
+    raise FileNotFoundError(f'JSON-LD context for this block not found ({own_ctx})')
+target = _get(meta, 'target')
+target_ctx = own_ctx  # the block $refs the target schema, so its context is the target's
+if target:
+    # annotated///context.jsonld -> ...//...
+    id_prefix = _get(tctx, 'id_prefix') or ''
+    own_parts = _get(tctx, 'bblock_id')[len(id_prefix):].split('.')
+    target_parts = target[len(id_prefix):].split('.') if target.startswith(id_prefix) else None
+    ctx_parts = Path(own_ctx).parts
+    if target_parts and tuple(ctx_parts[-1 - len(own_parts):-1]) == tuple(own_parts):
+        candidate = Path(*ctx_parts[:-1 - len(own_parts)], *target_parts, ctx_parts[-1])
+        if (working_dir / candidate).is_file():
+            target_ctx = str(candidate.as_posix())
+target_context = json.loads((working_dir / target_ctx).read_text(encoding='utf-8'))['@context']
+base_url = _get(tctx, 'base_url')
+target_ctx_ref = urljoin(base_url, Path(target_ctx).as_posix()) if base_url else Path(target_ctx).as_posix()
+
+
+def _context_iris(ctx, prefixes=None):
+    """IRIs of all terms defined in a context, including property-scoped ones."""
+    if isinstance(ctx, list):
+        return set().union(*[_context_iris(c, prefixes) for c in ctx]) if ctx else set()
+    if not isinstance(ctx, dict):
+        return set()
+    prefixes = dict(prefixes or {})
+    prefixes.update({k: v for k, v in ctx.items() if isinstance(v, str) and v.endswith(('/', '#'))})
+
+    def expand(v):
+        if isinstance(v, str) and ':' in v and v.split(':', 1)[0] in prefixes:
+            return prefixes[v.split(':', 1)[0]] + v.split(':', 1)[1]
+        return v
+    iris = set()
+    for k, v in ctx.items():
+        if k.startswith('@'):
+            continue
+        iris.add(expand(v.get('@id', k) if isinstance(v, dict) else v))
+        if isinstance(v, dict) and '@context' in v:
+            iris |= _context_iris(v['@context'], prefixes)
+    return iris
+
+
+target_terms = set(target_context) if isinstance(target_context, dict) else set()
+target_iris = _context_iris(target_context)
 
 # --- parse --------------------------------------------------------------------------------
 src = transform_metadata.source_mime_type or 'text/turtle'
@@ -64,16 +109,67 @@ def _get(obj, key, default=None):
             if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
 for p, ns in (_get(meta, '_prefixes') or {}).items():
     prefixes.setdefault(p, ns)
+# never redefine a target term
+prefixes = {p: ns for p, ns in prefixes.items() if p not in target_terms}
+
+
+# --- times: plain xsd:dateTime strings where the value is a single date-time ----------------
+def _retype(p, wanted, accept):
+    for s, o in list(g.subject_objects(p)):
+        if isinstance(o, Literal) and o.datatype in accept and o.datatype != wanted:
+            if wanted == XSD.dateTimeStamp and not TZ.search(str(o)):
+                continue
+            g.remove((s, p, o))
+            g.add((s, p, Literal(str(o), datatype=wanted)))
+
+
+DATETIMES = (XSD.dateTime, XSD.dateTimeStamp)
+for p in (SOSA.resultTime, SOSA.phenomenonTime, SOSA.startTime, SOSA.endTime, TIME.inXSDDateTime):
+    _retype(p, XSD.dateTime, DATETIMES)
+_retype(TIME.inXSDDateTimeStamp, XSD.dateTimeStamp, DATETIMES)
+
+for s, inst in list(g.subject_objects(SOSA.phenomenonTime)):
+    if not isinstance(inst, BNode) or len(list(g.subject_predicates(inst))) != 1:
+        continue
+    po = list(g.predicate_objects(inst))
+    types = {o for p, o in po if p == RDF.type}
+    values = [(p, o) for p, o in po if p != RDF.type]
+    if (types <= {TIME.Instant} and len(values) == 1
+            and values[0][0] in (TIME.inXSDDateTime, TIME.inXSDDateTimeStamp)
+            and isinstance(values[0][1], Literal) and values[0][1].datatype in DATETIMES):
+        g.remove((inst, None, None))
+        g.remove((s, SOSA.phenomenonTime, inst))
+        g.add((s, SOSA.phenomenonTime, Literal(str(values[0][1]), datatype=XSD.dateTime)))
+
+# --- typed literals of the example's own properties: coerce in the local context -----------
+# (integers, doubles and booleans are serialized as native JSON values and need none)
+NATIVE = (XSD.integer, XSD.double, XSD.boolean)
+coercions = {}
+for p in set(g.predicates()):
+    if str(p) in target_iris or str(p).startswith(SOSA_SSN):
+        continue
+    dts = {o.datatype if isinstance(o, Literal) else 'node' for o in g.objects(None, p)}
+    if len(dts) == 1 and (dt := dts.pop()) not in PLAIN + NATIVE and dt != 'node':
+        coercions[p] = dt
+
+
+def _curie(iri):
+    for pfx, ns in sorted(prefixes.items(), key=lambda kv: -len(kv[1])):
+        if iri.startswith(ns) and re.fullmatch(r'[A-Za-z_][\w.-]*', iri[len(ns):] or '-'):
+            return f'{pfx}:{iri[len(ns):]}'
+    return None
+
+
 local_context = dict(prefixes)
-for term, datatype in (_get(meta, 'coerce') or {}).items():
-    term_def = block_context.get(term) if isinstance(block_context, dict) else None
-    term_id = term_def.get('@id') if isinstance(term_def, dict) else term_def
-    if term_id:
-        local_context[term] = {'@id': term_id, '@type': datatype}
-        prefixes.setdefault('xsd', 'http://www.w3.org/2001/XMLSchema#')
-        local_context.setdefault('xsd', prefixes['xsd'])
+for p, dt in coercions.items():
+    term = _curie(str(p))
+    if term and term not in target_terms:
+        dt = str(dt)
+        local_context[term] = {'@type': 'xsd:' + dt[len(str(XSD)):] if dt.startswith(str(XSD))
+                               and 'xsd' not in target_terms else _curie(dt) or dt}
 
 
+# --- root selection -----------------------------------------------------------------------
 def _instances(classes):
     return {s for c in classes for s in g.subjects(RDF.type, c)}
 
@@ -110,9 +206,17 @@ def _roots():
     root = skolem
 
 # --- frame + compact ----------------------------------------------------------------------
-expanded = json.loads(g.serialize(format='json-ld'))
+expanded = json.loads(g.serialize(format='json-ld', use_native_types=True))
+# A term coercing to a datatype (e.g. phenomenonTime -> xsd:dateTime) is not selected for an
+# object value (e.g. a time:Interval), so compact with those coercions removed and turn the
+# matching value objects back into plain strings afterwards (_plain): same JSON, same RDF.
+coerced = {t: d['@type'] for t, d in target_context.items()
+           if isinstance(d, dict) and d.get('@type') not in (None, '@id', '@vocab', '@json')} \
+    if isinstance(target_context, dict) else {}
+compact_target = {t: ({k: v for k, v in d.items() if k != '@type'} if t in coerced else d)
+                  for t, d in target_context.items()} if coerced else target_context
 frame_context = dict(local_context, **{t: None for t in (_get(meta, 'suppressTerms') or [])})
-context = [block_context, frame_context] if frame_context else block_context
+context = [compact_target, frame_context] if frame_context else compact_target
 framed = jsonld.frame(expanded, {'@context': context, '@id': str(root)},
                       {'embed': '@once', 'omitGraph': True})
 framed.pop('@context', None)
@@ -122,6 +226,44 @@ def _roots():
     framed.pop('id')
 
 
+def _tidy(node):
+    """Value objects keep the @type keyword rather than the 'featureType' alias of the target."""
+    if isinstance(node, list):
+        return [_tidy(v) for v in node]
+    if not isinstance(node, dict):
+        return node
+    node = {k: _tidy(v) for k, v in node.items()}
+    if '@value' in node:
+        node = {('@type' if k in ('featureType', 'type') else k): v for k, v in node.items()}
+    return node
+
+
+def _expand_type(t):
+    if isinstance(t, str) and ':' in t and t.split(':', 1)[0] in local_context:
+        return local_context[t.split(':', 1)[0]] + t.split(':', 1)[1]
+    return t
+
+
+def _plain(node):
+    """Values of datatype-coerced target terms as plain strings (see compact_target)."""
+    if isinstance(node, list):
+        return [_plain(v) for v in node]
+    if not isinstance(node, dict):
+        return node
+    out = {}
+    for k, v in node.items():
+        if k in coerced:
+            vs = [{'@value': x['@value']} if isinstance(x, dict) and set(x) == {'@value', '@type'}
+                  and _expand_type(x['@type']) == coerced[k] else x for x in (v if isinstance(v, list) else [v])]
+            vs = [x['@value'] if isinstance(x, dict) and set(x) == {'@value'} else _plain(x) for x in vs]
+            out[k] = vs if isinstance(v, list) else vs[0]
+        else:
+            out[k] = _plain(v)
+    return out
+
+
+framed = _plain(_tidy(framed))
+
 
 def _usage(node, prefixes_used, keys_used):
     if isinstance(node, dict):
@@ -139,7 +281,13 @@ def _usage(node, prefixes_used, keys_used):
 _usage(framed, used_prefixes, used_keys)
 local_context = {k: v for k, v in local_context.items()
                  if (k in used_prefixes if isinstance(v, str) else k in used_keys)}
-if any(not isinstance(v, str) for v in local_context.values()):
-    local_context['xsd'] = 'http://www.w3.org/2001/XMLSchema#'
-out = {'@context': local_context, **framed} if local_context else framed
+for k, v in list(local_context.items()):
+    if isinstance(v, dict):  # a used coercion needs its own prefixes
+        for c in (k, v['@type']):
+            pfx = c.split(':', 1)[0] if ':' in c else None
+            if pfx in prefixes:
+                local_context.setdefault(pfx, prefixes[pfx])
+            elif pfx == 'xsd':
+                local_context.setdefault('xsd', str(XSD))
+out = {'@context': [target_ctx_ref, local_context] if local_context else target_ctx_ref, **framed}
 output_data = json.dumps(out, indent=2, ensure_ascii=False)
diff --git a/sosa-ssn.jsonld b/sosa-ssn.jsonld
index b1e48d82..b0c112c6 100644
--- a/sosa-ssn.jsonld
+++ b/sosa-ssn.jsonld
@@ -292,7 +292,41 @@
     },
     "phenomenonTime": {
       "@id": "sosa:phenomenonTime",
-      "@type": "@id"
+      "@type": "http://www.w3.org/2001/XMLSchema#dateTime",
+      "@context": {
+        "time": "http://www.w3.org/2006/time#",
+        "Instant": "time:Instant",
+        "Interval": "time:Interval",
+        "ProperInterval": "time:ProperInterval",
+        "hasBeginning": "time:hasBeginning",
+        "hasEnd": "time:hasEnd",
+        "hasDuration": "time:hasDuration",
+        "hasXSDDuration": {
+          "@id": "time:hasXSDDuration",
+          "@type": "http://www.w3.org/2001/XMLSchema#duration"
+        },
+        "inTimePosition": "time:inTimePosition",
+        "inXSDDate": {
+          "@id": "time:inXSDDate",
+          "@type": "http://www.w3.org/2001/XMLSchema#date"
+        },
+        "inXSDDateTime": {
+          "@id": "time:inXSDDateTime",
+          "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
+        },
+        "inXSDDateTimeStamp": {
+          "@id": "time:inXSDDateTimeStamp",
+          "@type": "http://www.w3.org/2001/XMLSchema#dateTimeStamp"
+        },
+        "inXSDgYear": {
+          "@id": "time:inXSDgYear",
+          "@type": "http://www.w3.org/2001/XMLSchema#gYear"
+        },
+        "inXSDgYearMonth": {
+          "@id": "time:inXSDgYearMonth",
+          "@type": "http://www.w3.org/2001/XMLSchema#gYearMonth"
+        }
+      }
     },
     "resultTime": {
       "@id": "sosa:resultTime",

From 72f55f66b625d5f8f211ade0785d2568a258de2d Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Tue, 20 Oct 2026 15:05:57 +1100
Subject: [PATCH 05/11] Allow single values or arrays for collection properties

SOSA collection rules 3 and 5 let a collection have several values for a
property, such as several features of interest or phenomenonTime
intervals. Collection properties now accept a single value or a non-empty
array, each value as strict as for an individual execution.

Co-Authored-By: Claude Opus 5.5 
---
 .../actuationCollection/schema.yaml           | 10 ++--
 .../executionCollection/schema.yaml           | 49 ++++++++++++++++++-
 .../observationCollection/schema.yaml         | 16 ++----
 .../collection-foi-empty-array-fail.json      |  9 ++++
 .../tests/collection-foi-empty-item-fail.json |  9 ++++
 .../tests/collection-multiple-foi.json        | 23 +++++++++
 .../collection-multiple-phenomenon-time.json  | 21 ++++++++
 ...lection-result-time-not-datetime-fail.json |  9 ++++
 .../tests/collection-single-values.json       | 15 ++++++
 .../properties/samplingCollection/schema.yaml |  6 +--
 10 files changed, 142 insertions(+), 25 deletions(-)
 create mode 100644 _sources/properties/observationCollection/tests/collection-foi-empty-array-fail.json
 create mode 100644 _sources/properties/observationCollection/tests/collection-foi-empty-item-fail.json
 create mode 100644 _sources/properties/observationCollection/tests/collection-multiple-foi.json
 create mode 100644 _sources/properties/observationCollection/tests/collection-multiple-phenomenon-time.json
 create mode 100644 _sources/properties/observationCollection/tests/collection-result-time-not-datetime-fail.json
 create mode 100644 _sources/properties/observationCollection/tests/collection-single-values.json

diff --git a/_sources/properties/actuationCollection/schema.yaml b/_sources/properties/actuationCollection/schema.yaml
index 249707d2..ea6473b9 100644
--- a/_sources/properties/actuationCollection/schema.yaml
+++ b/_sources/properties/actuationCollection/schema.yaml
@@ -8,19 +8,15 @@ $defs:
       - type: object
         properties:
           actsOnProperty:
-            type:
-              - object
-              - string
+            $ref: '../executionCollection/schema.yaml#/$defs/references'
           madeByActuator:
-            type:
-              - object
-              - string
+            $ref: '../executionCollection/schema.yaml#/$defs/references'
           hasMember:
             type: array
             items:
               anyOf:
                 - $ref: '#/$defs/collection'
-                - $ref: '../actuation/schema.yaml'
+                - $ref: '../actuation/schema.yaml#/$defs/member'
                 - $ref: bblocks://ogc.ogc-utils.iri-or-curie
 allOf:
   - $ref: '#/$defs/collection'
diff --git a/_sources/properties/executionCollection/schema.yaml b/_sources/properties/executionCollection/schema.yaml
index 3afcf993..3302ebe2 100644
--- a/_sources/properties/executionCollection/schema.yaml
+++ b/_sources/properties/executionCollection/schema.yaml
@@ -1,4 +1,51 @@
 "$schema": https://json-schema.org/draft/2020-12/schema
 description: 'SOSA ExecutionCollection'
 x-jsonld-context: ../../../sosa-ssn.jsonld
-"$ref": bblocks://ogc.sosa.properties.execution
+# A collection's property values summarize those of its members, and a property may have more than
+# one value (SOSA collection consistency rules 3 and 5, e.g. several features of interest, or
+# several phenomenonTime intervals). Each property is therefore a single value or a non-empty
+# array of values, each value as strict as for an individual Execution.
+$defs:
+  references:
+    oneOf:
+      - $ref: '../execution/schema.yaml#/$defs/reference'
+      - type: array
+        minItems: 1
+        items:
+          $ref: '../execution/schema.yaml#/$defs/reference'
+  dateTimes:
+    oneOf:
+      - $ref: '../execution/schema.yaml#/$defs/dateTime'
+      - type: array
+        minItems: 1
+        items:
+          $ref: '../execution/schema.yaml#/$defs/dateTime'
+  temporalEntities:
+    oneOf:
+      - $ref: '../execution/schema.yaml#/$defs/temporalEntity'
+      - type: array
+        minItems: 1
+        items:
+          $ref: '../execution/schema.yaml#/$defs/temporalEntity'
+type: object
+properties:
+  resultTime:
+    $ref: '#/$defs/dateTimes'
+  phenomenonTime:
+    $ref: '#/$defs/temporalEntities'
+  hasFeatureOfInterest:
+    $ref: '#/$defs/references'
+  hasUltimateFeatureOfInterest:
+    $ref: '#/$defs/references'
+  usedProcedure:
+    $ref: '#/$defs/references'
+  startTime:
+    $ref: '#/$defs/dateTimes'
+  endTime:
+    $ref: '#/$defs/dateTimes'
+  hasResult:
+    $ref: '#/$defs/references'
+  result: true
+  result@links: true
+  hasSimpleResult: true
+  hasInputValue: true
diff --git a/_sources/properties/observationCollection/schema.yaml b/_sources/properties/observationCollection/schema.yaml
index 2f9eb15d..82096f76 100644
--- a/_sources/properties/observationCollection/schema.yaml
+++ b/_sources/properties/observationCollection/schema.yaml
@@ -2,31 +2,21 @@
 description: 'SOSA ObservationCollection'
 x-jsonld-context: ../../../sosa-ssn.jsonld
 $defs:
-  oneOrMany:
-    oneOf:
-      - type:
-        - object
-        - string
-      - type: array
-        items:
-          type:
-            - object
-            - string
   collection:
     allOf:
       - $ref: bblocks://ogc.sosa.properties.executionCollection
       - type: object
         properties:
           observedProperty:
-            $ref: "#/$defs/oneOrMany"
+            $ref: '../executionCollection/schema.yaml#/$defs/references'
           madeBySensor:
-            $ref: "#/$defs/oneOrMany"
+            $ref: '../executionCollection/schema.yaml#/$defs/references'
           hasMember:
             type: array
             items:
               anyOf:
                 - $ref: '#/$defs/collection'
-                - $ref: '../observation/schema.yaml'
+                - $ref: '../observation/schema.yaml#/$defs/member'
                 - $ref: bblocks://ogc.ogc-utils.iri-or-curie
 allOf:
   - $ref: '#/$defs/collection'
diff --git a/_sources/properties/observationCollection/tests/collection-foi-empty-array-fail.json b/_sources/properties/observationCollection/tests/collection-foi-empty-array-fail.json
new file mode 100644
index 00000000..2c770eda
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-foi-empty-array-fail.json
@@ -0,0 +1,9 @@
+{
+  "comment": "An array value may not be empty",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "hasFeatureOfInterest": [],
+  "resultTime": "2022-05-01T22:33:44Z",
+  "hasMember": [
+    { "featureType": "Observation", "hasFeatureOfInterest": "https://example.org/rooms/1", "hasSimpleResult": 24.1 }
+  ]
+}
diff --git a/_sources/properties/observationCollection/tests/collection-foi-empty-item-fail.json b/_sources/properties/observationCollection/tests/collection-foi-empty-item-fail.json
new file mode 100644
index 00000000..b395f8b1
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-foi-empty-item-fail.json
@@ -0,0 +1,9 @@
+{
+  "comment": "Each value in an array is as strict as a single value: no empty references",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "hasFeatureOfInterest": ["https://example.org/rooms/1", {}],
+  "resultTime": "2022-05-01T22:33:44Z",
+  "hasMember": [
+    { "featureType": "Observation", "hasFeatureOfInterest": "https://example.org/rooms/1", "hasSimpleResult": 24.1 }
+  ]
+}
diff --git a/_sources/properties/observationCollection/tests/collection-multiple-foi.json b/_sources/properties/observationCollection/tests/collection-multiple-foi.json
new file mode 100644
index 00000000..75998eda
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-multiple-foi.json
@@ -0,0 +1,23 @@
+{
+  "comment": "SOSA collection rule 3: several features of interest on the collection, each member has one of them",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "madeBySensor": "https://example.org/sensors/T56",
+  "hasFeatureOfInterest": [
+    "https://example.org/rooms/1",
+    "https://example.org/rooms/2"
+  ],
+  "hasMember": [
+    {
+      "featureType": "Observation",
+      "hasFeatureOfInterest": "https://example.org/rooms/1",
+      "resultTime": "2022-05-01T20:33:40Z",
+      "hasSimpleResult": 24.1
+    },
+    {
+      "featureType": "Observation",
+      "hasFeatureOfInterest": "https://example.org/rooms/2",
+      "resultTime": "2022-05-01T22:33:40Z",
+      "hasSimpleResult": 27.3
+    }
+  ]
+}
diff --git a/_sources/properties/observationCollection/tests/collection-multiple-phenomenon-time.json b/_sources/properties/observationCollection/tests/collection-multiple-phenomenon-time.json
new file mode 100644
index 00000000..95b7f1f3
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-multiple-phenomenon-time.json
@@ -0,0 +1,21 @@
+{
+  "comment": "SOSA collection rule 5: two phenomenonTime intervals on the collection, each member's time falls within one of them",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "hasFeatureOfInterest": "https://example.org/rooms/1",
+  "phenomenonTime": [
+    {
+      "featureType": "Interval",
+      "hasBeginning": { "inXSDDateTime": "2022-05-01T00:00:00Z" },
+      "hasEnd": { "inXSDDateTime": "2022-05-01T23:59:59Z" }
+    },
+    {
+      "featureType": "Interval",
+      "hasBeginning": { "inXSDDateTime": "2022-05-03T00:00:00Z" },
+      "hasEnd": { "inXSDDateTime": "2022-05-03T23:59:59Z" }
+    }
+  ],
+  "hasMember": [
+    { "featureType": "Observation", "phenomenonTime": "2022-05-01T20:33:40Z", "hasSimpleResult": 24.1 },
+    { "featureType": "Observation", "phenomenonTime": "2022-05-03T20:33:40Z", "hasSimpleResult": 27.3 }
+  ]
+}
diff --git a/_sources/properties/observationCollection/tests/collection-result-time-not-datetime-fail.json b/_sources/properties/observationCollection/tests/collection-result-time-not-datetime-fail.json
new file mode 100644
index 00000000..9df698b2
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-result-time-not-datetime-fail.json
@@ -0,0 +1,9 @@
+{
+  "comment": "Each value in an array is as strict as a single value: resultTime must be an xsd:dateTime",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "hasFeatureOfInterest": "https://example.org/rooms/1",
+  "resultTime": ["2022-05-01T22:33:44Z", "2022"],
+  "hasMember": [
+    { "featureType": "Observation", "hasSimpleResult": 24.1 }
+  ]
+}
diff --git a/_sources/properties/observationCollection/tests/collection-single-values.json b/_sources/properties/observationCollection/tests/collection-single-values.json
new file mode 100644
index 00000000..7f681f81
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-single-values.json
@@ -0,0 +1,15 @@
+{
+  "comment": "Single (non-array) values on the collection remain valid",
+  "observedProperty": "http://qudt.org/vocab/quantitykind/Temperature",
+  "hasFeatureOfInterest": "https://example.org/rooms/1",
+  "resultTime": "2022-05-01T22:33:44Z",
+  "phenomenonTime": {
+    "featureType": "Interval",
+    "hasBeginning": { "inXSDDateTime": "2022-05-01T20:00:00Z" },
+    "hasEnd": { "inXSDDateTime": "2022-05-01T23:00:00Z" }
+  },
+  "hasMember": [
+    { "featureType": "Observation", "hasSimpleResult": 24.1 },
+    { "featureType": "Observation", "hasSimpleResult": 27.3 }
+  ]
+}
diff --git a/_sources/properties/samplingCollection/schema.yaml b/_sources/properties/samplingCollection/schema.yaml
index 00b5d143..33454c3c 100644
--- a/_sources/properties/samplingCollection/schema.yaml
+++ b/_sources/properties/samplingCollection/schema.yaml
@@ -8,15 +8,13 @@ $defs:
       - type: object
         properties:
           madeBySampler:
-            type:
-              - object
-              - string
+            $ref: '../executionCollection/schema.yaml#/$defs/references'
           hasMember:
             type: array
             items:
               anyOf:
                 - $ref: '#/$defs/collection'
-                - $ref: '../sampling/schema.yaml'
+                - $ref: '../sampling/schema.yaml#/$defs/member'
                 - $ref: bblocks://ogc.ogc-utils.iri-or-curie
 allOf:
   - $ref: '#/$defs/collection'

From 556fa515d755000e774a47403134920b91d758a9 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Tue, 20 Oct 2026 15:05:58 +1100
Subject: [PATCH 06/11] Align SHACL time and observedProperty rules with SOSA
 collection rules

- A time is required on an execution or a collection it belongs to.
- At most one resultTime and phenomenonTime: a member's own value, or the
  nearest collection's when that collection has a single value.
- A member's value must be one of the collection's values (rules 2-3), or
  fall within one of its intervals (rules 4-5); Instants match equal
  literal times, and dateTimeStamp, date and start/end times are handled.
- observedProperty may be inherited from an enclosing collection, so a
  nested collection no longer has to state its own.
- SPARQL VALUES clauses replaced with FILTER IN, which SHACL allows.
- Adds collection tests covering each rule.

Co-Authored-By: Claude Opus 5.5 
---
 _sources/properties/execution/shapes.shacl    | 140 +++++++++++++-----
 _sources/properties/observation/shapes.shacl  |  22 +--
 .../tests/collection-foi-not-in-set-fail.ttl  |  15 ++
 .../collection-observedproperty-inherited.ttl |  16 ++
 ...llection-observedproperty-missing-fail.ttl |  15 ++
 ...llection-time-ambiguous-inherited-fail.ttl |  19 +++
 .../collection-time-date-in-interval.ttl      |  18 +++
 ...ection-time-date-outside-interval-fail.ttl |  18 +++
 .../collection-time-in-one-of-intervals.ttl   |  26 ++++
 ...ollection-time-instant-matches-literal.ttl |  16 ++
 ...lection-time-member-repeats-collection.ttl |  19 +++
 .../collection-time-nearest-inherited.ttl     |  26 ++++
 ...collection-time-outside-intervals-fail.ttl |  20 +++
 ...llection-time-straddles-intervals-fail.ttl |  22 +++
 14 files changed, 342 insertions(+), 50 deletions(-)
 create mode 100644 _sources/properties/observationCollection/tests/collection-foi-not-in-set-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-observedproperty-inherited.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-observedproperty-missing-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-ambiguous-inherited-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-date-in-interval.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-date-outside-interval-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-in-one-of-intervals.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-instant-matches-literal.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-member-repeats-collection.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-nearest-inherited.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-outside-intervals-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-time-straddles-intervals-fail.ttl

diff --git a/_sources/properties/execution/shapes.shacl b/_sources/properties/execution/shapes.shacl
index b88ffb0b..09232c6c 100644
--- a/_sources/properties/execution/shapes.shacl
+++ b/_sources/properties/execution/shapes.shacl
@@ -10,24 +10,48 @@
     a                   sh:NodeShape ;
     sh:targetClass      sosa:Observation, sosa:Actuation, sosa:Sampling ;
     sh:targetSubjectsOf sosa:hasResult, sosa:hasSimpleResult ;
+    # A time is required: the execution's own, or one provided by a collection it is a (direct or
+    # transitive) member of (collection rule 2).
     sh:sparql [
-        sh:message          "sosa:resultTime or sosa:phenomenonTime is required, and no more than 1 of each is allowed" ;
+        sh:message          "One of sosa:resultTime, sosa:phenomenonTime, sosa:startTime or sosa:endTime is required, on the execution or a collection it is a member of" ;
         sh:select """
-            PREFIX sh: 
             PREFIX sosa: 
             PREFIX geojson: 
-            SELECT $this (CONCAT(COALESCE(COUNT(?resultTime), 0), ' x sosa:resultTime, ', COALESCE(COUNT(?phenomenonTime), 0), ' x sosa:phenomenonTime') AS ?value) WHERE {
-                OPTIONAL { $this sosa:phenomenonTime ?phenomenonTime }
-                OPTIONAL { $this sosa:resultTime ?resultTime}
-                OPTIONAL { $this sosa:startTime ?startTime }
-                OPTIONAL { $this sosa:endTime ?endTime }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features)+ $this ; sosa:phenomenonTime ?phenomenonTime }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features)+ $this ; sosa:resultTime ?resultTime }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features)+ $this ; sosa:startTime ?startTime }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features)+ $this ; sosa:endTime ?endTime }
+            SELECT $this WHERE {
+                FILTER NOT EXISTS {
+                    $this (^sosa:hasMember|^geojson:features|sosa:memberOf)* ?holder .
+                    ?holder sosa:resultTime|sosa:phenomenonTime|sosa:startTime|sosa:endTime ?time .
+                }
             }
-            GROUP BY $this
-            HAVING (count(?resultTime) > 1 || count(?phenomenonTime) > 1 || count(?resultTime) + count(?phenomenonTime) + count(?startTime) + count(?endTime) < 1)
+        """ ;
+    ] ;
+    # An execution has at most one resultTime and one phenomenonTime. Its value is its own, or else
+    # the value(s) of the nearest collection that has the property: a collection's value applies
+    # to a member that omits it only if the collection has a single value (rule 2). Where the
+    # collection has several values or intervals (rules 3 and 5), the member must give its own.
+    sh:sparql [
+        sh:message          "At most one {?path} is allowed. A member of a collection with several {?path} values must give its own: {?value}" ;
+        sh:select """
+            PREFIX sosa: 
+            PREFIX geojson: 
+            SELECT $this ?path (CONCAT(STR(COUNT(DISTINCT ?time)), ' values') AS ?value) WHERE {
+                {
+                    $this ?path ?time .
+                    FILTER(?path IN (sosa:resultTime, sosa:phenomenonTime))
+                } UNION {
+                    ?holder (sosa:hasMember|geojson:features|^sosa:memberOf)+ $this ;
+                        ?path ?time .
+                    FILTER(?path IN (sosa:resultTime, sosa:phenomenonTime))
+                    FILTER NOT EXISTS { $this ?path ?own }
+                    FILTER NOT EXISTS {
+                        ?holder (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?nearer .
+                        ?nearer (sosa:hasMember|geojson:features|^sosa:memberOf)+ $this ;
+                            ?path ?nearerTime .
+                    }
+                }
+            }
+            GROUP BY $this ?path
+            HAVING (COUNT(DISTINCT ?time) > 1)
         """ ;
     ] ;
 .
@@ -35,6 +59,7 @@
 <#testFeatureOfInterest>
     a                   sh:NodeShape ;
     sh:targetClass      sosa:Observation, sosa:Actuation, sosa:Sampling ;
+    sh:targetSubjectsOf sosa:hasResult, sosa:hasSimpleResult ;
     sh:property         [
         sh:message          "Feature of interest (sosa:hasFeatureOfInterest/sosa:isFeatureOfInterestOf) is required in Collection or Execution(Observation/Actuation/Sampling)" ;
         sh:path     ( [ sh:zeroOrMorePath [ sh:oneOrMorePath [ sh:alternativePath ( [ sh:inversePath
@@ -50,6 +75,7 @@
 <#testResult>
     a                   sh:NodeShape ;
     sh:targetClass      sosa:Observation, sosa:Actuation, sosa:Sampling ;
+    sh:targetSubjectsOf sosa:hasResult, sosa:hasSimpleResult ;
     sh:property         [
         sh:message          "Exactly one of sosa:hasResult or sosa:hasSimpleResult is required per observation" ;
         sh:path     [ sh:alternativePath ( sosa:hasResult sosa:hasSimpleResult ) ] ;
@@ -67,6 +93,13 @@
 .
 
 ## Shapes for collection requirements
+# The SOSA collection consistency rules (see ExecutionCollection): where a collection has a
+# property, each (direct or transitive) member's value for it must
+#   - rules 2 and 3: be one of the collection's values;
+#   - rules 4 and 5: where the collection's values include intervals, fall within one of them.
+# A member that omits the property takes the collection's value (rule 2; see testRequiredTime).
+# A time:Instant compares by its position, so it matches a literal time with the same value.
+
 <#testCollectionPropertyValues>
     a sh:NodeShape ;
     sh:targetClass sosa:ObservationCollection, sosa:ActuationCollection, sosa:SamplingCollection ;
@@ -77,20 +110,38 @@
         PREFIX sosa: 
         PREFIX geojson: 
         PREFIX time: 
+        PREFIX xsd: 
         SELECT $this ?path (?member AS ?value) ?failedValue WHERE {
-            $this (sosa:hasMember|^sosa:memberOf)+ ?member ;
-                ?path ?collectionValue .
+            $this (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?member .
             ?member ?path ?memberValue .
-            FILTER(?path in ( sosa:resultTime, sosa:phenomenonTime, sosa:hasResult, sosa:hasSimpleResult,
+            FILTER(?path in ( sosa:resultTime, sosa:phenomenonTime, sosa:startTime, sosa:endTime,
+                sosa:hasResult, sosa:hasSimpleResult,
                 sosa:hasFeatureOfInterest, sosa:hasUltimateFeatureOfInterest, sosa:observedProperty, sosa:madeBySystem,
                 sosa:usedProcedure, sosa:madeBySensor, sosa:madeBySampler, sosa:isSampleOf, sosa:madeByActuator,
                 sosa:actsOn, sosa:actsOnProperty, sosa:hasInputValue, sosa:observationRelatedTo,
                 sosa:relatedObservation, sosa:resultQuality, sosa:isOriginalSampleOf, sosa:isResultOfMadeBySampler,
                 sosa:isResultOfUsedProcedure ))
-            FILTER((isLiteral(?collectionValue) || isIRI(?collectionValue)) && ?collectionValue != ?memberValue)
-            FILTER NOT EXISTS { $this ?path ?memberValue }
-            FILTER NOT EXISTS { ?collectionValue a time:Interval }
-            BIND(CONCAT(STR(?memberValue), " != ", STR(?collectionValue)) as ?failedValue)
+            FILTER EXISTS { $this ?path ?anyValue }
+            # interval values are checked by testCollectionPropertyValuesInterval
+            FILTER NOT EXISTS { $this ?path ?interval . ?interval time:hasBeginning|time:hasEnd ?bound }
+            # other embedded (blank node) values can't be compared
+            FILTER NOT EXISTS {
+                $this ?path ?embedded .
+                FILTER(isBlank(?embedded))
+                FILTER NOT EXISTS { ?embedded time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate ?embeddedPosition }
+            }
+            OPTIONAL { ?memberValue time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate ?memberPosition }
+            BIND(COALESCE(?memberPosition, ?memberValue) AS ?mv0)
+            FILTER(isIRI(?mv0) || isLiteral(?mv0))
+            BIND(COALESCE(IF(DATATYPE(?mv0) = xsd:dateTimeStamp, xsd:dateTime(STR(?mv0)), ?mv0), ?mv0) AS ?mv)
+            FILTER NOT EXISTS {
+                $this ?path ?collectionValue .
+                OPTIONAL { ?collectionValue time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate ?collectionPosition }
+                BIND(COALESCE(?collectionPosition, ?collectionValue) AS ?cv0)
+                BIND(COALESCE(IF(DATATYPE(?cv0) = xsd:dateTimeStamp, xsd:dateTime(STR(?cv0)), ?cv0), ?cv0) AS ?cv)
+                FILTER(sameTerm(?cv, ?mv) || COALESCE(?cv = ?mv, false))
+            }
+            BIND(CONCAT(STR(?mv), " is not one of the collection's values") AS ?failedValue)
         }
     """ ]
 .
@@ -105,29 +156,38 @@
         PREFIX sosa: 
         PREFIX geojson: 
         PREFIX time: 
+        PREFIX xsd: 
         SELECT $this ?path (?member AS ?value) ?failedValue WHERE {
-            $this (sosa:hasMember|^sosa:memberOf)+ ?member ;
-                ?path ?collectionValue .
-            ?collectionValue a time:Interval .
+            $this (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?member .
             ?member ?path ?memberValue .
-            FILTER(?path in ( sosa:resultTime, sosa:phenomenonTime, sosa:hasResult, sosa:hasSimpleResult,
-                sosa:hasFeatureOfInterest, sosa:hasUltimateFeatureOfInterest, sosa:observedProperty, sosa:madeBySystem,
-                sosa:usedProcedure, sosa:madeBySensor, sosa:madeBySampler, sosa:isSampleOf, sosa:madeByActuator,
-                sosa:actsOn, sosa:actsOnProperty, sosa:hasInputValue, sosa:observationRelatedTo,
-                sosa:relatedObservation, sosa:resultQuality, sosa:isOriginalSampleOf, sosa:isResultOfMadeBySampler,
-                sosa:isResultOfUsedProcedure ))
-
-            {
-                ?collectionValue time:hasBeginning/(time:inXSDDateTime|time:inXSDDate) ?colBeginning .
-                OPTIONAL { ?memberValue time:hasBeginning?/(time:inXSDDateTime|time:inXSDDate) ?memberBeginning }
-                FILTER((isLiteral(?memberValue) && ?memberValue < ?colBeginning) || (BOUND(?memberBeginning) && ?memberBeginning < ?colBeginning))
-                BIND(CONCAT(STR(COALESCE(?memberBeginning, ?memberValue)), " < ", STR(?colBeginning)) as ?failedValue)
-            } UNION {
-                ?collectionValue time:hasEnd?/(time:inXSDDateTime|time:inXSDDate) ?colEnd .
-                OPTIONAL { ?memberValue time:hasEnd?/(time:inXSDDateTime|time:inXSDDate) ?memberEnd }
-                FILTER((isLiteral(?memberValue) && ?memberValue > ?colEnd) || (BOUND(?memberEnd) && ?memberEnd > ?colEnd))
-                BIND(CONCAT(STR(COALESCE(?memberEnd, ?memberValue)), " > ", STR(?colEnd)) as ?failedValue)
+            FILTER(?path IN (sosa:phenomenonTime, sosa:resultTime, sosa:startTime, sosa:endTime))
+            FILTER EXISTS { $this ?path ?interval . ?interval time:hasBeginning|time:hasEnd ?bound }
+            # beginning and end of the member's value: a literal time, an Instant's position, or an
+            # interval's bounds; an xsd:date covers the whole day
+            OPTIONAL { ?memberValue time:hasBeginning?/(time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate) ?mb0 }
+            OPTIONAL { ?memberValue time:hasEnd?/(time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate) ?me0 }
+            BIND(IF(isLiteral(?memberValue), ?memberValue, ?mb0) AS ?mb1)
+            BIND(IF(isLiteral(?memberValue), ?memberValue, ?me0) AS ?me1)
+            BIND(IF(DATATYPE(?mb1) = xsd:date, xsd:dateTime(CONCAT(SUBSTR(STR(?mb1), 1, 10), "T00:00:00", SUBSTR(STR(?mb1), 11))), xsd:dateTime(STR(?mb1))) AS ?mb)
+            BIND(IF(DATATYPE(?me1) = xsd:date, xsd:dateTime(CONCAT(SUBSTR(STR(?me1), 1, 10), "T23:59:59.999", SUBSTR(STR(?me1), 11))), xsd:dateTime(STR(?me1))) AS ?me)
+            FILTER(BOUND(?mb) || BOUND(?me))
+            # rule 5: it must fall within one of the collection's values (an interval, or equal to an
+            # instant). A comparison that can't be decided (one time with a time zone and one without -
+            # rdflib also drops the time zone of an xsd:date) doesn't count against it.
+            FILTER NOT EXISTS {
+                $this ?path ?collectionValue .
+                OPTIONAL { ?collectionValue time:hasBeginning?/(time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate) ?cb0 }
+                OPTIONAL { ?collectionValue time:hasEnd?/(time:inXSDDateTime|time:inXSDDateTimeStamp|time:inXSDDate) ?ce0 }
+                BIND(IF(isLiteral(?collectionValue), ?collectionValue, ?cb0) AS ?cb1)
+                BIND(IF(isLiteral(?collectionValue), ?collectionValue, ?ce0) AS ?ce1)
+                BIND(IF(DATATYPE(?cb1) = xsd:date, xsd:dateTime(CONCAT(SUBSTR(STR(?cb1), 1, 10), "T00:00:00", SUBSTR(STR(?cb1), 11))), xsd:dateTime(STR(?cb1))) AS ?cb)
+                BIND(IF(DATATYPE(?ce1) = xsd:date, xsd:dateTime(CONCAT(SUBSTR(STR(?ce1), 1, 10), "T23:59:59.999", SUBSTR(STR(?ce1), 11))), xsd:dateTime(STR(?ce1))) AS ?ce)
+                FILTER(BOUND(?cb) || BOUND(?ce))
+                FILTER(COALESCE(!BOUND(?cb) || !BOUND(?mb) || (TZ(?mb) = "") != (TZ(?cb) = "") || ?mb >= ?cb, true)
+                    && COALESCE(!BOUND(?ce) || !BOUND(?me) || (TZ(?me) = "") != (TZ(?ce) = "") || ?me <= ?ce, true))
             }
+            BIND(CONCAT(COALESCE(STR(?mb), "?"), " .. ", COALESCE(STR(?me), "?"),
+                " is not within any of the collection's values") AS ?failedValue)
         }
     """ ]
 .
diff --git a/_sources/properties/observation/shapes.shacl b/_sources/properties/observation/shapes.shacl
index 842e9615..0ad2857d 100644
--- a/_sources/properties/observation/shapes.shacl
+++ b/_sources/properties/observation/shapes.shacl
@@ -20,7 +20,7 @@
             WHERE {
                 OPTIONAL { $this sosa:observedProperty ?prop .
                  $this (sosa:hasResult|sosa:hasSimpleResult) ?result_so_observation }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features)+ $this ; sosa:observedProperty ?prop }
+                OPTIONAL { ?collection (sosa:hasMember|geojson:features|^sosa:memberOf)+ $this ; sosa:observedProperty ?prop }
             }
             GROUP BY ?prop
             HAVING (count(?prop) < 1)
@@ -31,20 +31,22 @@
 <#testObservedPropertyConsistent>
     a                   sh:NodeShape ;
     sh:targetClass      sosa:ObservationCollection;
+    # A collection needs an observedProperty: its own, one inherited from a collection it is a
+    # (direct or transitive) member of (collection rule 2), or its members' own. Whether members'
+    # values match the collection's is checked by testCollectionPropertyValues.
     sh:sparql [
-        sh:message          "Collection members must match sosa:observedProperty if present" ;
+        sh:message          "sosa:observedProperty is required, on the collection, a collection it is a member of, or its members" ;
         sh:select """
-            PREFIX sh: 
             PREFIX sosa: 
             PREFIX geojson: 
-            SELECT $this (sosa:observedProperty as ?path) (GROUP_CONCAT(?prop; separator=';') AS ?value)
-             WHERE {
-                OPTIONAL { $this sosa:observedProperty ?prop }
-                OPTIONAL { $this (sosa:hasMember|geojson:features)+ ?obs .
-                    ?obs  sosa:observedProperty ?prop }
+            SELECT $this (sosa:observedProperty AS ?path) WHERE {
+                FILTER NOT EXISTS {
+                    { $this (^sosa:hasMember|^geojson:features|sosa:memberOf)* ?holder }
+                    UNION
+                    { $this (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?holder }
+                    ?holder sosa:observedProperty ?prop .
+                }
             }
-            GROUP BY ?prop
-            HAVING (count(?prop) < 1)
         """ ;
     ] ;
 .
diff --git a/_sources/properties/observationCollection/tests/collection-foi-not-in-set-fail.ttl b/_sources/properties/observationCollection/tests/collection-foi-not-in-set-fail.ttl
new file mode 100644
index 00000000..11fd293a
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-foi-not-in-set-fail.ttl
@@ -0,0 +1,15 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f1,
+        ex:f2 ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:resultTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasFeatureOfInterest ex:f3 ;
+    sosa:hasSimpleResult 1 .
+
diff --git a/_sources/properties/observationCollection/tests/collection-observedproperty-inherited.ttl b/_sources/properties/observationCollection/tests/collection-observedproperty-inherited.ttl
new file mode 100644
index 00000000..5712468e
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-observedproperty-inherited.ttl
@@ -0,0 +1,16 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# The nested collection ex:c2 and its member inherit observedProperty from ex:c (collection rule 2)
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:observedProperty ex:t ;
+    sosa:resultTime "2022-05-01T22:33:44+00:00"^^xsd:dateTime ;
+    sosa:hasMember ex:c2 .
+
+ex:c2 a sosa:ObservationCollection ;
+    sosa:hasMember ex:o1 .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 .
diff --git a/_sources/properties/observationCollection/tests/collection-observedproperty-missing-fail.ttl b/_sources/properties/observationCollection/tests/collection-observedproperty-missing-fail.ttl
new file mode 100644
index 00000000..ef973abd
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-observedproperty-missing-fail.ttl
@@ -0,0 +1,15 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# No observedProperty on the collections or the member
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2022-05-01T22:33:44+00:00"^^xsd:dateTime ;
+    sosa:hasMember ex:c2 .
+
+ex:c2 a sosa:ObservationCollection ;
+    sosa:hasMember ex:o1 .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 .
diff --git a/_sources/properties/observationCollection/tests/collection-time-ambiguous-inherited-fail.ttl b/_sources/properties/observationCollection/tests/collection-time-ambiguous-inherited-fail.ttl
new file mode 100644
index 00000000..dd6cebc0
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-ambiguous-inherited-fail.ttl
@@ -0,0 +1,19 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ],
+        [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T23:00:00+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-date-in-interval.ttl b/_sources/properties/observationCollection/tests/collection-time-date-in-interval.ttl
new file mode 100644
index 00000000..a899670a
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-date-in-interval.ttl
@@ -0,0 +1,18 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T00:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-02T23:59:59.999000+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime [ a time:Instant ;
+            time:inXSDDate "2022-05-01"^^xsd:date ] .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-date-outside-interval-fail.ttl b/_sources/properties/observationCollection/tests/collection-time-date-outside-interval-fail.ttl
new file mode 100644
index 00000000..34525953
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-date-outside-interval-fail.ttl
@@ -0,0 +1,18 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDate "2022-05-01"^^xsd:date ] ;
+            time:hasEnd [ time:inXSDDate "2022-05-02"^^xsd:date ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime [ a time:Instant ;
+            time:inXSDDate "2022-05-03"^^xsd:date ] .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-in-one-of-intervals.ttl b/_sources/properties/observationCollection/tests/collection-time-in-one-of-intervals.ttl
new file mode 100644
index 00000000..8d29004c
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-in-one-of-intervals.ttl
@@ -0,0 +1,26 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1,
+        ex:o2 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ],
+        [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T23:00:00+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime "2022-05-01T20:30:00+00:00"^^xsd:dateTime .
+
+ex:o2 a sosa:Observation ;
+    sosa:hasSimpleResult 2 ;
+    sosa:phenomenonTime [ a time:Instant ;
+            time:inXSDDateTime "2022-05-01T22:30:00+00:00"^^xsd:dateTime ] .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-instant-matches-literal.ttl b/_sources/properties/observationCollection/tests/collection-time-instant-matches-literal.ttl
new file mode 100644
index 00000000..5182eac9
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-instant-matches-literal.ttl
@@ -0,0 +1,16 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:resultTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:resultTime [ a time:Instant ;
+            time:inXSDDateTimeStamp "2022-05-01T22:00:00Z"^^xsd:dateTimeStamp ] .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-member-repeats-collection.ttl b/_sources/properties/observationCollection/tests/collection-time-member-repeats-collection.ttl
new file mode 100644
index 00000000..416470ef
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-member-repeats-collection.ttl
@@ -0,0 +1,19 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ] ;
+    sosa:resultTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime "2022-05-01T20:30:00+00:00"^^xsd:dateTime ;
+    sosa:resultTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-nearest-inherited.ttl b/_sources/properties/observationCollection/tests/collection-time-nearest-inherited.ttl
new file mode 100644
index 00000000..c0bf4ef2
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-nearest-inherited.ttl
@@ -0,0 +1,26 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:c2 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ],
+        [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T23:00:00+00:00"^^xsd:dateTime ] ] .
+
+ex:c2 a sosa:ObservationCollection ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:10:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T22:50:00+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-outside-intervals-fail.ttl b/_sources/properties/observationCollection/tests/collection-time-outside-intervals-fail.ttl
new file mode 100644
index 00000000..441c014e
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-outside-intervals-fail.ttl
@@ -0,0 +1,20 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ],
+        [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T23:00:00+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime "2022-05-01T21:30:00+00:00"^^xsd:dateTime .
+
diff --git a/_sources/properties/observationCollection/tests/collection-time-straddles-intervals-fail.ttl b/_sources/properties/observationCollection/tests/collection-time-straddles-intervals-fail.ttl
new file mode 100644
index 00000000..a5e9d485
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-time-straddles-intervals-fail.ttl
@@ -0,0 +1,22 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix time:  .
+@prefix xsd:  .
+
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:hasMember ex:o1 ;
+    sosa:observedProperty ex:t ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T21:00:00+00:00"^^xsd:dateTime ] ],
+        [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T22:00:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T23:00:00+00:00"^^xsd:dateTime ] ] .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 ;
+    sosa:phenomenonTime [ a time:Interval ;
+            time:hasBeginning [ time:inXSDDateTime "2022-05-01T20:30:00+00:00"^^xsd:dateTime ] ;
+            time:hasEnd [ time:inXSDDateTime "2022-05-01T22:30:00+00:00"^^xsd:dateTime ] ] .
+

From f383d6080efe960b7d2fc2b0d05d80bf6b82f387 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Tue, 20 Oct 2026 18:20:56 +1100
Subject: [PATCH 07/11] Fix SHACL observedProperty and result rules for
 actuations and samplings

- observedProperty is not required of actuations and samplings (typed, with
  actuation/sampling properties, or in their collections)
- a result may be given from the result's side with sosa:isResultOf
- a collection's observedProperty may be one its members inherit from
  another collection

Co-Authored-By: Claude Opus 5.5 
---
 _sources/properties/execution/shapes.shacl    |  5 ++-
 _sources/properties/observation/shapes.shacl  | 39 +++++++++++++------
 .../tests/actuation-no-observedproperty.ttl   | 16 ++++++++
 .../untyped-no-observedproperty-fail.ttl      |  9 +++++
 ...tion-observedproperty-member-inherited.ttl | 16 ++++++++
 .../sampling/tests/result-is-result-of.ttl    | 12 ++++++
 .../tests/result-two-results-fail.ttl         | 16 ++++++++
 7 files changed, 99 insertions(+), 14 deletions(-)
 create mode 100644 _sources/properties/observation/tests/actuation-no-observedproperty.ttl
 create mode 100644 _sources/properties/observation/tests/untyped-no-observedproperty-fail.ttl
 create mode 100644 _sources/properties/observationCollection/tests/collection-observedproperty-member-inherited.ttl
 create mode 100644 _sources/properties/sampling/tests/result-is-result-of.ttl
 create mode 100644 _sources/properties/sampling/tests/result-two-results-fail.ttl

diff --git a/_sources/properties/execution/shapes.shacl b/_sources/properties/execution/shapes.shacl
index 09232c6c..0f6cbfff 100644
--- a/_sources/properties/execution/shapes.shacl
+++ b/_sources/properties/execution/shapes.shacl
@@ -76,9 +76,10 @@
     a                   sh:NodeShape ;
     sh:targetClass      sosa:Observation, sosa:Actuation, sosa:Sampling ;
     sh:targetSubjectsOf sosa:hasResult, sosa:hasSimpleResult ;
+    # The result may also be given from the result's side (sosa:isResultOf, e.g. a Sample of a Sampling)
     sh:property         [
-        sh:message          "Exactly one of sosa:hasResult or sosa:hasSimpleResult is required per observation" ;
-        sh:path     [ sh:alternativePath ( sosa:hasResult sosa:hasSimpleResult ) ] ;
+        sh:message          "Exactly one of sosa:hasResult, sosa:hasSimpleResult or sosa:isResultOf (from the result) is required per execution" ;
+        sh:path     [ sh:alternativePath ( sosa:hasResult sosa:hasSimpleResult [ sh:inversePath sosa:isResultOf ] ) ] ;
                           sh:minCount 1 ;
                           sh:maxCount 1 ;
                   ] ;
diff --git a/_sources/properties/observation/shapes.shacl b/_sources/properties/observation/shapes.shacl
index 0ad2857d..6062f1de 100644
--- a/_sources/properties/observation/shapes.shacl
+++ b/_sources/properties/observation/shapes.shacl
@@ -10,20 +10,31 @@
     a                   sh:NodeShape ;
     sh:targetClass      sosa:Observation ;
     sh:targetSubjectsOf sosa:hasResult, sosa:hasSimpleResult ;
+    # An observation needs an observedProperty: its own, or one provided by a collection it is a
+    # (direct or transitive) member of (collection rule 2). Results of actuations and samplings
+    # (typed, or recognisable by their properties or collection) don't make them observations.
     sh:sparql [
-        sh:message          "sosa:observedProperty is required" ;
+        sh:message          "sosa:observedProperty is required, on the observation or a collection it is a member of" ;
         sh:select """
-            PREFIX sh: 
             PREFIX sosa: 
             PREFIX geojson: 
-            SELECT $this (sosa:observedProperty as ?path) (GROUP_CONCAT(?prop; separator=';') AS ?value)
-            WHERE {
-                OPTIONAL { $this sosa:observedProperty ?prop .
-                 $this (sosa:hasResult|sosa:hasSimpleResult) ?result_so_observation }
-                OPTIONAL { ?collection (sosa:hasMember|geojson:features|^sosa:memberOf)+ $this ; sosa:observedProperty ?prop }
+            SELECT $this (sosa:observedProperty AS ?path) WHERE {
+                FILTER NOT EXISTS {
+                    $this (^sosa:hasMember|^geojson:features|sosa:memberOf)* ?holder .
+                    ?holder sosa:observedProperty ?prop .
+                }
+                FILTER (EXISTS { $this a sosa:Observation } || NOT EXISTS {
+                    { $this a ?type . FILTER(?type IN (sosa:Actuation, sosa:Sampling)) }
+                    UNION
+                    { $this sosa:actsOnProperty|sosa:madeByActuator|sosa:madeBySampler ?x }
+                    UNION
+                    {
+                        $this (^sosa:hasMember|^geojson:features|sosa:memberOf)+ ?collection .
+                        ?collection a ?ctype .
+                        FILTER(?ctype IN (sosa:ActuationCollection, sosa:SamplingCollection))
+                    }
+                })
             }
-            GROUP BY ?prop
-            HAVING (count(?prop) < 1)
         """ ;
     ] ;
 .
@@ -32,8 +43,9 @@
     a                   sh:NodeShape ;
     sh:targetClass      sosa:ObservationCollection;
     # A collection needs an observedProperty: its own, one inherited from a collection it is a
-    # (direct or transitive) member of (collection rule 2), or its members' own. Whether members'
-    # values match the collection's is checked by testCollectionPropertyValues.
+    # (direct or transitive) member of (collection rule 2), or its members' own or inherited ones
+    # (a member may also belong to other collections). Whether members' values match the
+    # collection's is checked by testCollectionPropertyValues.
     sh:sparql [
         sh:message          "sosa:observedProperty is required, on the collection, a collection it is a member of, or its members" ;
         sh:select """
@@ -43,7 +55,10 @@
                 FILTER NOT EXISTS {
                     { $this (^sosa:hasMember|^geojson:features|sosa:memberOf)* ?holder }
                     UNION
-                    { $this (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?holder }
+                    {
+                        $this (sosa:hasMember|geojson:features|^sosa:memberOf)+ ?member .
+                        ?member (^sosa:hasMember|^geojson:features|sosa:memberOf)* ?holder .
+                    }
                     ?holder sosa:observedProperty ?prop .
                 }
             }
diff --git a/_sources/properties/observation/tests/actuation-no-observedproperty.ttl b/_sources/properties/observation/tests/actuation-no-observedproperty.ttl
new file mode 100644
index 00000000..80852f55
--- /dev/null
+++ b/_sources/properties/observation/tests/actuation-no-observedproperty.ttl
@@ -0,0 +1,16 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# An actuation has a result but is not an observation: it needs no sosa:observedProperty
+ex:o1 a sosa:Observation ;
+    sosa:observedProperty ex:t ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2025-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasSimpleResult 1 .
+
+ex:a1 a sosa:Actuation ;
+    sosa:actsOnProperty ex:state ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2025-01-01T00:00:01Z"^^xsd:dateTime ;
+    sosa:hasSimpleResult true .
diff --git a/_sources/properties/observation/tests/untyped-no-observedproperty-fail.ttl b/_sources/properties/observation/tests/untyped-no-observedproperty-fail.ttl
new file mode 100644
index 00000000..beaf15c0
--- /dev/null
+++ b/_sources/properties/observation/tests/untyped-no-observedproperty-fail.ttl
@@ -0,0 +1,9 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# An untyped execution with a result and no actuation or sampling properties is taken to be an
+# observation: it needs a sosa:observedProperty
+ex:o1 sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2025-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasSimpleResult 1 .
diff --git a/_sources/properties/observationCollection/tests/collection-observedproperty-member-inherited.ttl b/_sources/properties/observationCollection/tests/collection-observedproperty-member-inherited.ttl
new file mode 100644
index 00000000..23c4a65d
--- /dev/null
+++ b/_sources/properties/observationCollection/tests/collection-observedproperty-member-inherited.ttl
@@ -0,0 +1,16 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# ex:times gives only a time; its member inherits observedProperty from another collection, ex:c
+ex:c a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:observedProperty ex:t ;
+    sosa:hasMember ex:o1 .
+
+ex:times a sosa:ObservationCollection ;
+    sosa:resultTime "2022-05-01T22:33:44+00:00"^^xsd:dateTime ;
+    sosa:hasMember ex:o1 .
+
+ex:o1 a sosa:Observation ;
+    sosa:hasSimpleResult 1 .
diff --git a/_sources/properties/sampling/tests/result-is-result-of.ttl b/_sources/properties/sampling/tests/result-is-result-of.ttl
new file mode 100644
index 00000000..f0179ff2
--- /dev/null
+++ b/_sources/properties/sampling/tests/result-is-result-of.ttl
@@ -0,0 +1,12 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# The sampling's result is given from the sample's side (sosa:isResultOf)
+ex:s1 a sosa:Sampling ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2025-01-01T00:00:00Z"^^xsd:dateTime .
+
+ex:sample1 a sosa:Sample ;
+    sosa:isSampleOf ex:f ;
+    sosa:isResultOf ex:s1 .
diff --git a/_sources/properties/sampling/tests/result-two-results-fail.ttl b/_sources/properties/sampling/tests/result-two-results-fail.ttl
new file mode 100644
index 00000000..f129cc8e
--- /dev/null
+++ b/_sources/properties/sampling/tests/result-two-results-fail.ttl
@@ -0,0 +1,16 @@
+@prefix ex:  .
+@prefix sosa:  .
+@prefix xsd:  .
+
+# Two different results: one given by the sampling, another by a sample's sosa:isResultOf
+ex:s1 a sosa:Sampling ;
+    sosa:hasFeatureOfInterest ex:f ;
+    sosa:resultTime "2025-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasResult ex:sample1 .
+
+ex:sample1 a sosa:Sample ;
+    sosa:isSampleOf ex:f .
+
+ex:sample2 a sosa:Sample ;
+    sosa:isSampleOf ex:f ;
+    sosa:isResultOf ex:s1 .

From 27614829196c6c9aee139090ba5ec544740b78ba Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Tue, 20 Oct 2026 18:21:03 +1100
Subject: [PATCH 08/11] Inherit missing spec-example values from per-example
 closure collections

The transform reads the snippet's shacl-closure from its context and copies
single-valued execution properties from the nearest containing collection
(SOSA collection rule 2) into its output, so outputs validate without
closure support in output profile validation. Adds closures for 14 spec
examples that lack times, features of interest or observed properties.

Co-Authored-By: Claude Opus 5.5 
---
 .claude/skills/spec-examples-jsonld/SKILL.md  |  42 ++++--
 .../assets/ttl_to_sosa_json.py                | 129 ++++++++++++++----
 .../scripts/sync_spec_example_blocks.py       |   4 +-
 .../closures/IBS-TH2-PLUS-capabilities.ttl    |  16 +++
 .../InkBird-IBS-TH2-survivable-conditions.ttl |  14 ++
 .../closures/LocatedSampling.ttl              |  13 ++
 .../spec-examples/closures/Thermometer.ttl    |  13 ++
 _sources/spec-examples/closures/UOM-cdt.ttl   |  13 ++
 .../closures/UOM-qudt-object.ttl              |  13 ++
 .../spec-examples/closures/apartment-134.ttl  |  24 ++++
 .../closures/battery-lifetime.ttl             |  13 ++
 _sources/spec-examples/closures/dht22.ttl     |  22 +++
 _sources/spec-examples/closures/ip68.ttl      |  16 +++
 .../spec-examples/closures/obs-sample-foi.ttl |  13 ++
 _sources/spec-examples/closures/smiley.ttl    |  13 ++
 .../spec-examples/closures/spinning-cups.ttl  |  14 ++
 .../spec-examples/closures/tree-height.ttl    |  13 ++
 .../observation-collections/examples.yaml     |   8 ++
 .../spec-examples/observations/examples.yaml  |  26 ++++
 .../spec-examples/samplings/examples.yaml     |   2 +
 .../transforms/ttl_to_sosa_json.py            | 129 ++++++++++++++----
 21 files changed, 482 insertions(+), 68 deletions(-)
 create mode 100644 _sources/spec-examples/closures/IBS-TH2-PLUS-capabilities.ttl
 create mode 100644 _sources/spec-examples/closures/InkBird-IBS-TH2-survivable-conditions.ttl
 create mode 100644 _sources/spec-examples/closures/LocatedSampling.ttl
 create mode 100644 _sources/spec-examples/closures/Thermometer.ttl
 create mode 100644 _sources/spec-examples/closures/UOM-cdt.ttl
 create mode 100644 _sources/spec-examples/closures/UOM-qudt-object.ttl
 create mode 100644 _sources/spec-examples/closures/apartment-134.ttl
 create mode 100644 _sources/spec-examples/closures/battery-lifetime.ttl
 create mode 100644 _sources/spec-examples/closures/dht22.ttl
 create mode 100644 _sources/spec-examples/closures/ip68.ttl
 create mode 100644 _sources/spec-examples/closures/obs-sample-foi.ttl
 create mode 100644 _sources/spec-examples/closures/smiley.ttl
 create mode 100644 _sources/spec-examples/closures/spinning-cups.ttl
 create mode 100644 _sources/spec-examples/closures/tree-height.ttl

diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
index 0a4d9a5e..c1407a5a 100644
--- a/.claude/skills/spec-examples-jsonld/SKILL.md
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -84,18 +84,36 @@ If an example has several roots, the sync step writes one example per root, each
 Put a Turtle file at `_sources/spec-examples/closures/.ttl`. A file named
 `.ttl` applies to every root of a multi-root example. The sync step adds it as the example
 snippet's `shacl-closure`. It is then used in two places:
-- when validating the Turtle example;
-- when profile-validating the transform output. This needs a postprocessor in which
-  `validate_transform_output` receives the snippet's closures.
-
-The transform does **not** merge closure triples into its output, so the JSON-LD stays a faithful
-conversion. The sync step lists the closures it used and warns about any that match no example.
-
-Only put facts about **related resources** in a closure: things the example refers to that are
-described elsewhere, such as the type of a referenced property, or a feature of interest held by
-a collection outside the example. Never use a closure to supply the example's own missing
-mandatory fields (`resultTime`, `hasFeatureOfInterest`, `observedProperty`, a result). That hides
-a real gap between the SOSA example and the OMS-strict target. Report the gap instead.
+- the postprocessor adds it to the data when validating the Turtle example;
+- the transform reads it from the transform context (`snippet['shacl-closure']`, resolved
+  against the block directory) and applies SOSA collection rule 2 (see below). This works with
+  the published postprocessor; no closure pass-through to output validation is needed.
+
+**Inheriting missing values from containing collections.** A closure supplies an example's
+missing execution properties by putting the executions (or the example's own collections) in a
+collection that has them:
+
+```turtle
+closure:tree-height a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:observation_1087 .
+```
+
+The SHACL rules let members inherit from their collections. The transform copies the inherited
+values into its output so the output is complete on its own. This applies to the root and to
+the example's resources that are direct members of closure collections. Each one takes a
+property it lacks from the nearest containing collection that has it, only if that collection
+has a single value. Results are never inherited.
+- Use `closure:` (`https://example.org/closure/`) IRIs and the `2017-01-01T00:00:00Z` time for
+  values the example doesn't imply. Use the example's own IRIs only where it identifies the value,
+  e.g. the sensor a capability collection describes.
+- Never give a collection a value that conflicts with one a member already states. Collection
+  rules 2–3 require the member's value to be one of the collection's. Use a separate closure
+  collection for the members that lack it.
+- Blank-node executions can only be reached through a named collection that contains them.
+  Resources with relative IRIs (e.g. ``) can't be referenced from a closure.
+
+The sync step lists the closures it used and warns about any that match no example.
 
 ## Run it
 
diff --git a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
index d94456da..bcff2686 100644
--- a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
+++ b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
@@ -12,6 +12,9 @@
 #                             alias 'features' for sosa:hasMember, so the schema's 'hasMember' is used)
 # per example (examples.yaml):
 #   x-root: IRI               pick this resource as the root (multi-root examples)
+#   snippet shacl-closure     (from the transform context) closures that may put the example's
+#                             resources in collections: the root takes a property it lacks from
+#                             the nearest containing collection with a single value for it
 #
 # Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
 #   "@context": [, {}]
@@ -113,6 +116,105 @@ def expand(v):
 prefixes = {p: ns for p, ns in prefixes.items() if p not in target_terms}
 
 
+# --- root selection -----------------------------------------------------------------------
+def _instances(classes):
+    return {s for c in classes for s in g.subjects(RDF.type, c)}
+
+
+def _roots():
+    inst = _instances(root_classes)
+    containers = _instances(container_classes)
+    nested = set()
+    for s, p, o in g:
+        if o not in inst or s == o or p == RDF.type:
+            continue
+        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
+            nested.add(o)
+    return sorted(inst - nested, key=str)
+
+
+if wanted_root:
+    root = URIRef(wanted_root)
+    if (root, None, None) not in g:
+        raise ValueError(f'x-root {wanted_root} has no statements in the example')
+else:
+    roots = _roots()
+    if not roots:
+        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
+    root = roots[0]
+
+
+# --- values inherited from containing collections (SOSA collection rule 2) ------------------
+# The snippet's SHACL closures (passed in the transform context) may put the example's resources
+# in collections. A property the root lacks takes the value of the nearest containing collection
+# (in the example or a closure) that has it, if that collection has a single value - as the SHACL
+# rules do - so the output is complete on its own.
+def _closure_graph():
+    cg = Graph()
+    files_path = _get(tctx, 'bblock_files_path') or '.'
+    for ref in _get(_get(tctx, 'snippet'), 'shacl-closure') or []:
+        if re.match(r'^https?://', ref):
+            cg.parse(ref)
+            continue
+        for candidate in (working_dir / files_path / ref, working_dir / ref):
+            if candidate.is_file():
+                cg.parse(candidate, format='turtle' if candidate.suffix == '.ttl' else None)
+                break
+        else:
+            raise FileNotFoundError(f'SHACL closure {ref} not found')
+    return cg
+
+
+GEOJSON_FEATURES = URIRef('https://purl.org/geojson/vocab#features')
+INHERITED = [SOSA[p] for p in (
+    'resultTime', 'phenomenonTime', 'startTime', 'endTime', 'hasFeatureOfInterest',
+    'hasUltimateFeatureOfInterest', 'observedProperty', 'actsOnProperty', 'usedProcedure',
+    'madeBySensor', 'madeByActuator', 'madeBySampler', 'madeBySystem')]
+
+
+def _containers(u, node):
+    return set(u.subjects(SOSA.hasMember, node)) | set(u.subjects(GEOJSON_FEATURES, node)) \
+        | set(u.objects(node, SOSA.memberOf))
+
+
+def _copy(u, node):
+    """Copy a blank node value's description from u into g."""
+    if isinstance(node, BNode):
+        for p, o in u.predicate_objects(node):
+            if (node, p, o) not in g:
+                g.add((node, p, o))
+                _copy(u, o)
+
+
+def _inherit(u, node):
+    for p in INHERITED:
+        if (node, p, None) in g:
+            continue
+        seen, level = {node}, _containers(u, node)
+        while level:
+            values = {v for c in level for v in u.objects(c, p)}
+            if values:
+                if len(values) == 1:
+                    value = values.pop()
+                    g.add((node, p, value))
+                    _copy(u, value)
+                break
+            seen |= level
+            level = {c for n in level for c in _containers(u, n)} - seen
+
+
+closure = _closure_graph()
+if len(closure):
+    u = g + closure
+    # the root, and the example's resources that are members of closure-only collections (the
+    # output may embed them); members of the example's own collections inherit from those
+    in_closure = {m for p in (SOSA.hasMember, GEOJSON_FEATURES)
+                  for c, m in closure.subject_objects(p) if (c, None, None) not in g} \
+        | {m for m, c in closure.subject_objects(SOSA.memberOf) if (c, None, None) not in g}
+    for node in sorted(n for n in in_closure if (n, None, None) in g and n != root) + [root]:
+        _inherit(u, node)
+
+
 # --- times: plain xsd:dateTime strings where the value is a single date-time ----------------
 def _retype(p, wanted, accept):
     for s, o in list(g.subject_objects(p)):
@@ -169,33 +271,6 @@ def _curie(iri):
                                and 'xsd' not in target_terms else _curie(dt) or dt}
 
 
-# --- root selection -----------------------------------------------------------------------
-def _instances(classes):
-    return {s for c in classes for s in g.subjects(RDF.type, c)}
-
-
-def _roots():
-    inst = _instances(root_classes)
-    containers = _instances(container_classes)
-    nested = set()
-    for s, p, o in g:
-        if o not in inst or s == o or p == RDF.type:
-            continue
-        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
-            nested.add(o)
-    return sorted(inst - nested, key=str)
-
-
-if wanted_root:
-    root = URIRef(wanted_root)
-    if (root, None, None) not in g:
-        raise ValueError(f'x-root {wanted_root} has no statements in the example')
-else:
-    roots = _roots()
-    if not roots:
-        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
-    root = roots[0]
-
 # Blank-node roots cannot be addressed by @id in a frame: skolemize just that node.
 if isinstance(root, BNode):
     skolem = URIRef(f'urn:x-bnode:{root}')
diff --git a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
index ee84dde8..e90a4985 100644
--- a/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
+++ b/.claude/skills/spec-examples-jsonld/scripts/sync_spec_example_blocks.py
@@ -101,8 +101,8 @@ def example_entries(entry: dict, siblings: dict[str, dict], closures: Path, rel:
             e['x-root'] = root
         e['snippets'] = [dict(sn) for sn in snippets]
         if closure := closure_ref(closures, rel, e['base-output-filename'], base):
-            # validates the Turtle example and (postprocessor passes snippet closures on) the
-            # transform output; the transform itself does not merge it into its output
+            # added to the Turtle example's data for validation; the transform reads it from its
+            # context and copies values inherited from closure collections into its output
             e['snippets'][0]['shacl-closure'] = [closure]
         out.append(e)
     return out
diff --git a/_sources/spec-examples/closures/IBS-TH2-PLUS-capabilities.ttl b/_sources/spec-examples/closures/IBS-TH2-PLUS-capabilities.ttl
new file mode 100644
index 00000000..3086df1f
--- /dev/null
+++ b/_sources/spec-examples/closures/IBS-TH2-PLUS-capabilities.ttl
@@ -0,0 +1,16 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+@prefix sensor:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+# the sensor type's capabilities and conditions describe the sensor instance
+closure:IBS-TH2-PLUS-characteristics a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:IBS-TH2-Plus-T-687343 ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember sensor:IBS-TH2-Plus-T-systemCapability, sensor:IBS-TH2-Plus-T-normalHumidityConditions .
diff --git a/_sources/spec-examples/closures/InkBird-IBS-TH2-survivable-conditions.ttl b/_sources/spec-examples/closures/InkBird-IBS-TH2-survivable-conditions.ttl
new file mode 100644
index 00000000..030fc2ba
--- /dev/null
+++ b/_sources/spec-examples/closures/InkBird-IBS-TH2-survivable-conditions.ttl
@@ -0,0 +1,14 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:InkBird-IBS-TH2-characteristics a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:InkBird-IBS-TH2-0354313547 ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:IBSTH2SurvivalRange .
diff --git a/_sources/spec-examples/closures/LocatedSampling.ttl b/_sources/spec-examples/closures/LocatedSampling.ttl
new file mode 100644
index 00000000..f6c1b010
--- /dev/null
+++ b/_sources/spec-examples/closures/LocatedSampling.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:LocatedSampling a sosa:SamplingCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:AirSampling_StE .
diff --git a/_sources/spec-examples/closures/Thermometer.ttl b/_sources/spec-examples/closures/Thermometer.ttl
new file mode 100644
index 00000000..8784871a
--- /dev/null
+++ b/_sources/spec-examples/closures/Thermometer.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:Thermometer a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:SickChildATempObs .
diff --git a/_sources/spec-examples/closures/UOM-cdt.ttl b/_sources/spec-examples/closures/UOM-cdt.ttl
new file mode 100644
index 00000000..2af63a21
--- /dev/null
+++ b/_sources/spec-examples/closures/UOM-cdt.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:UOM-cdt a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:Obs234534 .
diff --git a/_sources/spec-examples/closures/UOM-qudt-object.ttl b/_sources/spec-examples/closures/UOM-qudt-object.ttl
new file mode 100644
index 00000000..bd82eeb2
--- /dev/null
+++ b/_sources/spec-examples/closures/UOM-qudt-object.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:UOM-qudt-object a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:Obs234534 .
diff --git a/_sources/spec-examples/closures/apartment-134.ttl b/_sources/spec-examples/closures/apartment-134.ttl
new file mode 100644
index 00000000..d680c05b
--- /dev/null
+++ b/_sources/spec-examples/closures/apartment-134.ttl
@@ -0,0 +1,24 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+# sensor_926's observations of the apartment's electricity consumption
+closure:apartment-134-electricity a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest closure:Apartment_134 ;
+    sosa:observedProperty ex:Apartment_134_electricConsumption ;
+    sosa:hasMember ex:Observation_235714, ex:Observation_235754 .
+
+# a time for Observation_235754 only (Observation_235714 has its own)
+closure:apartment-134-electricity-235754 a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:Observation_235754 .
+
+closure:apartment-134-window a sosa:ActuationCollection ;
+    sosa:hasFeatureOfInterest ex:window ;
+    sosa:hasMember ex:actuation_188 .
diff --git a/_sources/spec-examples/closures/battery-lifetime.ttl b/_sources/spec-examples/closures/battery-lifetime.ttl
new file mode 100644
index 00000000..4005e87d
--- /dev/null
+++ b/_sources/spec-examples/closures/battery-lifetime.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:battery-lifetime a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:nominalLifetime .
diff --git a/_sources/spec-examples/closures/dht22.ttl b/_sources/spec-examples/closures/dht22.ttl
new file mode 100644
index 00000000..222d8301
--- /dev/null
+++ b/_sources/spec-examples/closures/dht22.ttl
@@ -0,0 +1,22 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+# the capability and operating-condition collections: a time only (members have their own
+# features of interest, which the collection's would have to include)
+closure:dht22-characteristics a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:DHT22_4578_HumiditySensorNormalOperatingConditions,
+        ex:DHT22_4578_TemperatureSensorNormalOperatingConditions,
+        ex:DHT22_4578_TemperatureSensorCapabilities, ex:DHT22_4578_HumiditySensorCapabilities .
+
+closure:dht22-observations a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest closure:dht22-ambient-air ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:observation_1087 .
diff --git a/_sources/spec-examples/closures/ip68.ttl b/_sources/spec-examples/closures/ip68.ttl
new file mode 100644
index 00000000..900033e6
--- /dev/null
+++ b/_sources/spec-examples/closures/ip68.ttl
@@ -0,0 +1,16 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+# the sensor model's operating range and capabilities describe the sensor
+closure:ip68-characteristics a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest ex:Sensor_SL-T-P1 ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:IP68_Outdoor_Temperature_Sensor_operatingRange,
+        ex:IP68_Outdoor_Temperature_Sensor_systemCapability .
diff --git a/_sources/spec-examples/closures/obs-sample-foi.ttl b/_sources/spec-examples/closures/obs-sample-foi.ttl
new file mode 100644
index 00000000..719450d7
--- /dev/null
+++ b/_sources/spec-examples/closures/obs-sample-foi.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:obs-sample-foi a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:Ob873c4 .
diff --git a/_sources/spec-examples/closures/smiley.ttl b/_sources/spec-examples/closures/smiley.ttl
new file mode 100644
index 00000000..bb6aa1eb
--- /dev/null
+++ b/_sources/spec-examples/closures/smiley.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:smiley a sosa:SamplingCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:SmileySampling .
diff --git a/_sources/spec-examples/closures/spinning-cups.ttl b/_sources/spec-examples/closures/spinning-cups.ttl
new file mode 100644
index 00000000..be0f7f22
--- /dev/null
+++ b/_sources/spec-examples/closures/spinning-cups.ttl
@@ -0,0 +1,14 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+# windSensor_14's wind speed observations (they have their own times)
+closure:spinning-cups-wind a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest closure:wind-at-location_4687 ;
+    sosa:hasMember ex:observation_147, ex:observation_148 .
diff --git a/_sources/spec-examples/closures/tree-height.ttl b/_sources/spec-examples/closures/tree-height.ttl
new file mode 100644
index 00000000..9d51dd60
--- /dev/null
+++ b/_sources/spec-examples/closures/tree-height.ttl
@@ -0,0 +1,13 @@
+@prefix sosa:  .
+@prefix rdfs:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
+# and the 2017-01-01 time are placeholders.
+
+closure:tree-height a sosa:ObservationCollection ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember ex:observation_1087 .
diff --git a/_sources/spec-examples/observation-collections/examples.yaml b/_sources/spec-examples/observation-collections/examples.yaml
index 6c2a4f33..fd2a7fdf 100644
--- a/_sources/spec-examples/observation-collections/examples.yaml
+++ b/_sources/spec-examples/observation-collections/examples.yaml
@@ -101,6 +101,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-survivable-conditions.ttl
+    shacl-closure:
+    - ../closures/InkBird-IBS-TH2-survivable-conditions.ttl
 - title: Example IBS-TH2-PLUS-capabilities.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [IBS-TH2-PLUS-capabilities.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-capabilities.ttl)'
@@ -108,6 +110,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/IBS-TH2-PLUS-capabilities.ttl
+    shacl-closure:
+    - ../closures/IBS-TH2-PLUS-capabilities.ttl
 - title: Example dht22.ttl (root DHT22_4578_HumiditySensorCapabilities)
   content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [dht22.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl)'
@@ -116,6 +120,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl
+    shacl-closure:
+    - ../closures/dht22.ttl
 - title: Example dht22.ttl (root DHT22_4578_TemperatureSensorCapabilities)
   content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [dht22.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl)'
@@ -124,3 +130,5 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/dht22.ttl
+    shacl-closure:
+    - ../closures/dht22.ttl
diff --git a/_sources/spec-examples/observations/examples.yaml b/_sources/spec-examples/observations/examples.yaml
index 44b9576c..dc93c43c 100644
--- a/_sources/spec-examples/observations/examples.yaml
+++ b/_sources/spec-examples/observations/examples.yaml
@@ -31,6 +31,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-qudt-object.ttl
+    shacl-closure:
+    - ../closures/UOM-qudt-object.ttl
 - title: Example obs-sample-foi.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [ModelFOI](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [obs-sample-foi.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/obs-sample-foi.ttl)'
@@ -38,6 +40,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/obs-sample-foi.ttl
+    shacl-closure:
+    - ../closures/obs-sample-foi.ttl
 - title: Example timeseries-result-inline.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [ModelTimeSeries](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [timeseries-result-inline.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/timeseries-result-inline.ttl)'
@@ -115,6 +119,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/Thermometer.ttl
+    shacl-closure:
+    - ../closures/Thermometer.ttl
 - title: Example battery-lifetime.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [battery-lifetime.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/battery-lifetime.ttl)'
@@ -122,6 +128,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/battery-lifetime.ttl
+    shacl-closure:
+    - ../closures/battery-lifetime.ttl
 - title: Example ip68.ttl (root Observation_5872357_battery)
   content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [ip68.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl)'
@@ -130,6 +138,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl
+    shacl-closure:
+    - ../closures/ip68.ttl
 - title: Example ip68.ttl (root Observation_5872357_temperature)
   content: 'Example referenced from the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [ip68.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl)'
@@ -138,6 +148,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ip68.ttl
+    shacl-closure:
+    - ../closures/ip68.ttl
 - title: Example UOM-cdt.ttl
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [UOM-cdt.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-cdt.ttl)'
@@ -145,6 +157,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/UOM-cdt.ttl
+    shacl-closure:
+    - ../closures/UOM-cdt.ttl
 - title: Example apartment-134.ttl (root Observation_235714)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [apartment-134.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl)'
@@ -153,6 +167,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
+    shacl-closure:
+    - ../closures/apartment-134.ttl
 - title: Example apartment-134.ttl (root Observation_235754)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [apartment-134.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl)'
@@ -161,6 +177,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
+    shacl-closure:
+    - ../closures/apartment-134.ttl
 - title: Example iphone_barometer-sosa.ttl (root Observation_346344)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [iphone_barometer-sosa.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl)'
@@ -191,6 +209,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/smiley.ttl
+    shacl-closure:
+    - ../closures/smiley.ttl
 - title: Example spinning-cups.ttl (root observation_147)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [spinning-cups.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl)'
@@ -199,6 +219,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl
+    shacl-closure:
+    - ../closures/spinning-cups.ttl
 - title: Example spinning-cups.ttl (root observation_148)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [spinning-cups.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl)'
@@ -207,6 +229,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/spinning-cups.ttl
+    shacl-closure:
+    - ../closures/spinning-cups.ttl
 - title: Example sunspots.ttl
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [sunspots.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/sunspots.ttl)'
@@ -221,3 +245,5 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/tree-height.ttl
+    shacl-closure:
+    - ../closures/tree-height.ttl
diff --git a/_sources/spec-examples/samplings/examples.yaml b/_sources/spec-examples/samplings/examples.yaml
index 32c459ab..3b45890d 100644
--- a/_sources/spec-examples/samplings/examples.yaml
+++ b/_sources/spec-examples/samplings/examples.yaml
@@ -47,3 +47,5 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/LocatedSampling.ttl
+    shacl-closure:
+    - ../closures/LocatedSampling.ttl
diff --git a/_sources/spec-examples/transforms/ttl_to_sosa_json.py b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
index d94456da..bcff2686 100644
--- a/_sources/spec-examples/transforms/ttl_to_sosa_json.py
+++ b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
@@ -12,6 +12,9 @@
 #                             alias 'features' for sosa:hasMember, so the schema's 'hasMember' is used)
 # per example (examples.yaml):
 #   x-root: IRI               pick this resource as the root (multi-root examples)
+#   snippet shacl-closure     (from the transform context) closures that may put the example's
+#                             resources in collections: the root takes a property it lacks from
+#                             the nearest containing collection with a single value for it
 #
 # Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
 #   "@context": [, {}]
@@ -113,6 +116,105 @@ def expand(v):
 prefixes = {p: ns for p, ns in prefixes.items() if p not in target_terms}
 
 
+# --- root selection -----------------------------------------------------------------------
+def _instances(classes):
+    return {s for c in classes for s in g.subjects(RDF.type, c)}
+
+
+def _roots():
+    inst = _instances(root_classes)
+    containers = _instances(container_classes)
+    nested = set()
+    for s, p, o in g:
+        if o not in inst or s == o or p == RDF.type:
+            continue
+        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
+            nested.add(o)
+    return sorted(inst - nested, key=str)
+
+
+if wanted_root:
+    root = URIRef(wanted_root)
+    if (root, None, None) not in g:
+        raise ValueError(f'x-root {wanted_root} has no statements in the example')
+else:
+    roots = _roots()
+    if not roots:
+        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
+    root = roots[0]
+
+
+# --- values inherited from containing collections (SOSA collection rule 2) ------------------
+# The snippet's SHACL closures (passed in the transform context) may put the example's resources
+# in collections. A property the root lacks takes the value of the nearest containing collection
+# (in the example or a closure) that has it, if that collection has a single value - as the SHACL
+# rules do - so the output is complete on its own.
+def _closure_graph():
+    cg = Graph()
+    files_path = _get(tctx, 'bblock_files_path') or '.'
+    for ref in _get(_get(tctx, 'snippet'), 'shacl-closure') or []:
+        if re.match(r'^https?://', ref):
+            cg.parse(ref)
+            continue
+        for candidate in (working_dir / files_path / ref, working_dir / ref):
+            if candidate.is_file():
+                cg.parse(candidate, format='turtle' if candidate.suffix == '.ttl' else None)
+                break
+        else:
+            raise FileNotFoundError(f'SHACL closure {ref} not found')
+    return cg
+
+
+GEOJSON_FEATURES = URIRef('https://purl.org/geojson/vocab#features')
+INHERITED = [SOSA[p] for p in (
+    'resultTime', 'phenomenonTime', 'startTime', 'endTime', 'hasFeatureOfInterest',
+    'hasUltimateFeatureOfInterest', 'observedProperty', 'actsOnProperty', 'usedProcedure',
+    'madeBySensor', 'madeByActuator', 'madeBySampler', 'madeBySystem')]
+
+
+def _containers(u, node):
+    return set(u.subjects(SOSA.hasMember, node)) | set(u.subjects(GEOJSON_FEATURES, node)) \
+        | set(u.objects(node, SOSA.memberOf))
+
+
+def _copy(u, node):
+    """Copy a blank node value's description from u into g."""
+    if isinstance(node, BNode):
+        for p, o in u.predicate_objects(node):
+            if (node, p, o) not in g:
+                g.add((node, p, o))
+                _copy(u, o)
+
+
+def _inherit(u, node):
+    for p in INHERITED:
+        if (node, p, None) in g:
+            continue
+        seen, level = {node}, _containers(u, node)
+        while level:
+            values = {v for c in level for v in u.objects(c, p)}
+            if values:
+                if len(values) == 1:
+                    value = values.pop()
+                    g.add((node, p, value))
+                    _copy(u, value)
+                break
+            seen |= level
+            level = {c for n in level for c in _containers(u, n)} - seen
+
+
+closure = _closure_graph()
+if len(closure):
+    u = g + closure
+    # the root, and the example's resources that are members of closure-only collections (the
+    # output may embed them); members of the example's own collections inherit from those
+    in_closure = {m for p in (SOSA.hasMember, GEOJSON_FEATURES)
+                  for c, m in closure.subject_objects(p) if (c, None, None) not in g} \
+        | {m for m, c in closure.subject_objects(SOSA.memberOf) if (c, None, None) not in g}
+    for node in sorted(n for n in in_closure if (n, None, None) in g and n != root) + [root]:
+        _inherit(u, node)
+
+
 # --- times: plain xsd:dateTime strings where the value is a single date-time ----------------
 def _retype(p, wanted, accept):
     for s, o in list(g.subject_objects(p)):
@@ -169,33 +271,6 @@ def _curie(iri):
                                and 'xsd' not in target_terms else _curie(dt) or dt}
 
 
-# --- root selection -----------------------------------------------------------------------
-def _instances(classes):
-    return {s for c in classes for s in g.subjects(RDF.type, c)}
-
-
-def _roots():
-    inst = _instances(root_classes)
-    containers = _instances(container_classes)
-    nested = set()
-    for s, p, o in g:
-        if o not in inst or s == o or p == RDF.type:
-            continue
-        if isinstance(o, BNode) or not str(p).startswith(SOSA_SSN) or s in containers:
-            nested.add(o)
-    return sorted(inst - nested, key=str)
-
-
-if wanted_root:
-    root = URIRef(wanted_root)
-    if (root, None, None) not in g:
-        raise ValueError(f'x-root {wanted_root} has no statements in the example')
-else:
-    roots = _roots()
-    if not roots:
-        raise ValueError('no root resource of class ' + ', '.join(root_classes) + ' found')
-    root = roots[0]
-
 # Blank-node roots cannot be addressed by @id in a frame: skolemize just that node.
 if isinstance(root, BNode):
     skolem = URIRef(f'urn:x-bnode:{root}')

From 2727df2a1814a9555fcdc8cc94fd138e2951db3d Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Wed, 21 Oct 2026 11:25:46 +1100
Subject: [PATCH 09/11] Add SHACL closures for spec examples ex6 and ex7

The examples use relative IRIs, which resolve against the example's URL:
the closures set @base to it, and the transform parses the example with it.
Closures may now also give an example resource values directly (results,
or several values of a collection property), which the transform copies
into its output.

Co-Authored-By: Claude Opus 5.5 
---
 .claude/skills/spec-examples-jsonld/SKILL.md  |  7 +++++-
 .../assets/ttl_to_sosa_json.py                | 14 +++++++++--
 _sources/spec-examples/closures/ex6.ttl       | 23 +++++++++++++++++++
 _sources/spec-examples/closures/ex7.ttl       | 23 +++++++++++++++++++
 .../observation-collections/examples.yaml     |  4 ++++
 .../transforms/ttl_to_sosa_json.py            | 14 +++++++++--
 6 files changed, 80 insertions(+), 5 deletions(-)
 create mode 100644 _sources/spec-examples/closures/ex6.ttl
 create mode 100644 _sources/spec-examples/closures/ex7.ttl

diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
index c1407a5a..7586094d 100644
--- a/.claude/skills/spec-examples-jsonld/SKILL.md
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -110,8 +110,13 @@ has a single value. Results are never inherited.
 - Never give a collection a value that conflicts with one a member already states. Collection
   rules 2–3 require the member's value to be one of the collection's. Use a separate closure
   collection for the members that lack it.
+- A closure may also give an example resource a value directly, e.g. a result (never inherited)
+  or several values of a collection property (only single values are inherited). The transform
+  copies direct values of the inherited properties into its output.
 - Blank-node executions can only be reached through a named collection that contains them.
-  Resources with relative IRIs (e.g. ``) can't be referenced from a closure.
+- Relative IRIs (e.g. ``) resolve against the example's URL. Set the closure's
+  `@base` to that URL (see `closures/ex6.ttl`). This needs a postprocessor that parses URL
+  examples with their URL as the base; the transform does so itself.
 
 The sync step lists the closures it used and warns about any that match no example.
 
diff --git a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
index bcff2686..2db9a57b 100644
--- a/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
+++ b/.claude/skills/spec-examples-jsonld/assets/ttl_to_sosa_json.py
@@ -14,7 +14,8 @@
 #   x-root: IRI               pick this resource as the root (multi-root examples)
 #   snippet shacl-closure     (from the transform context) closures that may put the example's
 #                             resources in collections: the root takes a property it lacks from
-#                             the nearest containing collection with a single value for it
+#                             the nearest containing collection with a single value for it; a
+#                             closure may also give an example resource such a value directly
 #
 # Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
 #   "@context": [, {}]
@@ -107,7 +108,10 @@ def expand(v):
     g = Graph(bind_namespaces='none')
 except TypeError:  # rdflib < 7
     g = Graph()
-g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle')
+# relative IRIs resolve against the example's URL, as in Turtle validation
+snippet_ref = _get(_get(tctx, 'snippet'), 'ref')
+g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle',
+        publicID=snippet_ref if isinstance(snippet_ref, str) and re.match(r'^https?://', snippet_ref) else None)
 prefixes = {p: str(ns) for p, ns in g.namespaces()
             if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
 for p, ns in (_get(meta, '_prefixes') or {}).items():
@@ -205,6 +209,12 @@ def _inherit(u, node):
 
 closure = _closure_graph()
 if len(closure):
+    # values a closure gives the example's own resources directly
+    direct = [(s, p, o) for s, p, o in closure
+              if p in INHERITED and (s, None, None) in g and (s, p, None) not in g]
+    for s, p, o in direct:
+        g.add((s, p, o))
+        _copy(closure, o)
     u = g + closure
     # the root, and the example's resources that are members of closure-only collections (the
     # output may embed them); members of the example's own collections inherit from those
diff --git a/_sources/spec-examples/closures/ex6.ttl b/_sources/spec-examples/closures/ex6.ttl
new file mode 100644
index 00000000..a8851fe6
--- /dev/null
+++ b/_sources/spec-examples/closures/ex6.ttl
@@ -0,0 +1,23 @@
+@base  .
+@prefix sosa:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2, and gives the
+# example's resources the values that can't be inherited. closure: IRIs and the 2017-01-01 time
+# are placeholders. The example uses relative IRIs, which resolve against its URL (@base).
+
+closure:ex6-observations a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest closure:ex6-feature ;
+    sosa:observedProperty closure:ex6-temperature ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember  ,  .
+
+# results can't be inherited
+ sosa:hasResult closure:ex6-result-1 .
+ sosa:hasResult closure:ex6-result-2 .
+
+# the operating range's conditions (its members) are for temperature and humidity
+ex:TemperatureSensorOperatingRange sosa:observedProperty closure:ex6-temperature , closure:ex6-humidity .
diff --git a/_sources/spec-examples/closures/ex7.ttl b/_sources/spec-examples/closures/ex7.ttl
new file mode 100644
index 00000000..5b61f6ed
--- /dev/null
+++ b/_sources/spec-examples/closures/ex7.ttl
@@ -0,0 +1,23 @@
+@base  .
+@prefix sosa:  .
+@prefix xsd:  .
+@prefix closure:  .
+@prefix ex:  .
+
+# SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
+# supplies the values they leave out, which they inherit by SOSA collection rule 2, and gives the
+# example's resources the values that can't be inherited. closure: IRIs and the 2017-01-01 time
+# are placeholders. The example uses relative IRIs, which resolve against its URL (@base).
+
+closure:ex7-observations a sosa:ObservationCollection ;
+    sosa:hasFeatureOfInterest closure:ex7-feature ;
+    sosa:observedProperty closure:ex7-temperature ;
+    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
+    sosa:hasMember  ,  .
+
+# results can't be inherited
+ sosa:hasResult closure:ex7-result-1 .
+ sosa:hasResult closure:ex7-result-2 .
+
+# the operating range's conditions (its members) are for temperature and humidity
+ sosa:observedProperty closure:ex7-temperature , closure:ex7-humidity .
diff --git a/_sources/spec-examples/observation-collections/examples.yaml b/_sources/spec-examples/observation-collections/examples.yaml
index fd2a7fdf..d651490d 100644
--- a/_sources/spec-examples/observation-collections/examples.yaml
+++ b/_sources/spec-examples/observation-collections/examples.yaml
@@ -87,6 +87,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex6.ttl
+    shacl-closure:
+    - ../closures/ex6.ttl
 - title: Example ex7.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [ModelSystemInstance](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [ex7.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex7.ttl)'
@@ -94,6 +96,8 @@ examples:
   snippets:
   - language: ttl
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/ex7.ttl
+    shacl-closure:
+    - ../closures/ex7.ttl
 - title: Example InkBird-IBS-TH2-survivable-conditions.ttl
   content: 'Example included in the SOSA/SSN specification section(s): [System-capabilities](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [InkBird-IBS-TH2-survivable-conditions.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/InkBird-IBS-TH2-survivable-conditions.ttl)'
diff --git a/_sources/spec-examples/transforms/ttl_to_sosa_json.py b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
index bcff2686..2db9a57b 100644
--- a/_sources/spec-examples/transforms/ttl_to_sosa_json.py
+++ b/_sources/spec-examples/transforms/ttl_to_sosa_json.py
@@ -14,7 +14,8 @@
 #   x-root: IRI               pick this resource as the root (multi-root examples)
 #   snippet shacl-closure     (from the transform context) closures that may put the example's
 #                             resources in collections: the root takes a property it lacks from
-#                             the nearest containing collection with a single value for it
+#                             the nearest containing collection with a single value for it; a
+#                             closure may also give an example resource such a value directly
 #
 # Output: the root resource framed and compacted with the target bblock's JSON-LD context, with
 #   "@context": [, {}]
@@ -107,7 +108,10 @@ def expand(v):
     g = Graph(bind_namespaces='none')
 except TypeError:  # rdflib < 7
     g = Graph()
-g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle')
+# relative IRIs resolve against the example's URL, as in Turtle validation
+snippet_ref = _get(_get(tctx, 'snippet'), 'ref')
+g.parse(data=input_data, format='json-ld' if 'json' in src else 'turtle',
+        publicID=snippet_ref if isinstance(snippet_ref, str) and re.match(r'^https?://', snippet_ref) else None)
 prefixes = {p: str(ns) for p, ns in g.namespaces()
             if p and not str(ns).startswith(SOSA_SSN) and p not in ('sosa', 'ssn', 'ssn-system')}
 for p, ns in (_get(meta, '_prefixes') or {}).items():
@@ -205,6 +209,12 @@ def _inherit(u, node):
 
 closure = _closure_graph()
 if len(closure):
+    # values a closure gives the example's own resources directly
+    direct = [(s, p, o) for s, p, o in closure
+              if p in INHERITED and (s, None, None) in g and (s, p, None) not in g]
+    for s, p, o in direct:
+        g.add((s, p, o))
+        _copy(closure, o)
     u = g + closure
     # the root, and the example's resources that are members of closure-only collections (the
     # output may embed them); members of the example's own collections inherit from those

From 293670f7dbb8af59b3708f8fa66576442f20f028 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Wed, 21 Oct 2026 21:10:29 +1100
Subject: [PATCH 10/11] Give closure collections their members'
 observedProperty values

Snippet closures are now also added when validating transform outputs,
where members that supply a closure collection's observedProperty may be
absent. The dht22 and ip68 closure collections now state their members'
values.

Co-Authored-By: Claude Opus 5.5 
---
 .claude/skills/spec-examples-jsonld/SKILL.md | 11 ++++++++---
 _sources/spec-examples/closures/dht22.ttl    |  4 ++++
 _sources/spec-examples/closures/ip68.ttl     |  7 +++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/.claude/skills/spec-examples-jsonld/SKILL.md b/.claude/skills/spec-examples-jsonld/SKILL.md
index 7586094d..ce769710 100644
--- a/.claude/skills/spec-examples-jsonld/SKILL.md
+++ b/.claude/skills/spec-examples-jsonld/SKILL.md
@@ -84,10 +84,15 @@ If an example has several roots, the sync step writes one example per root, each
 Put a Turtle file at `_sources/spec-examples/closures/.ttl`. A file named
 `.ttl` applies to every root of a multi-root example. The sync step adds it as the example
 snippet's `shacl-closure`. It is then used in two places:
-- the postprocessor adds it to the data when validating the Turtle example;
+- the postprocessor adds it to the data when validating the Turtle example, and when validating
+  the transform output against the target profile;
 - the transform reads it from the transform context (`snippet['shacl-closure']`, resolved
-  against the block directory) and applies SOSA collection rule 2 (see below). This works with
-  the published postprocessor; no closure pass-through to output validation is needed.
+  against the block directory) and applies SOSA collection rule 2 (see below), so the output is
+  complete without it.
+
+Because the closure is also added to the transform output, its collections must be valid without
+the example resources that the output leaves out. If a closure collection's members supply a value
+the collection needs (e.g. observedProperty), give the collection those members' values too.
 
 **Inheriting missing values from containing collections.** A closure supplies an example's
 missing execution properties by putting the executions (or the example's own collections) in a
diff --git a/_sources/spec-examples/closures/dht22.ttl b/_sources/spec-examples/closures/dht22.ttl
index 222d8301..c7c7ef54 100644
--- a/_sources/spec-examples/closures/dht22.ttl
+++ b/_sources/spec-examples/closures/dht22.ttl
@@ -3,6 +3,7 @@
 @prefix xsd:  .
 @prefix closure:  .
 @prefix ex:  .
+@prefix et:  .
 
 # SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
 # supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
@@ -16,7 +17,10 @@ closure:dht22-characteristics a sosa:ObservationCollection ;
         ex:DHT22_4578_TemperatureSensorNormalOperatingConditions,
         ex:DHT22_4578_TemperatureSensorCapabilities, ex:DHT22_4578_HumiditySensorCapabilities .
 
+# (its observedProperty is its member's: it makes it complete where the member isn't present,
+# e.g. in a transform output's validation)
 closure:dht22-observations a sosa:ObservationCollection ;
     sosa:hasFeatureOfInterest closure:dht22-ambient-air ;
+    sosa:observedProperty et:23 ;
     sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
     sosa:hasMember ex:observation_1087 .
diff --git a/_sources/spec-examples/closures/ip68.ttl b/_sources/spec-examples/closures/ip68.ttl
index 900033e6..f776617d 100644
--- a/_sources/spec-examples/closures/ip68.ttl
+++ b/_sources/spec-examples/closures/ip68.ttl
@@ -3,14 +3,21 @@
 @prefix xsd:  .
 @prefix closure:  .
 @prefix ex:  .
+@prefix sosa-cap:  .
+@prefix sosa-env:  .
 
 # SHACL closure (not part of the SOSA example): puts the example's executions in a collection that
 # supplies the values they leave out, which they inherit by SOSA collection rule 2. closure: IRIs
 # and the 2017-01-01 time are placeholders.
 
 # the sensor model's operating range and capabilities describe the sensor
+# (its observedProperty values are its members': they make it complete where the members aren't
+# present, e.g. in a transform output's validation)
 closure:ip68-characteristics a sosa:ObservationCollection ;
     sosa:hasFeatureOfInterest ex:Sensor_SL-T-P1 ;
+    sosa:observedProperty sosa-env:MinAmbientTemperature, sosa-env:MaxAmbientTemperature,
+        sosa-cap:RFSensitivity, sosa-cap:TemperatureAccuracy, sosa-cap:TemperatureResolution,
+        sosa-cap:BatteryResolution ;
     sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
     sosa:hasMember ex:IP68_Outdoor_Temperature_Sensor_operatingRange,
         ex:IP68_Outdoor_Temperature_Sensor_systemCapability .

From b5e2e235e619d67c509c177d2a10ab92fabb5fc1 Mon Sep 17 00:00:00 2001
From: Rob Atkinson 
Date: Wed, 21 Oct 2026 22:26:31 +1100
Subject: [PATCH 11/11] Drop closure and example for apartment-134's stray
 Observation_235754

w3c/sdw-sosa-ssn#561 removes Observation_235754 from the spec example, so
its closure collection and root example are no longer needed.

Co-Authored-By: Claude Opus 5.5 
---
 _sources/spec-examples/closures/apartment-134.ttl |  7 +------
 _sources/spec-examples/observations/examples.yaml | 10 ----------
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/_sources/spec-examples/closures/apartment-134.ttl b/_sources/spec-examples/closures/apartment-134.ttl
index d680c05b..0bc017c1 100644
--- a/_sources/spec-examples/closures/apartment-134.ttl
+++ b/_sources/spec-examples/closures/apartment-134.ttl
@@ -12,12 +12,7 @@
 closure:apartment-134-electricity a sosa:ObservationCollection ;
     sosa:hasFeatureOfInterest closure:Apartment_134 ;
     sosa:observedProperty ex:Apartment_134_electricConsumption ;
-    sosa:hasMember ex:Observation_235714, ex:Observation_235754 .
-
-# a time for Observation_235754 only (Observation_235714 has its own)
-closure:apartment-134-electricity-235754 a sosa:ObservationCollection ;
-    sosa:resultTime "2017-01-01T00:00:00Z"^^xsd:dateTime ;
-    sosa:hasMember ex:Observation_235754 .
+    sosa:hasMember ex:Observation_235714 .
 
 closure:apartment-134-window a sosa:ActuationCollection ;
     sosa:hasFeatureOfInterest ex:window ;
diff --git a/_sources/spec-examples/observations/examples.yaml b/_sources/spec-examples/observations/examples.yaml
index dc93c43c..f542a3c8 100644
--- a/_sources/spec-examples/observations/examples.yaml
+++ b/_sources/spec-examples/observations/examples.yaml
@@ -169,16 +169,6 @@ examples:
     ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
     shacl-closure:
     - ../closures/apartment-134.ttl
-- title: Example apartment-134.ttl (root Observation_235754)
-  content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
-    Source: [apartment-134.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl)'
-  base-output-filename: apartment-134--Observation_235754
-  x-root: https://example.org/data/Observation_235754
-  snippets:
-  - language: ttl
-    ref: https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/apartment-134.ttl
-    shacl-closure:
-    - ../closures/apartment-134.ttl
 - title: Example iphone_barometer-sosa.ttl (root Observation_346344)
   content: 'Example referenced from the SOSA/SSN specification section(s): [CompleteExamples](https://w3c.github.io/sdw-sosa-ssn/ssn/).
     Source: [iphone_barometer-sosa.ttl](https://w3c.github.io/sdw-sosa-ssn/ssn/rdf/examples/iphone_barometer-sosa.ttl)'