Compile-Time Linked Data: Full W3C Closure From a Single CUE Value

Use Case Report for W3C Community Groups


Abstract

A single typed dependency graph, authored once in CUE, is projected into 13 W3C specification outputs, including JSON-LD, SHACL, SKOS, OWL-Time, PROV-O and ODRL, with no triplestore. For graphs past a few dozen nodes the dependency closure is precomputed by tools/toposort.py and CUE verifies and projects it. A 14th (Hydra) is implemented downstream.

This report documents the implementation, provides computed evidence from a live example graph, and lists the W3C Community Groups it relates to.

All evidence below is computed, not hand-written. Each JSON block is generated by cue export ./w3c/ -e evidence.<field>. Reproduce from source: github.com/quicue/apercue.

Problem Statement

The semantic web stack traditionally requires five or more runtime components: an RDF store, a SPARQL query engine, a SHACL processor, a serializer, and a query planner. Each introduces its own execution model, failure modes, and infrastructure requirements. Schema drift between layers is common.

For constrained domains (research data management, project plans, infrastructure topology, academic curricula) this operational complexity is disproportionate to the problem. These domains share a common structure: typed resources with directed acyclic dependency edges. They need standards-compliant output, not the full semantic web runtime.

Approach

apercue.ca implements a constraint-based alternative using CUE, a configuration language with lattice-theoretic type semantics. Resources declare two things: what they are (@type, a struct-as-set) and what they need (depends_on, also a struct-as-set):

"analysis-code": {
    name:       "analysis-code"
    "@type":    {Process: true}
    depends_on: {"sensor-dataset": true}
}

Everything else (topology, impact analysis, compliance, scheduling, and every W3C output) is a projection of this single value. cue export -e <expression> produces the target format.

Implementation Evidence

The inline example graph defines a 5-node research publication pipeline: ethics approval, sensor dataset, analysis code, draft paper, and peer review. This domain was chosen because W3C specifications map to their intended purposes: Dublin Core for publication metadata, PROV-O for dataset provenance, ODRL for data embargo policies, and OWL-Time for submission deadlines. This is the same #Graph pattern used in production deployments with 30+ nodes.

JSON-LD Context

All evidence blocks share this @context, which maps resource fields to standard W3C vocabularies:

{
    "@context": {
        "@base": "urn:resource:",
        "dcterms": "http://purl.org/dc/terms/",
        "prov": "http://www.w3.org/ns/prov#",
        "dcat": "http://www.w3.org/ns/dcat#",
        "sh": "http://www.w3.org/ns/shacl#",
        "skos": "http://www.w3.org/2004/02/skos/core#",
        "schema": "https://schema.org/",
        "time": "http://www.w3.org/2006/time#",
        "earl": "http://www.w3.org/ns/earl#",
        "odrl": "http://www.w3.org/ns/odrl/2/",
        "org": "http://www.w3.org/ns/org#",
        "cred": "https://www.w3.org/2018/credentials#",
        "as": "https://www.w3.org/ns/activitystreams#",
        "void": "http://rdfs.org/ns/void#",
        "dqv": "http://www.w3.org/ns/dqv#",
        "oa": "http://www.w3.org/ns/oa#",
        "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
        "owl": "http://www.w3.org/2002/07/owl#",
        "xsd": "http://www.w3.org/2001/XMLSchema#",
        "apercue": "https://apercue.ca/vocab#",
        "charter": "https://apercue.ca/charter#",
        "name": "dcterms:title",
        "description": "dcterms:description",
        "depends_on": {
            "@id": "dcterms:requires",
            "@type": "@id"
        },
        "status": {
            "@id": "schema:actionStatus",
            "@type": "@id"
        },
        "tags": {
            "@id": "dcterms:subject",
            "@container": "@set"
        }
    }
}

This context is not a configuration file; it is a CUE value computed from the vocabulary registry. Every resource exported through this context produces valid JSON-LD 1.1.

SHACL Validation (computed)

A compliance rule requires that publications have upstream dependencies (cannot exist without supporting data). The #ComplianceCheck pattern produces a standard sh:ValidationReport:

{
    "@type": "sh:ValidationReport",
    "sh:conforms": true,
    "sh:result": []
}

