Full text
September 2025 Action-Based Compliance Checking in Linked Data using SHACL Jeroen BRETELER a,1, Thom VAN GESSEL a aTNO, The Hague, Netherlands Abstract. In recent years, a number of studies have demonstrated the use of Semantic Web standards such as OWL, SPARQL, and SHACL for legal knowledge management — and specifically for compliance checking. Typically, these implementations either evaluate states or evaluate actions that are not specified for how their execution would change states. The conceptual model can therefore be said to be static. On the other hand, recent research in logic and law has seen a rise of proposals for dynamic or action-based logics to express legal norms. At the intersection of these lines of research, we present the latest developments of Flint, a Semantic Web ontology for representing legal interpretations that is action-based. Most notably, we present an implementation in SHACL of compliance checking based on Flint interpretations. In an improvement over previous literature, our implementation is generic for any Flint model. This allows users to concentrate on producing legal interpretations, hiding the complexity of SHACL. Keywords. Legal knowledge representation, Compliance checking, Normative systems, SHACL, Semantic Web 1. Introduction Semantic Web standards have long been a topic of research for AI and law (e.g. [1]). This is justifiable in many regards; the Linked Data principle enables crucial traceability between different sub-domains of legal knowledge, the support for rich and formal conceptual models matches the objectives of legal philosophy and logic for law, and the high interoperability of Semantic Web datasets promises the application of legal knowledge across the many domains of society where it is needed. Previous work has therefore also investigated the use of Semantic Web standards to implement compliance checking. [2] propose to use SPARQL queries [3] to update graphs with the appropriate deontic modalities. [4] demonstrates the use of property restrictions and the inferencing system of OWL [5] as a means of deontic reasoning. Most recently, [6,7] have demonstrated the potential of SHACL and SHACL–SPARQL constraints as a means for expressing and evaluating legal rules. Compliance checking in these works is strikingly static. The implementations either do not model actions, or model actions that do not have consequences. That is, there is no information about how execution of an action would affect the legal state of affairs. In contrast, recent work in logic of norms has increasingly shifted from static accounts 1Corresponding Author: Jeroen BRETELER, [email protected].
of rights and duties to dynamic, action-oriented frameworks that model how legal relations evolve through actions of agents. These approaches typically combine a static representation of duties with a dynamic component such as actions formalized in propositional dynamic logic [8] (e.g. [9]) or model updates from dynamic epistemic logic [10,11] (e.g. [12,13]) to model how the execution of a power brings about changes to duties and other facts. In particular, [13] incorporates preconditions and postconditions for actions, specifying both the circumstances under which an action may be lawfully executed and the resulting changes that occur when it is performed. Ultimately, we suggest that an action-based modeling approach helps to embed compliance solutions in practice. The evaluation of states is relevant because of a certain context; in that context, agents will want to think about taking action. For example, [7] checks compliance for a Ghanaian petroleum regulation, identifying companies whose filings do not meet requirements. As the authors point out, violations of the relevant provisions being modeled will “attract sanctions” (p. 4). It is this context that makes the compliance check meaningful. We suggest that this consideration generalizes to purposes of addressing noncompliance (“What do I need to change so that I can do an action A?”), explaining policy (“Under what conditions can I do A? Under what conditions could others do A against me?”), and planning and simulation (“Which compliant action could bring me closer to my goal?”). If a full compliance solution will need to address the semantics of norms on actions, it is valuable to investigate action-based modeling approaches. In the following section, we present our latest additions to the Flint ontology, an action-based OWL ontology for expressing legal interpretations. Afterwards, we present the Flint State Machine Ontology for compliance checking using Flint models. 2. Flint Flint is a framework for modeling interpretations of normative texts [14,15].2An interpretation in Flint is a collection of inter-related frames [18]. The ontology specifies two disjoint classes: fact frames, which describe types of institutional states of affairs, and act frames, which denote admissible transition types that operate on those states and thereby create institutional change. Every act frame is associated with a precondition fact frame, specifying the circumstances under which the act frame may be instantiated as a concrete act, and a postcondition that formalizes the resulting transformation of the normative state. These changes may involve the assignment or termination of duties. In this way, the framework is grounded in the legal relations of power and duty [19,20]. In addition, every act frame specifies possible actors, recipients, and objects involved in an act. The present paper extends a previous version of the Flint ontology presented in [15]. 2.1. Postconditions assign values to instances In earlier literature on Flint and its ontology, postconditions of act frames were defined by linking fact frames through the relations creates and terminates. A limitation of this 2Flint and the FSMO presented below have many similarities, and a few differences, to eFlint [16], due to shared origins. For the purposes of this paper, a notable difference is that eFlint is implemented in Haskell and Clingo [17], placing it further away from the context of Semantic Web implementations.
approach is that facts can only be assigned the values true or false. This excludes the possibility of performing calculations where a fact can have a number as its value. In the present version of the Flint ontology, this approach has been generalized through the Postcondition class. Instances of this class are linked to both a target frame and a value. This value may be a literal, such as a boolean, a number, or a string, but it may also be another frame. In the latter case, the value of this frame in the original state determines the value of the target frame in the new state. The relations creates and terminates remain available as shorthands. 2.2. Slot correspondences relate variables of frames to each other Another addition we made to Flint is that frames can contain slots. Slots function as labels for variables that, in concrete scenarios, are instantiated with individuals. A fact frame such as Library member, which represents a property of an individual, has one slot, whereas a fact frame representing a relation has two or more slots. Act frames have slots for actor,recipient, and object by default, but may have more. It is often useful to specify how the slots of different frames are related. For instance, if the act of borrowing a book creates a duty to return that book, then the object slot of the act must be linked to a slot of the duty, in order to express that the book being borrowed is the same book that must later be returned. To support this, we introduce the concept of SlotCorrespondence. A slot correspondence is defined as a set of frame–slot pairs that expresses that all these slots must share the same individual in acts where the corresponding frames are related. 3. Compliance checking with the Flint State Machine Ontology This paper marks our first presentation of the Flint State Machine Ontology (FSMO).3 This is an extension to the Flint ontology that formalizes how general norms, expressed with Flint frames, apply to cases. For this purpose, the ontology defines the Instance class which instantiates a Flint frame. Where a Flint frame expresses a general concept, the Instance is its concrete form for a specific variable assignment. In logic terminology, the frame is a formula, and the instance a sentence based on the formula. The State class then assigns values to all relevant instances of Fact frames. Instances of Act frames are transitions that point to an ‘initial state’ and a ‘result state’. FSMO also defines validation and derivation rules, expressed using SHACL and especially SHACL–SPARQL constraints. The rules allow one to validate Flint Acts and determine their consequences. This is what enables compliance checking. For brevity, we will outline one example of a rule that deals with preconditions; the interested reader is referred to the source code repository for an overview of all the rules, including those for handling postconditions. Figure 1 visualizes the process for checking preconditions to see if an Act is valid in the FSMO.4Given an Act that is being executed in some initial State, step (1) looks 3Source code, including a testable example case, is publicly accessible at https://gitlab.com/ normativesystems/knowledge-modeling/flint-state-machine-ontology. The rules component is defined in ./shacl/valid_act.ttl. 4We present the intuition of the rule in a stepwise fashion here for clarity. There is no sequential nature to the implementation of the rule in SHACL–SPARQL.
Figure 1. A stepwise diagram for validating a concrete act with reference to general frames. up the frame corresponding to the type of the Act. For example, if the Act in question is Jeroen publishes an evaluation of Product X, step (1) will find the corresponding general Act frame Publishing evaluations of products. Next, at this general level, we can query for the preconditions of such an Act; this is step (2). This could yield a precondition such as An actor publishing an evaluation has a license for publishing about that product. Next, in step (3) our SHACL rule needs to cast the general precondition back into the context of the case at hand. We bind the relevant variables to get the appropriate Fact instance, which would be Jeroen has a license to publish about Product X. Whether the latter precondition is true depends on the valuation of that Fact in the relevant State. This truth value will determine the outcome of the SHACL rule application. The FSMO can be used as a compliance engine by providing it with general norms expressed as Flint frames, as well as a set of relevant states and actions. Notably, users do not need to provide SHACL statements themselves. The outcome of a SHACL evaluation applying the FSMO rules on an Act taken in a given state will indicate whether the Act was compliant with the norms stated by the Flint frames. Additionally, by referencing the postconditions specified in relation to an Act, the SHACL evaluation will construct the new state that results from executing the Act. 4. Discussion & Conclusion In this paper, we highlighted the need to study action-based models of normative change in legal knowledge management and compliance checking. We reported on the latest developments of the action-based Flint ontology for legal interpretation, as well as its extension to a state machine model for compliance checking. By incorporating actions, our approach allows the modeling of the full practical context, and promotes clarity about the dynamics of the normative system in question. In addition, we have outlined the definition of a general compliance engine in SHACL that can process any Flint model. This removes the need for users to handle SHACL statements in order to use the compliance checker. For maturing our solution, one option that stands out is to evaluate complex Fact expressions by the FSMO rules. We have so far deprioritized this because it is a general Semantic Web challenge to process nested function application, which has no particularly legal or normative aspect to it. For the conceptual modeling, an important follow-up
direction is to see what is needed for FSMO to integrate with existing datasets. Ideally, values of instances could then be derived from the data, bringing operational data into contact with the legal realm and enabling compliance checking. References [1] Hoekstra R, Breuker J, Di Bello M, Boer A. The LKIF Core Ontology of Basic Legal Concepts. In: LOAIT 07: II Workshop on Legal Ontologies and Artificial Intelligence Techniques; 2007. p. 43-63. [2] Gandon F, Governatori G, Villata S. Normative requirements as linked data. In: JURIX 2017-The 30th international conference on Legal Knowledge and Information Systems; 2017. p. 1-10. [3] World Wide Web Consortium. SPARQL Query Language for RDF. W3C Recommendation 15 January 2008;. Available from: https://www.w3.org/TR/rdf-sparql-query/. [4] Francesconi E, Governatori G. Patterns for legal compliance checking in a decidable framework of linked open data. Artificial Intelligence and Law. 2022:1-20. [5] World Wide Web Consortium. OWL 2 Web Ontology Language Document Overview (Second Edition). W3C Recommendation 11 December 2012;. Available from: https://www.w3.org/TR/ owl2-overview/. [6] Robaldo L, Batsakis S, Calegari R, Calimeri F, Fujita M, Governatori G, et al. Compliance checking on first-order knowledge with conflicting and compensatory norms: a comparison among currently available technologies. Artificial Intelligence and Law. 2023:1-51. [7] Anim J, Robaldo L, Wyner AZ. A SHACL-Based Approach for Enhancing Automated Compliance Checking with RDF Data. Information. 2024;15(12). Available from: https://www.mdpi.com/ 2078-2489/15/12/759. [8] Fischer MJ, Ladner RE. Propositional dynamic logic of regular programs. Journal of Computer and System Sciences. 1979;18(2):194-211. Available from: https://www.sciencedirect.com/science/ article/pii/0022000079900461. [9] van Eijck J, Ju F, Xu T. Modeling dynamics of legal relations with dynamic logic. Journal of Logic and Computation. 2023 Sep;34(2):372-98. Available from: https://doi.org/10.1093/logcom/ exac055. [10] Plaza J. Logics of public communications. Synthese. 2007;158(2):165-79. [11] Baltag A, Moss LS, Solecki S. The logic of common knowledge, public announcements, and private suspicions. In: Proceedings of the 7th Conference on Theoretical Aspects of Rationality and Knowledge (TARK 98); 1998. p. 43-56. [12] Markovich R. Understanding Hohfeld and formalizing legal rights: the Hohfeldian conceptions and their conditional consequences. Studia Logica. 2020;108(1):129-58. [13] Dong H, Roy O. Dynamic Logic of Legal Competences. Journal of Logic, Language and Information. 2021;30(4):701–724. Available from: http://dx.doi.org/10.1007/s10849-021-09340-z. [14] Van Doesburg R, Van Engers T. Explicit Interpretation of the Dutch Aliens Act. In: Proceedings of the Workshop on Artificial Intelligence and the Administrative State (AIAS 2019); 2019. p. 27-37. [15] Breteler J, van Gessel T, Biagioni G, van Doesburg R. The FLINT Ontology: An Actor-Based Model of Legal Relations. In: Knowledge Graphs: Semantics, Machine Learning, and Languages. IOS Press; 2023. p. 227-34. [16] Van Binsbergen LT, Liu LC, Van Doesburg R, Van Engers T. eFLINT: a domain-specific language for executable norm specifications. In: Proceedings of the 19th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences; 2020. p. 124-36. [17] Esterhuyse CA, M¨ uller T, van Binsbergen LT. A Stable Model Semantics for eFLINT Norm Specifications and Model Checking Scenarios. In: Proceedings of the 24th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences; 2025. p. 80-93. [18] Minsky M. A framework for representing knowledge. MIT, Cambridge; 1974. [19] Salmond JW. Jurisprudence: Or, The Theory of the Law. Stevens and Haynes; 1907. [20] Hohfeld WN. Some fundamental legal conceptions as applied in judicial reasoning. The Yale Law Journal. 1913;23(1):16.