Worked Examples

Developer reference for knowledge graph exploration — Unified Discovery

Examine developer contracts for knowledge-graph exploration, including typed edges, provenance, versioned entities, traversal, and tenant-aware access controls.

ProductResearch LibrarianUpdatedNovember 14, 2026Reading time20 minutes

Application: Unified Discovery
Integration area: Knowledge Graph / Library / Research / Workspace
Reference classification: Developer Reference / Graph Contracts / Scientific Evidence Relationships
Audience: Backend developers, knowledge engineers, platform architects, scientific software engineers, security reviewers, and QA engineers
Technical level: Advanced
Reference technologies: JSON, Python 3, RDF concepts, provenance metadata, and graph-query patterns
Relevant specifications: RDF 1.1, SPARQL 1.1, W3C PROV-O, SHACL, HTTP Semantics, and OWASP API Security
Primary outputs: Graph schema, relationship contracts, evidence-resolution requirements, authorized traversal, validation tests, audit records, and production release gates
Estimated reading time: 17–22 minutes; 40–55 minutes including implementation and tests

1. Service responsibility

Knowledge graph exploration enables authorized users to navigate relationships among scientific and organizational research objects.

Relevant objects may include:

  • Publications and research sources.
  • Datasets and observations.
  • Scientific and analytical methods.
  • Analytical execution records.
  • Numerical and graphical results.
  • Scientific claims and their supporting evidence.
  • Research projects and workspaces.

The service must preserve the identity, semantics, provenance, evidence, and access restrictions of these relationships.

Primary technical acceptance condition: Relationship type, supporting evidence, and uncertainty must remain distinguishable throughout graph retrieval, traversal, presentation, export, and persistence.

A graph edge must not be generated or accepted merely because two objects share keywords, appear close together in an embedding space, or belong to the same project.

Computationally suggested relationships may be represented as candidates, but must remain separate from verified source assertions and independently reviewed scientific interpretations.

2. Establish the architecture and ownership boundaries

Before implementing graph operations, identify the actual owning service for each part of the graph lifecycle.

Table 1. Proposed service ownership map
Responsibility Proposed logical owner Verification required
Graph query and traversal Unified Discovery or an authorized graph service Actual graph-query implementation
Source identity Library Canonical source IDs and revisions
Dataset identity Library or governing data service Dataset ownership and version contract
Method identity Owning scientific application Method schema and version source
Analysis and result identity Workbench or owning analysis service Execution and artifact contracts
Project ownership Workspace or trusted project registry Authoritative owner mapping
Authentication and authorization Platform Core or deployed identity provider Trusted issuer and policy checks
Graph persistence Verified graph storage service Schema, storage engine, and revisions
Evidence and provenance Owning source and provenance services Actual evidence-reference contracts
Scientific review Research governance workflow Reviewer identity and accepted state
Public graph publication Research/public interface service Public projection and release controls

These are architectural responsibilities, not verified deployment assignments.

Do not introduce redundant databases or duplicate authoritative source records merely to support graph visualization.

Where possible, preserve references to objects owned by their existing application and manage graph-specific metadata separately.

3. Define the graph trust boundary

Scientific graph content may originate from external providers, imported metadata, analytical executions, human annotations, or automated extraction.

These inputs have different trust levels.

External source or internal research artifact
                  |
                  v
        Source identity resolution
                  |
                  v
          Trusted authorization
                  |
                  v
          Relationship validation
                  |
          +-------+--------+
          |                |
          v                v
   Asserted evidence   Inferred candidate
          |                |
          v                v
    Provenance check   Review required
          |                |
          +-------+--------+
                  |
                  v
         Versioned graph store
                  |
                  v
       Authorized graph traversal
                  |
                  v
     Evidence-aware UI or export

The client must not be allowed to assert that a relationship has been independently reviewed merely by setting a request field.

Trusted server-side controls must determine the authenticated actor, permission scope, accepted state transitions, and allowable public projection.

4. Define the graph object contract

Every graph node should identify its authoritative object and relevant revision.

Illustrative node representation:

{
  "schema_version": "example-1.0",
  "node_id": "dataset:D01:v1",
  "object_type": "dataset",
  "object_id": "D01",
  "object_revision": "v1",
  "owning_application": "library",
  "display_label": "Synthetic Observation Dataset",
  "tenant_scope": "synthetic-tenant",
  "visibility": "private",
  "source_reference": "synthetic-source-001",
  "review_status": "not_reviewed"
}

The local graph node ID and the authoritative research object ID are distinct.

A graph node does not necessarily own the source bytes, scientific method, or publication record it references.

4.1 Required node fields

Table 2. Proposed node contract
Field Requirement
node_id Unique graph identity
object_type Supported, versioned entity vocabulary
object_id Authoritative identifier in the owning application
object_revision Specific source or artifact version
owning_application Service responsible for object identity and lifecycle
tenant_scope Trusted authorization partition
visibility Governed access or public-disclosure state
source_reference Relevant source relationship, where applicable
review_status Actual, independently controlled review state