sh:conforms: true: all compliance rules pass. This is produced at CUE evaluation time. No separate SHACL processor runs.

Critical Path / OWL-Time (computed)

The #CriticalPath pattern computes forward/backward passes and identifies the critical sequence:

[
    {
        "resource": "ethics-approval",
        "start": 0,
        "finish": 60,
        "duration": 60
    },
    {
        "resource": "sensor-dataset",
        "start": 60,
        "finish": 150,
        "duration": 90
    },
    {
        "resource": "analysis-code",
        "start": 150,
        "finish": 195,
        "duration": 45
    },
    {
        "resource": "draft-paper",
        "start": 195,
        "finish": 225,
        "duration": 30
    },
    {
        "resource": "peer-review",
        "start": 225,
        "finish": 285,
        "duration": 60
    }
]

5-node critical path, 285-day total duration. The same data produces standard OWL-Time time:Interval entries:

{
    "@type": "time:Interval",
    "@id": "urn:resource:analysis-code",
    "dcterms:title": "analysis-code",
    "time:hasBeginning": {
        "@type": "time:Instant",
        "time:inXSDDecimal": 150
    },
    "time:hasEnd": {
        "@type": "time:Instant",
        "time:inXSDDecimal": 195
    },
    "time:hasDuration": {
        "@type": "time:Duration",
        "time:numericDuration": 45,
        "time:unitType": {
            "@id": "time:unitDay"
        }
    },
    "apercue:slack": 0,
    "apercue:isCritical": true
}

Each resource becomes a time:Interval with time:hasBeginning, time:hasEnd, and time:hasDuration. Slack and criticality are extensions in the apercue: namespace.

Access Policy / ODRL (computed)

The #ODRLPolicy pattern projects dependency-graph resources into an ODRL policy set:

{
    "@type": "odrl:Set",
    "odrl:uid": "urn:policy:graph-policy",
    "odrl:permission": [
        {
            "@type": "odrl:Permission",
            "odrl:action": {
                "@id": "odrl:read"
            }
        },
        {
            "@type": "odrl:Permission",
            "odrl:action": {
                "@id": "odrl:execute"
            },
            "odrl:assignee": {
                "@id": "apercue:operator"
            }
        }
    ],
    "odrl:prohibition": []
}

Permissions and prohibitions are typed by the same @type set that drives graph construction. Adding a policy is adding a CUE file, not configuring middleware.

Provenance / PROV-O (computed)

The #ProvenanceTrace pattern maps dependency edges to prov:wasDerivedFrom relations:

{
    "@type": "prov:Entity",
    "@id": "urn:resource:analysis-code",
    "dcterms:title": "analysis-code",
    "prov:wasAttributedTo": {
        "@id": "urn:agent:graph-engine"
    },
    "prov:wasDerivedFrom": [
        {
            "@id": "urn:resource:sensor-dataset"
        }
    ],
    "prov:wasGeneratedBy": {
        "@id": "urn:activity:graph-construction"
    },
    "prov:qualifiedGeneration": {
        "@id": "urn:generation:analysis-code"
    }
}

Every resource becomes a prov:Entity. Dependency edges become derivation links. The full provenance graph includes all 5 resources plus the generating prov:Activity and prov:Agent.

Graph Self-Description / VoID (computed)

The #VoIDDataset pattern produces a VoID dataset description; the graph's machine-readable "about" page:

{
    "@type": "void:Dataset",
    "@id": "urn:apercue:w3c-evidence",
    "dcterms:title": "W3C Evidence Dataset",
    "void:entities": 5,
    "void:triples": 24,
    "void:classes": 5,
    "void:classPartition": [
        {
            "@type": "void:Dataset",
            "void:class": {
                "@id": "https://apercue.ca/vocab#Governance"
            },
            "void:entities": 1
        },
        {
            "@type": "void:Dataset",
            "void:class": {
                "@id": "https://apercue.ca/vocab#Dataset"
            },
            "void:entities": 1
        },
        {
            "@type": "void:Dataset",
            "void:class": {
                "@id": "https://apercue.ca/vocab#Process"
            },
            "void:entities": 1
        },
        {
            "@type": "void:Dataset",
            "void:class": {
                "@id": "https://apercue.ca/vocab#Publication"
            },
            "void:entities": 1
        },
        {
            "@type": "void:Dataset",
            "void:class": {
                "@id": "https://apercue.ca/vocab#Review"
            },
            "void:entities": 1
        }
    ]
}

