# AUTHORED-BY Claude Opus 4.8 (Fable unavailable) — re-review/upgrade candidate
#
# Federation App-Registration Vocabulary (fedapp:)
# Namespace: https://w3id.org/jeswr/fed#   (ADR-0013, prod-solid-server)
#
# The OpenID-Federation-style metadata a Solid app publishes IN its Client
# Identifier Document (the .jsonld served at the app's client_id URL). It lets a
# data-federation registry / a peer app understand what sectors the app operates
# in, which WAC/ACP access modes it requests, and which shared shapes it
# consumes / produces — WITHOUT trusting any self-asserted membership claim
# (membership is the registry's job after a signed challenge).
#
# Authored as Turtle directly (source form); machine-built RDF in this repo goes
# through n3.Writer / @rdfjs/wrapper typed accessors — never hand-built quads.

@prefix fedapp:  <https://w3id.org/jeswr/fed#> .
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:     <http://www.w3.org/2002/07/owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix vann:    <http://purl.org/vocab/vann/> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

#################################################################
#    Ontology
#################################################################

<https://w3id.org/jeswr/fed>
    a owl:Ontology ;
    dcterms:title "Federation App-Registration Vocabulary"@en ;
    dcterms:description """OpenID-Federation-style metadata a Solid app
        publishes in its Client Identifier Document, describing the data
        sectors it operates in, the access modes it requests, and the shared
        shapes it consumes and produces."""@en ;
    dcterms:creator "Claude Opus 4.8 (@jeswr PSS agent)" ;
    dcterms:issued "2026-06-15"^^xsd:date ;
    vann:preferredNamespaceUri "https://w3id.org/jeswr/fed#" ;
    vann:preferredNamespacePrefix "fedapp" ;
    rdfs:seeAlso <https://w3id.org/jeswr/task> ;
    rdfs:comment "Experimental — AI-agent-generated; under active development, not production-hardened."@en .

#################################################################
#    Classes
#################################################################

fedapp:App
    a rdfs:Class, owl:Class ;
    rdfs:label "Federated App"@en ;
    rdfs:comment """A Solid client application that participates in the
        ecosystem federation. The subject of an fedapp:App description is
        typically the app's client_id IRI (its Client Identifier Document).
        It declares the sectors, access modes and shapes the app works
        with."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:AppVersion
    a rdfs:Class, owl:Class ;
    rdfs:label "App Version"@en ;
    rdfs:comment """A specific released version of an fedapp:App. Lets a
        registry track behavioural changes (e.g. a newly requested access mode
        or a new produced shape) across releases of the same client_id."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:SectorUse
    a rdfs:Class, owl:Class ;
    rdfs:label "Sector Use"@en ;
    rdfs:comment """A reified statement of how an app uses one data sector — a
        node bundling a fedapp:sector with the fedapp:access modes requested in
        that sector, and optionally the fedapp:consumes / fedapp:produces shapes
        scoped to it. Use SectorUse when per-sector access differs; for a flat
        declaration attach fedapp:sector / fedapp:access directly to the
        App."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

#################################################################
#    Properties
#################################################################

# NB on domains: fedapp:sector / access / consumes / produces may be attached
# EITHER to an fedapp:App directly (the flat form) OR to an fedapp:SectorUse node
# (the nested per-sector form), so they deliberately carry NO rdfs:domain — a
# domain of fedapp:App would let a reasoner mis-infer that any SectorUse using
# them is itself an App. The linking property fedapp:sectorUse attaches a
# SectorUse node to an App.

fedapp:sectorUse
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "sector use"@en ;
    rdfs:comment """Links an fedapp:App to an fedapp:SectorUse node — the
        nested form used when access (or consumed/produced shapes) differ
        per sector. For a flat declaration attach fedapp:sector / fedapp:access
        directly to the App instead."""@en ;
    rdfs:domain fedapp:App ;
    rdfs:range fedapp:SectorUse ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:sector
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "sector"@en ;
    rdfs:comment """The data sector operated in (e.g. the
        identity / productivity / media / finance / health / documents / social
        sector IRIs under https://w3id.org/jeswr/sectors/). May be attached to
        an fedapp:App directly, or to an fedapp:SectorUse node — so it carries
        no rdfs:domain."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:access
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "access mode"@en ;
    rdfs:comment """A WAC/ACP access mode requested — one of
        acl:Read, acl:Write, acl:Append (and, rarely, acl:Control). Declares the
        app's intended footprint so a user/registry can reason about it before
        granting consent. Attaches to an fedapp:App or an fedapp:SectorUse — so
        it carries no rdfs:domain."""@en ;
    rdfs:range <http://www.w3.org/ns/auth/acl#Mode> ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:consumes
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "consumes"@en ;
    rdfs:comment """A shared data shape READ — references a SHACL
        node shape (or a shared @context term / class IRI) expected to be
        consumable from the federation. Pairs with fedapp:produces to draw
        the producer/consumer graph of the ecosystem. Attaches to an fedapp:App
        or an fedapp:SectorUse — so it carries no rdfs:domain."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:produces
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "produces"@en ;
    rdfs:comment """A shared data shape WRITTEN — references a SHACL
        node shape (or a shared @context term / class IRI) emitted into
        the federation, so consumers can discover where data of that shape
        originates. Attaches to an fedapp:App or an fedapp:SectorUse — so it
        carries no rdfs:domain."""@en ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .

fedapp:declaresShape
    a rdf:Property, owl:ObjectProperty ;
    rdfs:label "declares shape"@en ;
    rdfs:comment """Links an fedapp:App to a SHACL node shape it authors /
        vouches for as the canonical definition of a shared model. Distinct from
        consumes/produces (which only reference a shape): declaresShape asserts
        the app is a source-of-truth definer for that shape."""@en ;
    rdfs:domain fedapp:App ;
    rdfs:range <http://www.w3.org/ns/shacl#NodeShape> ;
    rdfs:isDefinedBy <https://w3id.org/jeswr/fed> .