Additional fields may describe timestamps, content digests, licensing, geographic references, or other object-specific metadata.

Do not claim immutability merely because an object contains a revision string or checksum.

5. Define the relationship contract

Graph edges must preserve explicit relationship semantics and supporting evidence.

Illustrative edge:

{
  "schema_version": "example-1.0",
  "edge_id": "E04",
  "subject_node_id": "analysis:A01:v1",
  "predicate": "generated_result",
  "object_node_id": "result:R01:v1",
  "assertion_status": "asserted",
  "evidence": {
    "evidence_id": "execution-record-004",
    "evidence_revision": "v1"
  },
  "uncertainty": {
    "state": "not_quantified",
    "note": "Scientific result not independently reviewed"
  },
  "review_status": "not_reviewed",
  "visibility": "private"
}

The edge does not state that its result has been scientifically accepted.

5.1 Proposed relationship vocabulary

Table 3. Typed scientific relationships
Subject Predicate Object Meaning
Source describes_dataset Dataset Source describes an identified dataset
Source cites Source Source contains an actual reference to another source
Analysis used_dataset Dataset Analysis used the specific dataset revision
Analysis used_method Method Analysis used an identified method
Analysis generated_result Result Analysis generated a result artifact
Result supports_claim Claim Result has been presented as evidence for a claim
Result contradicts_claim Claim Result has been interpreted as conflicting evidence

These names are illustrative application predicates.

For an RDF implementation, select appropriate IRIs and define formal ontology mappings. W3C PROV-O already defines standard provenance relations; use them when their semantics are applicable.

For an RDF graph, subject, predicate, and object form a triple. Graph implementations may additionally represent named graphs or evidence records to preserve assertion context. A database edge ID is not, by itself, a standardized RDF provenance mechanism.

6. Separate graph structure from evidence validity

Graph validation should distinguish three independent checks:

  1. Structural validation: Nodes, relationship endpoints, and fields conform to the schema.
  2. Evidence validation: Supporting evidence resolves to the intended object and actually supports the relationship.
  3. Scientific validation: The relationship and any resulting inference are justified by the relevant research methods and observations.

Passing the first check does not imply that the others have passed.

SHACL provides a constraint language for RDF graphs. Its validation model can help enforce graph structure, cardinality, and value constraints.

SHACL conformance is not equivalent to scientific truth or completeness.

7. Define relationship assertion states

The graph service should distinguish operational and epistemic states.

Table 4. Proposed assertion-state contract
State Meaning Allowed use
asserted Explicitly recorded relationship with an identified evidence basis Evidence-backed exploration, subject to validation
derived Relationship produced by a documented rule Exploration with derivation provenance
inferred_candidate Possible relationship suggested by computation Discovery and review, not accepted scientific assertion
disputed Relationship or interpretation has conflicting assessments Displayed with disputes and evidence
rejected Relationship failed review or verification Audit and review history; excluded from accepted traversal

The asserted state should not be confused with scientifically_approved.

Scientific acceptance must be represented through a distinct, authorized review process.

8. Define uncertainty and evidence contracts

Every material scientific relationship should permit uncertainty and interpretation caveats to be recorded.

A proposed uncertainty object could contain:

{
  "uncertainty": {
    "category": "interpretive",
    "state": "not_quantified",
    "method": null,
    "value": null,
    "unit": null,
    "description": "Claim interpretation not independently reviewed"
  }
}

Distinguish:

  • Measurement uncertainty.
  • Statistical uncertainty.
  • Model uncertainty.
  • Relationship-extraction uncertainty.
  • Provenance uncertainty.
  • Scientific interpretation uncertainty.

A classifier score or embedding similarity should not be labeled as a scientific confidence probability unless appropriately calibrated and justified.

Evidence references should resolve through the owning source or analytical application, preserving the exact object revision and access restrictions.

9. Define a proposed graph traversal API

The following endpoint is illustrative and must be replaced with the actual deployed interface after repository inspection.

POST /api/example/v1/graph/traverse

9.1 Example request

{
  "schema_version": "example-1.0",
  "graph_revision": "graph-snapshot-v1",
  "start_node_id": "analysis:A01:v1",
  "max_depth": 2,
  "relationship_types": [
    "used_dataset",
    "used_method",
    "generated_result"
  ],
  "include_inferred_candidates": false,
  "max_nodes": 100,
  "max_edges": 200
}

Tenant identity and access permissions must be derived from trusted authentication, not accepted from client-supplied claims.

9.2 Example response

{
  "schema_version": "example-1.0",
  "graph_revision": "graph-snapshot-v1",
  "start_node_id": "analysis:A01:v1",
  "nodes": [
    {
      "node_id": "analysis:A01:v1",
      "object_type": "analysis"
    },
    {
      "node_id": "dataset:D01:v1",
      "object_type": "dataset"
    }
  ],
  "edges": [
    {
      "edge_id": "E02",
      "subject_node_id": "analysis:A01:v1",
      "predicate": "used_dataset",
      "object_node_id": "dataset:D01:v1",
      "assertion_status": "asserted",
      "evidence_id": "EV02",
      "uncertainty_state": "not_quantified"
    }
  ],
  "truncated": false,
  "next_cursor": null,
  "scientific_review": "not_evaluated"
}