5 entities, 24 triples, 5 classes. Class partitions show how many resources belong to each @type. This is standard VoID; any LOD catalog or SPARQL endpoint description consumer can read it.

Type Ontology / RDFS+OWL (computed)

The #OWLOntology pattern extracts the implicit ontology from the graph's type system. Each @type becomes an rdfs:Class; dependency edges become an owl:ObjectProperty:

{
    "@graph": [
        {
            "@type": "owl:Ontology",
            "@id": "https://apercue.ca/ontology/w3c-evidence#",
            "dcterms:description": "OWL vocabulary from research publication dependency graph",
            "dcterms:title": "W3C Evidence Ontology"
        },
        {
            "@type": [
                "rdfs:Class",
                "owl:Class"
            ],
            "@id": "https://apercue.ca/vocab#Governance",
            "rdfs:label": "Governance"
        },
        {
            "@type": [
                "rdfs:Class",
                "owl:Class"
            ],
            "@id": "https://apercue.ca/vocab#Dataset",
            "rdfs:label": "Dataset"
        },
        {
            "@type": [
                "rdfs:Class",
                "owl:Class"
            ],
            "@id": "https://apercue.ca/vocab#Process",
            "rdfs:label": "Process"
        },
        {
            "@type": [
                "rdfs:Class",
                "owl:Class"
            ],
            "@id": "https://apercue.ca/vocab#Publication",
            "rdfs:label": "Publication"
        },
        {
            "@type": [
                "rdfs:Class",
                "owl:Class"
            ],
            "@id": "https://apercue.ca/vocab#Review",
            "rdfs:label": "Review"
        },
        {
            "@type": "owl:ObjectProperty",
            "@id": "dcterms:requires",
            "rdfs:label": "depends on",
            "rdfs:comment": "A resource depends on another resource",
            "rdfs:domain": {
                "@id": "rdfs:Resource"
            },
            "rdfs:range": {
                "@id": "rdfs:Resource"
            }
        }
    ]
}

W3C Evidence Ontology; the graph's type vocabulary as a formal OWL ontology. Loadable in Protégé, validatable by OWL reasoners.

Type Vocabulary / SKOS (computed)

The #SKOSTaxonomy pattern projects graph types as a SKOS ConceptScheme with broader/narrower hierarchy:

{
    "@type": "skos:Collection",
    "@id": "https://apercue.ca/vocab#TypeTaxonomy/collection",
    "skos:prefLabel": "Research Pipeline Type Taxonomy all concepts",
    "skos:member": [
        {
            "@type": "skos:Concept",
            "@id": "https://apercue.ca/vocab#Governance",
            "skos:broader": {
                "@id": "https://apercue.ca/vocab#ResearchActivity"
            },
            "skos:prefLabel": "Governance",
            "skos:inScheme": {
                "@id": "https://apercue.ca/vocab#TypeTaxonomy"
            },
            "skos:scopeNote": "Governance: used by 1 resources"
        },
        {
            "@type": "skos:Concept",
            "@id": "https://apercue.ca/vocab#Dataset",
            "skos:broader": {
                "@id": "https://apercue.ca/vocab#ResearchOutput"
            },
            "skos:prefLabel": "Dataset",
            "skos:inScheme": {
                "@id": "https://apercue.ca/vocab#TypeTaxonomy"
            },
            "skos:scopeNote": "Dataset: used by 1 resources"
        },
        {
            "@type": "skos:Concept",
            "@id": "https://apercue.ca/vocab#Process",
            "skos:broader": {
                "@id": "https://apercue.ca/vocab#ResearchActivity"
            },
            "skos:prefLabel": "Process",
            "skos:inScheme": {
                "@id": "https://apercue.ca/vocab#TypeTaxonomy"
            },
            "skos:scopeNote": "Process: used by 1 resources"
        }
    ]
}

Each @type becomes a skos:Concept with skos:broader linking to parent categories. Types that co-occur on resources are linked via skos:related. The scheme is navigable by any SKOS-aware vocabulary browser.

Activity Stream (computed)

The #ActivityStream pattern models graph construction as an Activity Streams 2.0 OrderedCollection:

{
    "type": "OrderedCollection",
    "totalItems": 5,
    "orderedItems": [
        {
            "type": "Create",
            "actor": {
                "type": "Application",
                "name": "apercue"
            },
            "object": {
                "summary": "Institutional review board approval (Protocol #2024-0142)",
                "type": "Object",
                "id": "urn:resource:ethics-approval",
                "name": "ethics-approval",
                "apercue:depth": 0
            }
        },
        {
            "context": [
                {
                    "type": "Link",
                    "href": "urn:resource:ethics-approval"
                }
            ],
            "type": "Create",
            "actor": {
                "type": "Application",
                "name": "apercue"
            },
            "object": {
                "summary": "Telemetry dataset (embargoed until publication)",
                "type": "Object",
                "id": "urn:resource:sensor-dataset",
                "name": "sensor-dataset",
                "apercue:depth": 1
            }
        }
    ]
}

Each resource creation is a Create activity ordered by topological depth. Layer 0 resources (no dependencies) are created first. Dependency edges appear as context links.

Validation Credential shape (computed, not counted)

The #ValidationCredential pattern wraps the SHACL validation result in the VC 2.0 data model shape. It has no proof, so it is an unsigned credential shape, not a verifiable credential:

{
    "type": [
        "VerifiableCredential",
        "apercue:ValidationCredential"
    ],
    "issuer": "urn:agent:graph-engine",
    "validFrom": "2026-02-27T00:00:00Z",
    "credentialSubject": {
        "id": "urn:apercue:w3c-evidence",
        "type": "sh:ValidationReport",
        "sh:conforms": true,
        "sh:result": []
    }
}

The credential attests that the graph passed compliance validation. The credentialSubject embeds the full sh:ValidationReport. This is the VC data model only; cryptographic proof requires an external issuer.

Data Catalog / DCAT 3 (computed)

The #DCATCatalog pattern projects the graph as a DCAT catalog with one dcat:Dataset per resource:

{
    "@type": "dcat:Catalog",
    "dcterms:title": "Research Publication Pipeline",
    "dcat:dataset": [
        {
            "@type": "dcat:Dataset",
            "@id": "urn:resource:sensor-dataset",
            "dcterms:description": "Telemetry dataset (embargoed until publication)",
            "dcterms:requires": [
                {
                    "@id": "urn:resource:ethics-approval"
                }
            ],
            "dcterms:title": "sensor-dataset",
            "dcat:theme": [
                {
                    "@id": "https://apercue.ca/vocab#Dataset",
                    "@type": "skos:Concept",
                    "skos:prefLabel": "Dataset"
                }
            ]
        }
    ]
}

Each resource becomes a dataset entry with Dublin Core metadata. The catalog is consumable by any DCAT-aware data portal (CKAN, data.gov, EU Open Data Portal).

Test Plan / EARL (computed, not counted: every outcome is earl:untested)

The #SmokeTest pattern produces EARL assertions describing the test plan for graph validation:

{
    "@graph": [
        {
            "@type": "earl:Software",
            "@id": "urn:agent:graph-engine",
            "dcterms:title": "apercue graph engine"
        },
        {
            "@type": "earl:Assertion",
            "earl:assertedBy": {
                "@id": "urn:agent:graph-engine"
            },
            "earl:mode": {
                "@id": "earl:automatic"
            },
            "earl:subject": {
                "@id": "urn:apercue:w3c-evidence"
            },
            "earl:test": {
                "@type": "earl:TestCase",
                "dcterms:title": "graph has 5 resources",
                "apercue:command": "cue export ./w3c/ -e evidence.graph_summary.total_resources"
            },
            "earl:result": {
                "@type": "earl:TestResult",
                "earl:outcome": {
                    "@id": "earl:untested"
                },
                "earl:expected": "5"
            }
        }
    ]
}

Each check becomes an earl:Assertion with an earl:TestCriterion and earl:TestResult. Outcomes are earl:untested at compile time; the plan is linked data; execution happens at runtime.

Schema.org Alignment (computed)

The #SchemaOrgAlignment pattern annotates resources with schema:additionalType via a configurable type map:

{
    "@graph": [
        {
            "@type": [
                "schema:Action"
            ],
            "@id": "urn:resource:ethics-approval",
            "dcterms:description": "Institutional review board approval (Protocol #2024-0142)",
            "dcterms:title": "ethics-approval",
            "schema:additionalType": [
                "schema:Action"
            ]
        },
        {
            "@type": [
                "schema:Dataset"
            ],
            "@id": "urn:resource:sensor-dataset",
            "dcterms:description": "Telemetry dataset (embargoed until publication)",
            "dcterms:title": "sensor-dataset",
            "schema:additionalType": [
                "schema:Dataset"
            ],
            "schema:isPartOf": [
                {
                    "@id": "urn:resource:ethics-approval"
                }
            ]
        }
    ]
}

Graph types (Process, Dataset, etc.) map to schema.org types (schema:SoftwareApplication, schema:Dataset). This makes the graph discoverable by Google Rich Results and other schema.org consumers.

Organizational View / W3C Org (computed)

The #OrgStructure pattern groups resources by @type into org:OrganizationalUnit within an org:Organization:

{
    "@type": "org:Organization",
    "@id": "https://apercue.ca/org#org",
    "skos:prefLabel": "Research Pipeline Organization",
    "org:hasUnit": [
        {
            "@type": "org:OrganizationalUnit",
            "@id": "https://apercue.ca/org#unit/Governance",
            "skos:prefLabel": "Governance",
            "dcterms:subject": {
                "@id": "https://apercue.ca/vocab#Governance"
            },
            "org:hasMember": [
                {
                    "@id": "urn:resource:ethics-approval",
                    "dcterms:title": "ethics-approval"
                }
            ]
        }
    ]
}

Types become departments; resources become members. The same typed graph that drives scheduling and compliance also projects as an organizational hierarchy.

Resource Annotations / Web Annotation (computed)

The #AnnotationCollection pattern attaches structured notes to graph resources using the W3C Web Annotation model:

{
    "type": "AnnotationCollection",
    "label": "Research Pipeline Review Annotations",
    "total": 3,
    "items": [
        {
            "type": "Annotation",
            "motivation": "oa:assessing",
            "body": {
                "type": "TextualBody",
                "value": "IRB protocol approved 2024-01-15",
                "format": "text/plain"
            },
            "target": {
                "type": "SpecificResource",
                "source": "urn:resource:ethics-approval"
            }
        },
        {
            "type": "Annotation",
            "motivation": "oa:commenting",
            "body": {
                "type": "TextualBody",
                "value": "Data under embargo until publication",
                "format": "text/plain"
            },
            "target": {
                "type": "SpecificResource",
                "source": "urn:resource:sensor-dataset"
            }
        }
    ]
}

Each annotation carries a motivation from the W3C vocabulary (assessing, commenting, classifying). Targets are validated against the graph; an annotation referencing a nonexistent resource fails at CUE evaluation time.

Data Quality / DQV (computed)

The #DataQualityReport pattern projects compliance and structural metrics as DQV quality measurements:

{
    "@graph": [
        {
            "@type": "dqv:Category",
            "@id": "urn:dqv:Intrinsic",
            "skos:prefLabel": "Intrinsic Data Quality"
        },
        {
            "@type": "dqv:Dimension",
            "@id": "urn:dqv:Consistency",
            "skos:prefLabel": "Consistency",
            "dqv:inCategory": {
                "@id": "urn:dqv:Intrinsic"
            }
        },
        {
            "@type": "dqv:Metric",
            "@id": "urn:dqv:CompliancePassRate",
            "skos:prefLabel": "Compliance Pass Rate",
            "skos:definition": "Percentage of compliance rules that pass",
            "dqv:inDimension": {
                "@id": "urn:dqv:Consistency"
            }
        }
    ]
}

Quality dimensions (Completeness, Consistency, Accessibility) organize metrics computed from the graph. Each dqv:QualityMeasurement links to its metric, dimension, and the dataset under evaluation.

Spec Coverage

13 W3C specifications implemented, 1 downstream (in the infrastructure-specific extension). Adding a projection is adding a file, not modifying a framework.

Implemented W3C specifications (13):

