Skip to content

Cross-layer queries ​

Generated page

This page is generated from the query catalog in docs/queries/ on every docs build.

The questions the one graph exists to answer, as parameterised SPARQL. Each query leaves its focus node as a free variable; the viewer binds it to the element you are looking at and shows the query as a button in the inspector's Questions list, never as SPARQL. CI runs every query against the worked examples and asserts the exact expected rows, so a traversal cannot silently regress to zero results.

Which systems talk to which, and where are they deployed, with container ​

Source: docs/queries/c4-l1-rollup.rq

Which systems talk to which, and where are they deployed, with container detail rolled up?

Projection query for the C4 L1 (system context) view — NOT a Questions-catalog entry, and deliberately not listed in viewer/queries.py. It has no focus variable: it returns every rolled-up edge in the model, and the viewer keeps the rows whose endpoints are visible at L1 (see ADR-0008).

Three branches:

  • "depends on" : a container of ?from arch:dependsOn a container of ?to,

where both are arch:System and ?from != ?to (dependencies inside one system do not roll up into a self-edge).

  • "deployed to" : a container of system ?from is seam:deployedTo a

deployment node that environment ?to arch:contains.

  • "runs" : bounded context ?from seam:owns a model that a container

of system ?to seam:presents, or a model holding a process that container seam:executes (ADR-0030 sections 2 and 5: the containers that run a context are derived).

sparql
PREFIX seam: <https://w3id.org/seams/seam#>
PREFIX arch: <https://w3id.org/seams/arch#>

SELECT DISTINCT ?from ?to ?kind WHERE {
  {
    ?from a arch:System ;
          arch:contains ?a .
    ?to a arch:System ;
        arch:contains ?b .
    ?a arch:dependsOn ?b .
    FILTER(?from != ?to)
    BIND("depends on" AS ?kind)
  }
  UNION
  {
    ?from a arch:System ;
          arch:contains ?c .
    ?c seam:deployedTo ?n .
    ?to a arch:Environment ;
        arch:contains ?n .
    BIND("deployed to" AS ?kind)
  }
  UNION
  {
    VALUES ?runs { seam:executes seam:presents }
    ?from a arch:BoundedContext ;
          seam:owns ?m .
    ?to a arch:System ;
        arch:contains ?c .
    ?c a arch:Container .
    { ?c ?runs ?m . }
    UNION
    { ?c ?runs ?t . ?t seam:inModel ?m . }
    BIND("runs" AS ?kind)
  }
}

What breaks — containers, processes and data — if this deployment node goes away? ​

Source: docs/queries/impact-of-node.rq · focus variable ?node

Returns everything that transitively depends on a container deployed to the node — including the deployed containers themselves (path length 0), the processes they execute and the data stored on it. Dependency edges walked:

  • arch:dependsOn : design-time dependency
  • seam:consumes/^seam:exposes : contract-level dependency via an operation/channel
  • ^seam:executes : a process depends on the container that runs it
  • seam:storedIn : a data shape depends on the store holding its rows

Bind ?node to an arch:DeploymentNode.

sparql
PREFIX seam: <https://w3id.org/seams/seam#>
PREFIX arch: <https://w3id.org/seams/arch#>

SELECT DISTINCT ?impacted WHERE {
  ?container seam:deployedTo ?node .
  ?impacted ( arch:dependsOn
            | (seam:consumes/^seam:exposes)
            | ^seam:executes
            | seam:storedIn
            )* ?container .
}

Which screens can each role use to eventually write this data shape, and through which event and task? ​

Source: docs/queries/screens-by-role-writing-shape.rq · focus variable ?shape

The access-review question: every UI event reachable by a role that eventually writes this data, and the screen it sits on.

The walk from ?event to ?writer is exactly the behavioral path of what-writes-shape.rq (triggers/detailedBy/^inModel, decidedBy, invokes and the async publishesTo/^subscribesTo/inModel/^inModel hop). The screen is the ifml:ViewContainer that ifml:contains the component the event sits on, the same screen rule as screens-to-finish-process.rq (ADR-0009).

Role rule: ?role is an odrl:assignee (an odrl:Party, or an odrl:PartyCollection such as "authenticated users") of a permission in a policy that governs the event, either directly (seam:governedBy) or through the operation it submits to (seam:submitsTo/seam:governedBy). An unbound ?role means neither the event nor its operation is governed: the write is open to any authenticated identity.