The response should identify the graph revision and communicate any limits or incomplete results.

A truncated traversal must not be represented as a complete set of scientific relationships.

10. Define traversal semantics

Traversal behavior must specify:

  • Whether edges are directed.
  • Whether reverse traversal is supported.
  • Which relationship types may be followed.
  • How cycles and repeated nodes are handled.
  • How graph snapshots are selected.
  • How inferred and disputed edges are filtered.
  • Which authorization checks apply.
  • How result limits and pagination work.
  • How incomplete provider or evidence resolution is disclosed.

For scientific provenance, an inverse traversal such as “find analyses that used dataset D01” must preserve the semantics of the original directed relationship.

Do not invent a new inverse assertion when a query can simply traverse a recorded edge in reverse.

SPARQL 1.1 supports graph-pattern and property-path queries, but it does not automatically enforce application-specific tenant permissions, scientific review, or resource quotas.

11. Bound graph queries

Graph queries can consume substantial compute and memory, particularly when traversal expands through high-degree nodes or cycles.

Required controls should include:

  • Maximum traversal depth.
  • Maximum returned nodes and edges.
  • Query execution timeout.
  • Server-side cancellation.
  • Pagination or cursor-based continuation.
  • Tenant and project scoping.
  • Permitted predicate filters.
  • Rate limits and query quotas.
  • Stable snapshot or consistency semantics.
  • Sanitized query diagnostics.

Arbitrary client-supplied graph queries may require additional restrictions or a curated query interface.

OWASP API Security identifies unrestricted resource consumption as an important API risk.

12. Enforce node, edge, and evidence authorization

Graph authorization must cover more than node content.

The existence of an edge may reveal that a private project used a restricted dataset.

Apply authorization to:

  • Node existence and properties.
  • Edge existence and properties.
  • Evidence identifiers and content.
  • Graph traversal results.
  • Source and project associations.
  • Counts and aggregate statistics.
  • Graph snapshots and saved views.
  • Public exports and API projections.

Do not rely on hiding graph elements in a frontend visualization.

Access controls should be applied during graph query evaluation and before constructing the response.

Unauthorized objects must not appear in result metadata, hidden fields, edge counts, error details, or downloadable exports unless a separate approved disclosure policy explicitly permits the information.

13. Define relationship mutation and approval boundaries

Graph exploration is primarily a read operation.

Creating or modifying relationships is a separate, governed capability.

A proposed mutation workflow is:

Relationship proposal
        |
        v
Schema and endpoint validation
        |
        v
Trusted authorization
        |
        v
Evidence resolution
        |
        v
Revision consistency
        |
        v
Draft assertion
        |
        v
Scientific or governance review
        |
        v
Accepted relationship revision

Do not permit a generic traversal request to create permanent scientific relationships.

For writes, define:

  • Expected graph revision.
  • Source and object revision preconditions.
  • Relationship uniqueness rules.
  • Request idempotency.
  • Authorized state transitions.
  • Auditable actor and reviewer records.
  • Rollback or compensating-operation behavior.

Publication authorization remains separate from graph relationship acceptance.

14. Define typed failures

Table 5. Proposed graph API error taxonomy
Code Meaning Safe response
GRAPH_NOT_FOUND Requested graph does not exist or cannot be disclosed Verify authorized identifier
NODE_NOT_ACCESSIBLE Requested node unavailable under current permissions Do not disclose private metadata
EDGE_NOT_ACCESSIBLE Relationship cannot be returned to the caller Apply access-control policy
EVIDENCE_NOT_RESOLVED Required evidence cannot be located Reject acceptance or return an explicit limitation
EVIDENCE_ACCESS_DENIED Evidence is restricted Do not bypass permissions
INVALID_RELATIONSHIP_TYPE Predicate or endpoint types conflict with schema Reject invalid relationship
GRAPH_REVISION_CONFLICT Selected graph version is stale or incompatible Preserve original state and resolve revision
QUERY_LIMIT_EXCEEDED Requested traversal exceeds bounded limits Reduce permitted scope
SCHEMA_INVALID Request is incomplete or malformed Correct request contract
ASSERTION_STATE_CONFLICT Proposed relationship transition is not permitted Use defined review workflow
IDEMPOTENCY_CONFLICT Existing mutation key reused with different request Reconcile original operation
DEPENDENCY_UNAVAILABLE Owning source or evidence service unavailable Preserve state and use bounded recovery

Actual HTTP status mappings and error schemas must be determined from the implemented API.

Problem Details for HTTP APIs (RFC 9457) provides a standard representation that may be used for typed failures.