Specification CUE Produces
JSON-LD 1.1 @context, @type, @id on all resources; namespace collision detection via federation
SHACL Produces conformant sh:ValidationReport from compliance/gap analysis + sh:NodeShape generation from graph types
SKOS skos:ConceptScheme from type vocabularies, lifecycle phases, and hierarchical taxonomies with broader/narrower
OWL-Time time:Interval from critical path scheduling; time:Instant timestamps on federation context events
PROV-O prov:Entity, prov:Activity, prov:Agent with wasDerivedFrom chains; prov:Plan from charter gates with qualifiedAssociation; prov:Generation timestamps on gate completion; prov:Collection event log for federation boundary crossings
ODRL 2.2 odrl:Set permission/prohibition matrix by resource type; no asset/party/constraint modeling
Activity Streams 2.0 as:OrderedCollection of Create activities from topology layers; no actor model or delivery
W3C Org org:Organization with type-based OrganizationalUnits; no org:Membership or org:Role
VoID void:Dataset with class/property partitions, linkset statistics, and vocabulary usage
Web Annotation oa:Annotation with TextualBody, SpecificResource targets, and W3C motivations; no selectors or states
RDFS rdfs:Class, rdfs:subClassOf, rdfs:domain/range from type hierarchy; no OWL restrictions or reasoning
DQV dqv:QualityMeasurement for completeness, consistency, and accessibility dimensions
DCAT 3 dcat:Catalog with dcat:Dataset and dcat:theme from @type; dcat:Distribution and dcat:DataService supported when configured

Non-W3C vocabularies used (2):

Vocabulary CUE Produces
Dublin Core dcterms:title, dcterms:description, dcterms:requires on all resources
schema.org schema:additionalType annotations via configurable type mapping

Emitted but not counted (2):

Specification What is emitted, and why it is not counted
EARL earl:Assertion structure with earl:TestCase and earl:Software assertor; every outcome is earl:untested, so this is a test plan, not test results
Verifiable Credentials 2.0 Unsigned credential shape (v2 context) wrapping a SHACL report; no proof, so not a verifiable credential

Downstream (1):

Specification CUE Produces
Hydra Core hydra:ApiDocumentation in quicue.ca operator dashboard

Key Mechanisms

Transitive Closure via Unification

_ancestors: {
    [_]: true
    if _hasDeps {
        for d, _ in _deps {
            (d): true
            resources[d]._ancestors
        }
    }
}

CUE resolves the fixpoint: the struct expands until merging produces no new keys, then stops. No explicit loop, no recursion depth tracking. It answers the same question as a SPARQL property path over the dependency edge. In pure CUE this is practical only for small graphs (see Limitations); larger graphs use a closure precomputed by tools/toposort.py.

Type Overlap as Dispatch

for tname, _ in provider.types
if resource["@type"][tname] != _|_ {tname}

A resource with {Dataset: true, Governance: true} matches a data repository (serves Dataset) AND an ethics board (serves Governance) simultaneously. Set intersection, not registration. This is the CUE equivalent of SPARQL ?resource a ?type pattern matching.

Constraints as Values

CUE constraints live in the same package as the computation. A consumer opts in to a failing build with one field:

compliance: patterns.#ComplianceCheck & {Enforce: true, ...}  // critical failure is bottom
gaps:       charter.#GapAnalysis & {Enforce: true, ...}       // incomplete charter is bottom

With Enforce: true, a critical rule failure or an incomplete charter fails cue vet. The default is report-only: violations appear in the SHACL report and the build passes.

Multi-Domain Validation

The same patterns have been validated across four independent domains:

Domain Resources Patterns Used
Research data mgmt 5 resources, 5 types Provenance, embargo, scheduling
IT infrastructure 30 resources, 28 providers (of 33 quicue.ca templates) Full stack (654 CLI commands)
University curricula 12 CS courses Critical path, compliance, charter
Construction PM 18 work packages 5 DAG gates, phased construction PM

Same #Graph, same #CriticalPath, same #ComplianceCheck. The domain is data; the patterns are generic.

Limitations

Relevance to W3C Community Groups

Conformance Status

Outputs have been validated as follows:

CUE's type system catches structural violations (missing required fields, wrong types) at evaluation time. This provides compile-time structural conformance but does not replace spec-level validation suites.

References

Source: github.com/quicue/apercue/tree/main/w3c

All evidence is computed from CUE source. Reproduce: cue export ./w3c/ -e evidence --out json