Bind ?shape to a sh:NodeShape. The viewer binds only the focus, so to answer "which screens can an employee use" read the rows whose ?role is the employee party (or unbound); leave ?shape unbound to list every shape.

sparql
PREFIX seam: <https://w3id.org/seams/seam#>
PREFIX ifml: <https://w3id.org/seams/ifml#>
PREFIX odrl: <http://www.w3.org/ns/odrl/2/>

SELECT DISTINCT ?role ?screen ?event ?writer WHERE {
  ?event a ifml:Event .
  ?event ( (seam:triggers/seam:detailedBy/^seam:inModel)
         | seam:decidedBy
         | seam:invokes
         | (seam:publishesTo/^seam:subscribesTo/seam:inModel/^seam:inModel)
         )+ ?writer .
  ?writer seam:writes ?shape .
  ?screen a ifml:ViewContainer ;
          ifml:contains/ifml:hasEvent ?event .
  OPTIONAL {
    ?event (seam:governedBy | seam:submitsTo/seam:governedBy) ?policy .
    ?policy odrl:permission ?perm .
    ?perm odrl:assignee ?role .
  }
}

Which screens must a person visit to finish this process, and which policy governs each? ​

Source: docs/queries/screens-to-finish-process.rq · focus variable ?process

The query ADR-0009 earns for seam:completedOn. Each user task of the process waits for a person on the ifml:Form it seam:completedOn; the screen is the ifml:ViewContainer that ifml:contains that form (the ADR's screen rule).

Tasks belong to the process through the BPMN model it is seam:detailedBy: every task carries seam:inModel of that model (process/detailedBy/^inModel), the same backbone hop what-writes-shape.rq takes.

?policy is each odrl:Policy the task is seam:governedBy, unbound for an ungoverned task (open to any authenticated identity). Following ?policy odrl:permission/odrl:assignee answers the follow-up question "which roles can complete this approval"; it is not a separate query.

Bind ?process to a proc:Process; leave unbound to list every process's screens.

sparql
PREFIX seam: <https://w3id.org/seams/seam#>
PREFIX proc: <https://w3id.org/seams/proc#>
PREFIX ifml: <https://w3id.org/seams/ifml#>

SELECT DISTINCT ?task ?form ?screen ?policy WHERE {
  ?process a proc:Process ;
           seam:detailedBy/^seam:inModel ?task .
  ?task a proc:UserTask ;
        seam:completedOn ?form .
  ?screen a ifml:ViewContainer ;
          ifml:contains ?form .
  OPTIONAL { ?task seam:governedBy ?policy }
}

Which process tasks may move an entity out of this state? ​

Source: docs/queries/what-moves-state.rq · focus variable ?state

The inverse view of seam:fires. A transition with no firing task is not an error — it is a model-health warning (M2): declared lifecycle movement that no modeled behavior can cause.

Bind ?state to a state:State.

sparql
PREFIX seam:  <https://w3id.org/seams/seam#>
PREFIX state: <https://w3id.org/seams/state#>

SELECT ?task ?transition ?toState WHERE {
  ?transition state:from ?state ; state:to ?toState .
  ?task seam:fires ?transition .
}

Which UI events can eventually write this data shape, and through which task? ​

Source: docs/queries/what-writes-shape.rq · focus variable ?shape

Walks the seam backbone from an IFML event into behavior:

  • triggers/detailedBy/^inModel : into the elements of the triggered process
  • decidedBy, invokes : deeper behavioral hops
  • publishesTo/^subscribesTo/inModel/^inModel : the async hop — from a

message-throw event through the channel into the subscribing process's elements (control flow stays in the BPMN XML, so model-siblings is the honest approximation of "downstream in that process")

Bind ?shape to a sh:NodeShape; leave unbound to list every event->shape pair.

sparql
PREFIX seam: <https://w3id.org/seams/seam#>
PREFIX ifml: <https://w3id.org/seams/ifml#>

SELECT DISTINCT ?event ?writer WHERE {
  ?event a ifml:Event .
  ?event ( (seam:triggers/seam:detailedBy/^seam:inModel)
         | seam:decidedBy
         | seam:invokes
         | (seam:publishesTo/^seam:subscribesTo/seam:inModel/^seam:inModel)
         )+ ?writer .
  ?writer seam:writes ?shape .
}

Released under the Apache-2.0 License.