15. Implement a synthetic graph contract

The following Python example provides a deterministic reference model with explicit evidence and uncertainty fields.

It does not require network access or third-party packages.

15.1 Prepare the environment

mkdir graph-developer-contract
cd graph-developer-contract

python3 -m venv .venv
source .venv/bin/activate

python --version

Save as graph_contract.py.

from dataclasses import dataclass
from collections import deque
import json


@dataclass(frozen=True)
class Node:
    node_id: str
    kind: str
    revision: str
    tenant: str


@dataclass(frozen=True)
class Evidence:
    evidence_id: str
    owner_node_id: str
    revision: str
    tenant: str


@dataclass(frozen=True)
class Edge:
    edge_id: str
    subject: str
    predicate: str
    object_id: str
    evidence_id: str
    status: str
    uncertainty: str


TENANT = "synthetic-tenant"

NODES = (
    Node("S01", "source", "v1", TENANT),
    Node("D01", "dataset", "v1", TENANT),
    Node("M01", "method", "v1", TENANT),
    Node("A01", "analysis", "v1", TENANT),
    Node("R01", "result", "v1", TENANT),
    Node("C01", "claim", "v1", TENANT)
)

EVIDENCE = (
    Evidence("EV01", "S01", "v1", TENANT),
    Evidence("EV02", "A01", "v1", TENANT),
    Evidence("EV03", "A01", "v1", TENANT),
    Evidence("EV04", "A01", "v1", TENANT),
    Evidence("EV05", "R01", "v1", TENANT)
)

EDGES = (
    Edge(
        "E01", "S01", "describes_dataset",
        "D01", "EV01", "asserted",
        "Source description not independently reviewed"
    ),
    Edge(
        "E02", "A01", "used_dataset",
        "D01", "EV02", "asserted",
        "Synthetic execution record"
    ),
    Edge(
        "E03", "A01", "used_method",
        "M01", "EV03", "asserted",
        "Method not scientifically reviewed"
    ),
    Edge(
        "E04", "A01", "generated_result",
        "R01", "EV04", "asserted",
        "Result not independently verified"
    ),
    Edge(
        "E05", "R01", "supports_claim",
        "C01", "EV05", "asserted",
        "Interpretation not independently reviewed"
    )
)


ALLOWED = {
    ("source", "describes_dataset", "dataset"),
    ("analysis", "used_dataset", "dataset"),
    ("analysis", "used_method", "method"),
    ("analysis", "generated_result", "result"),
    ("result", "supports_claim", "claim")
}

STATUSES = {
    "asserted",
    "derived",
    "inferred_candidate",
    "disputed",
    "rejected"
}


class GraphError(Exception):
    def __init__(self, code):
        super().__init__(code)
        self.code = code


def index_unique(items, key):
    indexed = {
        getattr(item, key): item
        for item in items
    }

    if len(indexed) != len(items):
        raise GraphError("DUPLICATE_ID")

    return indexed


def validate_graph(nodes, edges, evidence):
    node_map = index_unique(
        nodes, "node_id"
    )
    edge_map = index_unique(
        edges, "edge_id"
    )
    evidence_map = index_unique(
        evidence, "evidence_id"
    )

    for edge in edge_map.values():
        subject = node_map.get(edge.subject)
        target = node_map.get(edge.object_id)

        if subject is None or target is None:
            raise GraphError("DANGLING_EDGE")

        if subject.tenant != target.tenant:
            raise GraphError("CROSS_TENANT_EDGE")

        triple = (
            subject.kind,
            edge.predicate,
            target.kind
        )

        if triple not in ALLOWED:
            raise GraphError(
                "INVALID_RELATIONSHIP_TYPE"
            )

        if edge.status not in STATUSES:
            raise GraphError("INVALID_STATUS")

        proof = evidence_map.get(
            edge.evidence_id
        )

        if proof is None:
            raise GraphError(
                "EVIDENCE_NOT_RESOLVED"
            )

        owner = node_map.get(
            proof.owner_node_id
        )

        if owner is None:
            raise GraphError(
                "EVIDENCE_OWNER_MISSING"
            )

        if (
            proof.tenant != subject.tenant
            or owner.tenant != subject.tenant
        ):
            raise GraphError(
                "EVIDENCE_SCOPE_MISMATCH"
            )

        if proof.revision != owner.revision:
            raise GraphError(
                "STALE_EVIDENCE_REVISION"
            )

        if not edge.uncertainty.strip():
            raise GraphError(
                "UNCERTAINTY_UNDISCLOSED"
            )

    return True


def traverse(
    nodes,
    edges,
    evidence,
    start_id,
    tenant,
    max_depth=2,
    max_edges=50
):
    validate_graph(nodes, edges, evidence)

    if (
        isinstance(max_depth, bool)
        or not isinstance(max_depth, int)
        or not 0 <= max_depth <= 5
    ):
        raise GraphError("INVALID_DEPTH")

    if (
        isinstance(max_edges, bool)
        or not isinstance(max_edges, int)
        or not 1 <= max_edges <= 100
    ):
        raise GraphError("INVALID_EDGE_LIMIT")

    node_map = {
        node.node_id: node
        for node in nodes
    }

    start = node_map.get(start_id)

    if start is None or start.tenant != tenant:
        raise GraphError("NODE_NOT_ACCESSIBLE")

    by_subject = {}

    for edge in edges:
        by_subject.setdefault(
            edge.subject, []
        ).append(edge)

    queue = deque([(start_id, 0)])
    visited = {start_id}
    results = []

    while queue:
        current, depth = queue.popleft()

        if depth >= max_depth:
            continue

        candidates = sorted(
            by_subject.get(current, []),
            key=lambda edge: edge.edge_id
        )

        for edge in candidates:
            if edge.status != "asserted":
                continue

            target = node_map[edge.object_id]

            if target.tenant != tenant:
                continue

            if len(results) >= max_edges:
                return {
                    "edges": results,
                    "truncated": True
                }

            results.append({
                "edge_id": edge.edge_id,
                "predicate": edge.predicate,
                "subject": edge.subject,
                "object": edge.object_id,
                "evidence_id": edge.evidence_id,
                "uncertainty": edge.uncertainty,
                "status": edge.status
            })

            if edge.object_id not in visited:
                visited.add(edge.object_id)
                queue.append((
                    edge.object_id,
                    depth + 1
                ))

    return {
        "edges": results,
        "truncated": False
    }


def main():
    result = traverse(
        NODES,
        EDGES,
        EVIDENCE,
        "A01",
        TENANT,
        max_depth=3
    )

    print(json.dumps({
        "classification": "synthetic",
        "graph_revision": "fixture-v1",
        "traversal": result,
        "evidence_content_verified": False,
        "trusted_authorization": "not_tested",
        "database_persistence": "not_tested",
        "scientific_review": "not_tested",
        "production_acceptance": "not_tested"
    }, indent=2))


if __name__ == "__main__":
    main()

The reference implementation enforces selected structural invariants, including relationship types, evidence identifiers, fixture tenant consistency, source revisions, uncertainty disclosure, and bounded traversal.

It deliberately does not perform real authentication, authorization, persistent storage, scientific evidence-content verification, RDF validation, or HTTP requests.

The tenant field is part of a synthetic fixture, not a trusted identity mechanism.

16. Execute the reference traversal

python graph_contract.py

Expected traversal from A01:

A01 --used_dataset--> D01

A01 --used_method--> M01

A01 --generated_result--> R01

R01 --supports_claim--> C01

The result retains edge IDs, evidence references, assertion status, and uncertainty text.

The graph does not invent new edges between objects. It returns existing asserted relationships under the reference traversal rules.

For production, additional verification is needed to ensure that accepted asserted edges have actually passed the applicable evidence and review checks.

17. Implement regression and negative tests

Save as test_graph_contract.py.

from dataclasses import replace
import unittest

from graph_contract import (
    NODES, EDGES, EVIDENCE, TENANT,
    GraphError,
    validate_graph,
    traverse
)


class GraphContractTests(unittest.TestCase):

    def assert_code(self, code, action):
        with self.assertRaises(
            GraphError
        ) as caught:
            action()

        self.assertEqual(
            caught.exception.code,
            code
        )

    def test_valid_graph(self):
        self.assertTrue(
            validate_graph(
                NODES, EDGES, EVIDENCE
            )
        )

    def test_expected_traversal(self):
        result = traverse(
            NODES, EDGES, EVIDENCE,
            "A01", TENANT, 3
        )

        self.assertEqual(
            [
                edge["edge_id"]
                for edge in result["edges"]
            ],
            ["E02", "E03", "E04", "E05"]
        )

    def test_missing_node(self):
        self.assert_code(
            "NODE_NOT_ACCESSIBLE",
            lambda: traverse(
                NODES, EDGES, EVIDENCE,
                "UNKNOWN", TENANT
            )
        )

    def test_wrong_tenant(self):
        self.assert_code(
            "NODE_NOT_ACCESSIBLE",
            lambda: traverse(
                NODES, EDGES, EVIDENCE,
                "A01", "other-tenant"
            )
        )

    def test_invalid_relation(self):
        changed = list(EDGES)
        changed[0] = replace(
            changed[0],
            predicate="proves"
        )

        self.assert_code(
            "INVALID_RELATIONSHIP_TYPE",
            lambda: validate_graph(
                NODES, tuple(changed), EVIDENCE
            )
        )

    def test_missing_evidence(self):
        changed = list(EDGES)
        changed[0] = replace(
            changed[0],
            evidence_id="missing"
        )

        self.assert_code(
            "EVIDENCE_NOT_RESOLVED",
            lambda: validate_graph(
                NODES, tuple(changed), EVIDENCE
            )
        )

    def test_stale_evidence(self):
        changed = list(EVIDENCE)
        changed[0] = replace(
            changed[0],
            revision="old"
        )

        self.assert_code(
            "STALE_EVIDENCE_REVISION",
            lambda: validate_graph(
                NODES, EDGES, tuple(changed)
            )
        )

    def test_uncertainty_missing(self):
        changed = list(EDGES)
        changed[0] = replace(
            changed[0],
            uncertainty=""
        )

        self.assert_code(
            "UNCERTAINTY_UNDISCLOSED",
            lambda: validate_graph(
                NODES, tuple(changed), EVIDENCE
            )
        )

    def test_inferred_candidate_excluded(self):
        changed = list(EDGES)
        changed[0] = replace(
            changed[0],
            status="inferred_candidate"
        )

        result = traverse(
            NODES, tuple(changed), EVIDENCE,
            "S01", TENANT
        )

        self.assertEqual(
            result["edges"], []
        )

    def test_depth_limit(self):
        self.assert_code(
            "INVALID_DEPTH",
            lambda: traverse(
                NODES, EDGES, EVIDENCE,
                "A01", TENANT,
                max_depth=99
            )
        )

    def test_edge_limit(self):
        result = traverse(
            NODES, EDGES, EVIDENCE,
            "A01", TENANT,
            max_edges=2
        )

        self.assertTrue(result["truncated"])
        self.assertEqual(
            len(result["edges"]), 2
        )

    def test_duplicate_edge(self):
        self.assert_code(
            "DUPLICATE_ID",
            lambda: validate_graph(
                NODES,
                EDGES + (EDGES[0],),
                EVIDENCE
            )
        )

    def test_cross_tenant_edge(self):
        changed = list(NODES)
        changed[1] = replace(
            changed[1],
            tenant="other-tenant"
        )

        self.assert_code(
            "CROSS_TENANT_EDGE",
            lambda: validate_graph(
                tuple(changed),
                EDGES,
                EVIDENCE
            )
        )


if __name__ == "__main__":
    unittest.main()

18. Run the test suite

python -m unittest -v test_graph_contract.py

The reference suite defines thirteen tests.

It covers:

  • Valid graph structure.
  • Expected traversal order.
  • Missing-node handling.
  • Tenant-scope rejection.
  • Invalid relationship types.
  • Missing evidence references.
  • Stale evidence revisions.
  • Missing uncertainty disclosure.
  • Exclusion of inferred candidates.
  • Traversal depth limits.
  • Truncation at edge limits.
  • Duplicate relationship identifiers.
  • Cross-tenant edges.

These are provided reference tests, not verified production or CI results.

Even when executed successfully, they cannot establish that the graph service correctly enforces real identity, scientific evidence sufficiency, or database persistence.

19. Required production security and integration tests

Table 6. Production graph integration test matrix
Scenario Expected outcome Evidence environment
Valid authorized traversal Correct graph snapshot and evidence returned Authenticated staging
Missing starting node Typed error without private information disclosure API integration tests
Wrong tenant Protected nodes and relationships not exposed Two synthetic identities
Revoked access Previously accessible nodes and edges no longer disclosed Trusted authorization tests
Restricted evidence Evidence metadata and content follow policy Cross-owner negative tests
Stale source revision Version conflict or historical snapshot identified Versioned source fixture
Incorrect predicate Schema validation rejects relationship Graph contract tests
Missing evidence Relationship cannot be accepted as verified Evidence resolver tests
Inferred relationship Clearly separated from accepted evidence Review-state tests
Query exhaustion Traversal terminated under configured limits Performance staging
Graph cycles Bounded, predictable traversal Golden graph fixture
Duplicate mutation Correct idempotency behavior Concurrent transaction tests
Publication attempt Unreviewed graph relationships not silently approved Governance tests
Private export No unauthorized nodes, edges, or aggregate information Public API security tests
Database failure No falsely committed graph revision Disposable storage
Migration and restore Graph and source revision consistency preserved Restorable staging

Actual tests should use authorized disposable data and independent test identities.

Do not run destructive graph mutation tests against production research data without explicit approval and tested recovery controls.

20. Define graph persistence and revision integrity

A production knowledge graph requires explicit storage and revision semantics.

Determine whether the actual implementation uses:

  • A relational graph model.
  • A dedicated graph database.
  • An RDF dataset or triple store.
  • A materialized projection from Library and research sources.
  • A hybrid design.

The storage engine should be selected based on verified platform requirements and existing infrastructure, not merely because a graph viewer is being built.

Preserve relationships to source revisions even when the originating research objects change.

For accepted scientific outputs, record the graph revision or reproducible source state used during analysis.

A graph update must not silently revise already published evidence relationships.

21. Define mutation idempotency and transaction handling

Graph writes may create or update nodes, edges, provenance, and review records.

The implementation must distinguish:

  • An exact retry of a previously committed graph mutation.
  • A request using the same idempotency key with changed content.
  • A legitimate new relationship revision.
  • Two concurrent attempts to create the same relationship.
  • An operation whose commit state is unknown.

Use transactional uniqueness constraints and trusted operation records where applicable.

For cross-service updates, record the last durable state and define recovery or compensating operations.

Never assume that a successful frontend interaction establishes that all required graph and provenance records committed atomically.

22. Define audit and observability requirements

Graph operations should produce meaningful, sanitized audit events.

Table 7. Proposed audit events
Event Meaning
graph.traversal.requested Authorized exploration initiated
graph.traversal.completed Result returned with limits and revision
graph.traversal.denied Access restriction enforced
graph.evidence.resolved Referenced evidence identity verified
graph.edge.proposed New relationship candidate submitted
graph.edge.validated Technical relationship checks completed
graph.edge.reviewed Authorized review outcome recorded
graph.revision.committed New graph revision persisted
graph.recovery.required Partial failure needs reconciliation

Record code revision, graph revision, operation ID, relevant object references, and sanitized error classes where appropriate.

Do not log confidential node properties, private source content, bearer tokens, or sensitive query parameters.

23. Provide an accessible exploration interface

A network diagram alone does not provide a complete scientific exploration interface.

The application should offer:

  • Node identity and source revision details.
  • Relationship type and direction.
  • Evidence and provenance references.
  • Assertion and review status.
  • Scientific caveats and uncertainty.
  • Graph revision information.
  • Accessible node and relationship tables.
  • Keyboard-operable navigation where interactive controls are provided.
  • Clear indications when results are truncated.
  • Authorized export of the visible graph state.

Visual distance, node size, or graph centrality should not automatically imply scientific confidence or credibility.

Accessibility should be tested against the actual interface using applicable WCAG criteria.

24. Proposed machine-readable acceptance receipt

Release evidence should identify the exact implementation and tested environment.

{
  "schema_version": "example-1.0",
  "capability": "unified_discovery_knowledge_graph",
  "classification": "proposed_contract",
  "implementation": {
    "owning_repository": null,
    "commit": null,
    "schema_revision": null,
    "api_contract_revision": null,
    "deployed_image_digest": null
  },
  "graph": {
    "graph_id": "synthetic-graph",
    "revision": "fixture-v1",
    "node_count": 6,
    "edge_count": 5
  },
  "acceptance": {
    "node_identity": "not_tested",
    "edge_semantics": "not_tested",
    "evidence_resolution": "not_tested",
    "uncertainty_preservation": "not_tested",
    "trusted_authorization": "not_tested",
    "cross_tenant_isolation": "not_tested",
    "traversal_limits": "not_tested",
    "revision_integrity": "not_tested",
    "mutation_idempotency": "not_tested",
    "database_persistence": "not_tested",
    "migration_recovery": "not_tested",
    "browser_acceptance": "not_tested",
    "scientific_review": "not_tested"
  },
  "publication_approval": false,
  "release_decision": "NO_GO"
}

Replace placeholder values only with actual implementation and execution evidence.

A synthetic test receipt must not be presented as production acceptance by altering its classification or status fields.

25. Sustainable Catalyst integration architecture

Knowledge graph exploration should connect research objects across applications without duplicating ownership of their underlying scientific records.

Table 8. Proposed application integration
Application Intended contribution
Unified Discovery Locate and traverse authorized graph relationships
Library Maintain authoritative sources, datasets, metadata, rights, and citations
Research Lab Assess methods, uncertainty, scientific quality, and interpretations
Workbench Produce reproducible analyses, outputs, and dependency references
Site Intelligence Provide geospatial source, location, observation, and imagery relationships
Decision Studio Represent model, scenario, and decision-evidence relationships
Workspace Manage ownership, graph review, source relationships, and approved project context
Research Publish accepted evidence-backed research outputs and graph references
Platform Core Enforce trusted identity, authorization, and organizational boundaries

The actual implementation may combine some of these responsibilities within fewer services.

Verify the owning system for each object and relationship before introducing new storage or APIs.

26. Repository and deployment verification

Before promoting this developer reference to a verified implementation guide, inspect:

  • Actual graph service and owning repository.
  • Exact implementation commit and relevant source paths.
  • Node and edge schemas.
  • Actual relationship vocabulary.
  • Evidence resolver and provenance data model.
  • Graph revision and snapshot semantics.
  • Actual traversal and mutation endpoints.
  • Trusted authentication and tenant authorization.
  • Cross-owner evidence restrictions.
  • Query limits and resource controls.
  • Storage transactions and uniqueness constraints.
  • Idempotency and concurrent mutation behavior.
  • Database migrations and recovery plan.
  • Executed unit, integration, and negative tests.
  • Browser graph exploration acceptance.
  • Accessible tabular alternatives.
  • Scientific and publication-review boundaries.
  • Known defects, disabled features, and unresolved dependencies.

Use exact repository links, commits, CI receipts, staging build identifiers, and authenticated runtime observations.

Do not infer a supported endpoint merely because a graph-related UI control or repository directory exists.

27. Technical acceptance and release gates

Table 9. Required graph release gates
Gate Required evidence Failure consequence
Implementation identity Repository, commit, deployed revision NO-GO
Schema compatibility Node, edge, and evidence contract tests NO-GO
Source identity Authoritative object resolution NO-GO
Relationship semantics Allowed predicates and endpoint validation NO-GO
Evidence integrity Source and evidence references verified NO-GO for accepted evidence
Uncertainty Uncertainty and review states preserved NO-GO for scientific evidence presentation
Authorization Trusted tenant and object-level permissions NO-GO
Query safety Bounds, cancellation, rate limits, and isolation NO-GO
Revision integrity Consistent graph snapshots and source versions NO-GO
Mutation safety Idempotency, transaction, and negative tests where writes are enabled NO-GO for writes
Persistence and recovery Durable storage and tested recovery NO-GO for persistent features
Browser and accessibility Verified interface behavior and accessible alternatives NO-GO for public UI release
Scientific publication Independent review and publication authorization Not approved for public release

A read-only graph exploration candidate may be evaluated separately from relationship mutation capabilities. Do not treat acceptance of one as acceptance of the other.

28. Technical references

  1. World Wide Web Consortium (W3C) (2014). RDF 1.1 Concepts and Abstract Syntax. Available at: W3C RDF 1.1.
  2. World Wide Web Consortium (W3C) (2013). SPARQL 1.1 Query Language. Available at: W3C SPARQL.
  3. World Wide Web Consortium (W3C) (2013). PROV-O: The PROV Ontology. Available at: W3C PROV-O.
  4. World Wide Web Consortium (W3C) (2017). Shapes Constraint Language (SHACL). Available at: W3C SHACL.
  5. Hogan, A. et al. (2021). ‘Knowledge Graphs’, ACM Computing Surveys, 54(4), Article 71. Available at: https://doi.org/10.1145/3447772.
  6. Wilkinson, M.D. et al. (2016). ‘The FAIR Guiding Principles for scientific data management and stewardship’, Scientific Data, 3, 160018. Available at: https://doi.org/10.1038/sdata.2016.18.
  7. Fielding, R., Nottingham, M. and Reschke, J. (2022). HTTP Semantics. RFC 9110. Available at: RFC 9110.
  8. Nottingham, M., Wilde, E. and Dalal, S. (2023). Problem Details for HTTP APIs. RFC 9457. Available at: RFC 9457.
  9. OWASP Foundation (2023). API Security Top 10. Available at: OWASP API Security.
  10. Python Software Foundation (n.d.). unittest — Unit Testing Framework. Available at: Python documentation.
  11. World Wide Web Consortium (W3C) (2024). Web Content Accessibility Guidelines (WCAG) 2.2. Available at: WCAG 2.2.

29. Developer completion and verification record

Table 10. Knowledge graph developer acceptance record
Field Required record
Capability identifier Actual service or integration designation
Repository and commit Exact implementation identity
Source location Actual modules, graph handlers, and contracts
API revision Real request, response, and error schemas
Graph schema Actual node, edge, and evidence definitions
Relationship vocabulary Approved predicates and semantic constraints
Evidence resolution Pass, Fail, or Not Tested
Uncertainty preservation Pass, Fail, or Not Tested
Provenance Pass, Fail, or Not Tested
Trusted authorization Pass, Fail, or Not Tested
Cross-tenant isolation Pass, Fail, or Not Tested
Traversal safety Depth, size, time, and cancellation tests
Persistence Actual graph storage and revision evidence
Mutation idempotency Replay and concurrency evidence, if applicable
Migrations Schema revision and rollback or recovery plan
CI Executed test suite and associated commit
Staging Deployed image/build and environment evidence
Browser acceptance Authenticated graph exploration and accessibility evidence
Scientific review Actual acceptance of scientific interpretation
Publication approval Separate approved public release decision
Outstanding limitations Known unsupported capabilities, defects, or unresolved risks

Technical completion criterion: Knowledge graph exploration is implementation-verified when the deployed service resolves authorized, versioned research objects; traverses correctly typed and evidence-associated relationships; preserves uncertainty and assertion status; enforces access restrictions; limits resource consumption; and demonstrates consistency, persistence, and recovery through executed integration acceptance.

Scientific limitation: A technically valid edge, supporting evidence identifier, or provenance record does not independently demonstrate the truth of a scientific claim. Scientific validity depends on the quality and applicability of the underlying evidence, methods, uncertainty, and interpretation.

Current implementation status: Proposed graph architecture, ownership boundaries, versioned node and edge contracts, traversal API, evidence and uncertainty requirements, typed failures, synthetic Python reference implementation, regression tests, security and persistence requirements, and release gates documented. No specific Sustainable Catalyst Unified Discovery graph endpoint, persistent RDF store, graph database, inference engine, or public research integration is certified without repository inspection, executed integration tests, authenticated runtime evidence, and release approval.

Scroll to Top