1 Introduction

Modeling legal rules represents a precondition for developing systems endowed with automatic reasoning facilities for advanced information services in the legal domain. In literature several approaches have been proposed aiming to formalize legal rules to support automatic reasoning, as reasoning on deontic notions (Gabbay et al. 2013), reasoning for norm compliance (Hashmi and Governatori 2018) or for legal argumentation (Prakken and Sartor 2015).

The current successful trend of Semantic Web implementation according to a Linked Open Data (LOD) approach is producing, and is supposed to produce in the next few years, a huge and growing amount of data, semantically qualified, available for sharing and reuse. RDFFootnote 1 is the language of the Semantic Web, able to describe a scenario of interest by triples composed by master data (namely entities like concepts or real world objects), metadata (namely properties of such entities) and their values (reference data). Such RDF triples are able to provide a semantic description of a specific domain: for example in the legal one, they can describe concepts, legal rules and facts. In the next future the ability of a legal information system to process Linked Open Data and to show legal reasoning capabilities will be an essential aspect for having an automatic legal assistant in large scale, endowed with AI capabilities. Legal information retrieval, eDiscovery, legal compliance checking, on-line dispute resolution are just few examples of services which can profit from the representation of legal knowledge in the Semantic Web in terms of rules amenable for computation.

In this paper we propose an automatic legal compliance checking framework describing legal rules using Semantic Web standards. This framework has been firstly presented in Francesconi (2019), Francesconi and Governatori (2019), while this work presents more extended examples, as well as a generalisation of the approach in terms of a formal model based on recurrent modeling patterns. The approach guarantees the computational tractability of the problem within the Description Logic framework. As developed for the Semantic Web standards, this approach has its natural application in such a scenario like a LOD environment, however it can also be applied in other environments which can exploit the potential of the Semantic Web standards and related reasoning facilities.

This paper is organized as follows: in Sect. 2 a contextual background about Semantic Web languages and their computational complexity are introduced; in Sect. 3 a review of related works about legal reasoning is given, including examples within a description logic computational complexity; in Sect. 4 the distinction between the concepts of Provision and Norm from the legal theory point of view is discussed (Marmor 2014); in Sect. 5 an approach for modeling norms using ontologies, able to implement norm compliance checking within a decidable computational framework is described and tested on examples; in Sect. 6 the ability of the approach to deal with norm defeasibility is presented; in Sect. 7 a generalisation of such an approach is proposed by identifying patterns for modeling deontic norms and norms compliance checking. Finally, in Sect. 8 some conclusions and possible future developments are reported.

2 Semantic technologies background

For sharing information on the Web in a way that is understandable by both humans and machines, the Semantic Web and LOD principles recommend to use OWL/RDF(S)Footnote 2 standards, able to provide a semantic description of an information scenario of interest. RDF is used for describing instances of such scenario in terms of classes and properties, OWL (including RDF Schema) is the language for representing knowledge models (ontologies) able to give meaning to such classes and properties.

OWL can be used at different levels of expressiveness, introducing different levels of computational complexity: OWL-Full is not decidable, namely an algorithm able to guarantee inferences in a finite time does not exist; OWL-DLFootnote 3 is a decidable fragment of OWL-Full, namely there are algorithms able to guarantee inferences in a finite time; finally OWL-Lite is a decidable fragment of OWL-DL, with reduced expressiveness. For OWL-DL (hence for OWL-Lite) several reasoners have been developed, like Pellet,Footnote 4 Racer,Footnote 5 HermiT,Footnote 6 able to generate inferences based on a knowledge model. More recently OWL 2Footnote 7 has been introduced to extend the expressiveness of OWL, keeping the same three levels of complexity, while introducing three additional decidable languages, optimized in terms of expressiveness and computability, for specific tasks: OWL 2-EL for ontologies with large amount of classes and properties; OWL 2-QL for the purpose of managing large volumes of data; OWL 2-RL for applications that require scalable ways of reasoning without sacrificing the expressive power of the language.

In the Semantic Web, the implementation of decidable profiles of OWL or OWL 2Footnote 8 guarantees the computational tractability of specific types of reasoning, in particular reasoning for legal information, like advanced legal information retrieval and norm compliance (Gandon et al. 2017), while it allows us to use already available reasoners.

For representing legal information in the Semantic Web, languages like OWL/ RDF(S) for modeling real world scenarios are usually used, as well as mainly SWRL or RIF for representing legal rules governing such scenarios. Recently, LegalRuleML for modeling legal rules, including defeasible rules representation and defeasible reasoning, has been proposed (Athan et al. 2015; Governatori et al. 2016).

3 Related works

OWL is the state-of-the-art language for knowledge modeling in the Semantic Web, effectively used for creating ontologies able to represent concepts and relations of real world scenarios (Casellas 2008): examples in the legal informatics literature are LRI-Core (Breuker 2004), LKIF (Hoekstra et al. 2007), CLO (Gangemi et al. 2005), DALOS (Agnoloni et al. 2007), PrOnto (Palmirani et al. 2018). On the other hand, in the Semantic Web legal rules have been represented in literature using a variety of languages. Hoekstra et al. (2009) proposed to use SWRL or RIF in combination with an ontological representation of norms and facts. Gordon (2011) introduced rules description using specific XML schemas in combination with ontologies. More recently LegalRuleML (OASIS 2017), as specialization of the RuleML standard, has been proposed as language for representing legal rules.

In the last few years several studies have been made to approach the problem of legal reasoning in a decidable computational complexity profile. Van de Ven et al. (2008) proposed HARNESS, a knowledge-based system developed within the ESTRELLA project, able to implement reasoning over norms for legal assessment, basically the evaluation whether a case is allowed or disallowed given an appropriate body of legal norms. HARNESS includes two knowledge bases: a domain ontology and a set of norms representing the normative articles. Both are developed within the OWL 2 DL profile. Assessment consists in classifying individuals and properties making up a case description in terms of both ontology and norms simultaneously. The result tells whether norms are violated or not. Ceci and Gangemi (2016) developed an OWL 2 judicial ontology library (JudO) representing the interpretations performed by a judge when conducting legal reasoning towards the adjudication of a case. On the other hand, Ceci in Ceci (2013) combines the features of description logic-based ontologies with non-monotonic logics such as the defeasible one. Deontic extensions of Defeasible Logic have been proposed (Governatori et al. 2013) and efficient implementations have been developed (Lam and Governatori 2009) and successfully tested on larges scale encodings (Governatori et al. 2020; Witt et al. 2021). To achieve effective reasoning with large dataset, integration with relational databases has been proposed (Islam and Governatori 2018). However, until recent, there was a limited integration with ontologies; to obviate this issue (Bhuiyan et al. 2020) proposed a combination of ontologies and SPARQL queries and a defeasible reasoner for the modeling compliance of autonomous vehicles against traffic rules. Another approach based on non-monotonic reasoning is the PROLEG system proposed by Satoh and coworker created initially to provide a formal model of the Japanese Civil Code (Satoh et al. 2009; Fungwacharakorn et al. 2021). Batsakis et al. (2018) discussed and comparised some pratical implementations for reasoning with legal norms.

A formal framework for reasoning on normative requirements for regulatory compliance is presented by Hashmi et al. (2016). The proposed framework is independent of any existing formalism, and provides a conceptual representation of the semantics of norms needed for business process compliance checking. The framework has been implemented and tested (Governatori et al. 2016; Palmirani and Governatori 2018). On the other hand, recently Gandon et al. (2017) proposed an approach to represent legal rules as Linked Open Data. It aims to respond to the requirements of representing the deontic aspects of normative rules and reasoning on them with Semantic Web languages, as RDFS and OWL for knowledge representation and SPARQL for queries. The rationale of the proposed approach is coupling OWL reasoning with SPARQL rules to formalize and implement legal reasoning (as for example deontic reasoning and compliance checking). In particular normative requirements are represented using LegalRuleML and the deontic conclusions of legal rules are added to each named graph of the concerned state of affairs. Recently, implementation of LegalRuleML have been provided with provisions to integrate with other Semantic Web technologies (Lam and Hashmi 2019; Robaldo 2021). For the particular case of legal compliance checking, van Hee et al. (2010) and Ramezani et al. (2013) showed other approaches based on Petri-Net patterns and alignments. For a survey of regulatory compliance checking in the context of business process see (Hashmi and Governatori 2018).

The main contribution of this paper with respect to the literature is that it presents an approach for legal compliance checking based on the distinction between Provisions and Norms represented by using decidable fragments of OWL 2/RDF(S) for knowledge modeling and rules representation. This allows us to rely on available decidable reasoners, while leaving to SPARQL the sole task to query the dataset of inferred triples in order to verify deontic conclusions or norm compliance. Moreover, the approach is able to cope with defeasible rules.

4 Provisions and norms

According to the legal theory point of view, the legal order can be seen as a legal discourse composed by linguistic entities or speech acts (Searle 1969) with descriptive or prescriptive functions. Every linguistic entity can be seen in a twofold perspective: as a set of signs organized in words and sentences, as well as the meaning of such signs. Following the same twofold view for the legal domain, we can distinguish two levels of interpretation of a linguistic entity expressing a legal rule: in terms of a set of signs organized in words and sentences for creating a normative statement, typically called Provision (Raz 1980; Biagioli 2009), as well as in terms of the meaning for application of such normative statement, typically called Norm (Guastini 2010; Marmor 2014).

Provisions have been classified in Biagioli (2009) in terms of provision types, organised into two main groups (Fig. 1): Rules and Rules on Rules. Rules can be Constitutive Rules as Definition introducing entities, or Regulative Rules as the deontic concepts Duty and Right (or in a more deontic oriented terms Obligation and Permission), as well as Power etc., regulating subject roles and activities. Rules on Rules are different kinds of amendments: Temporal, Extension or Content amendments. Each provision type is characterized by specific attributes (for example the Bearer or the Counterpart of a Right/Permission), reflecting the lawmaker directions. Provision types and attributes can be considered as a sort of metadata model able to analytically describe fragments of legislative texts, hence the name of Provision Model (Biagioli 2009).

Fig. 1
figure 1

The Provision Model top classes (“prv:” is the namespace for provisions)

In this vision, norms represent the way how provisions are applied; as such they represent the product of an interpretative process (Kelsen 1991). Provisions and related norms have, therefore, different roles and properties pertaining to different abstraction levels. Moreover, there may be not a bijective relationship between them: a norm can be expressed by different provisions, as well as it can be valid the opposite, namely one provision can include more norms (Pino 2016). They have also different relationships with time. Provisions, as pure textual objects, are the product of lawmaking (legal drafting activity and promulgation) and are characterized by the in-force date, namely the starting date of their existence in the legal order. On the other hand, norms are the meaning of provisions, namely their applicative interpretation; as such they are characterized by the efficacy date, namely the starting date in which a norm can be concretely applied. For example a taxation rule, in-force at time \(t_1\) (time when the related provision enters the legal order), can express the application of a specific tax starting from time \(t_2\) (\(> t_1\)). In this case \(t_2\) is the efficacy date of the norm. Therefore (see Table 1), while it is obvious that we can have cases of provisions in-force and related norms effective, as well as provisions not in-force and related norms not effective, we can also have provisions in-force and related norms not effective, as well as the symmetric case, provisions not in-force and related norms effective (this last one is usually referred as retro-activity (efficacy in the past) or ultra-activity (efficacy in the future) of a norm.

Table 1 Relationship with time of Provision and Norm

Having different nature, such concepts operate in different domains.

A provision, as pure textual object, represents the building block of the legal order (new provisions can enter or leave the legal order itself). On the other hand, a norm can either modify the text of other provisions (in case of different type of amendments) or can introduce restrictions on the real world (in case of obligations, for example).

Advanced legal information retrieval, able to implement reasoning on deontic notions, is a type of reasoning managing textual information, thus pertaining to provisions. A typical example is a system able to implement Hohfeldian reasoning, in which a user submits a query to a legal document collection in order to find the rights/permissions of a bearer A towards a counterpart B: following an Hohfeldian reasoning the system should be able to retrieve back also the provisions expressed as duties/obligations of the bearer B towards the counterpart A, because such obligations can also be seen as A’s permissions. An OWL 2 DL approach using the Provision Model for this type of reasoning is illustrated in Francesconi (2014, 2016).

On the other hand, legal compliance checking is a process aiming to verify if a fact, occurring in the real world, complies with existing norms. Real world scenarios and facts can be effectively represented in terms of ontologies and related individuals, respectively. Norms, which facts have to be compliant with, provide constraints on the reality, therefore they can be modeled as restrictions on ontology properties. Such modeling can be used for legal compliance checking. Hereinafter we illustrate an OWL 2 DL approach for modeling norms and how such modeling can be used for the aim of legal compliance checking.

5 Modeling norms for legal compliance checking

Let’s consider two examples of legal rules, R1 and R2, to illustrate our approach:

  1. R1:

    The supplier shall communicate to the consumer all the contractual terms and conditions

  2. R2:

    According to a [country] law, one cannot drive over 90 km/h

Both rules are speech acts, namely Provisions in specific regulations. In this sense R1,Footnote 9 can be classified as an Obligation of a Supplier towards a Consumer, while R2 can be classified as an Obligation for any Driver in a specific country. The related modeling, according to the Provision Model approach described in Francesconi (2016), can support advanced legal information retrieval, including Hohfeldian reasoning.

On the other hand, when we consider the application of rules like R1 or R2 on specific facts, we actually talk about Norms. As previously discussed, norms can be viewed as constraints on the real world scenario to be regulated.

5.1 Norm R1 representation and facts compliance checking

In case of R1, the scenario which R1 applies to, can be modeled in terms of an ontology including a class Supplier, having a boolean property hasCommunicatedConditions. In OWL 2 terms, the scenario concerning R1 can be expressed as in Fig. 2, where myo: is a fictitious namespace for the ontology “MyOntology”.

Norm R1, expressing an obligation, states that suppliers must communicate purchasing conditions to the consumers. In our approach, norm R1 is represented as a restriction on the property hasCommunicatedConditions able to identify the class SupplierR1Compliant of individuals for which the value of the property under consideration is “true”, as shown in Fig. 2. The individuals of the class Supplier complying with this norm are all those and only those belonging to the subclass SupplierR1Compliant (Fig. 2). Such a representation for the real world scenario and related norm expressed by R1, results in the OWL 2 DL decidable profile. This modeling allows us to use a OWL 2 DL decidable reasonerFootnote 10 in order to implement reasoning facilities as compliance checking with respect to R1. The inferred model produced by the DL reasoner establishes the rdfs:subClassOf relation between SupplierR1Compliant and Supplier (as shown in Fig. 2). Therefore, compliance checking according to the norm R1 is a problem of checking if an individual of type Supplier belongs also to the class SupplierR1Compliant.

Fig. 2
figure 2

Norm R1 represented as restriction on the Supplier’s property hasCommunicatedConditions and examples of non-compliant (s1) and compliant (s2) individuals (note that the subclass relation between SupplierR1Compliant and Supplier is inferred)

As a concrete example let’s consider the two individuals s1 and s2 (Fig. 2) of the class Supplier. s1 is an individual not compliant with R1, while s2 is complaint with R1. The following SPARQL query

$$ \texttt {SELECT\,?x\, WHERE\;\{\;?x\;rdf:type\;myo:DriverR2Compliant\;\}} $$

is able to select the individuals which are complaint with R1 (in our case s2). Legal reasoning in terms of norm compliance checking is therefore performed in a LOD framework, using available reasoners in a decidable computational complexity profile.

5.2 Norm R2 representation and facts compliance checking

In case of R2, the vehicle drivers circulation scenario can be modeled in terms of an ontology including a class Driver, having a datatype property hasDrivingSpeed with range in the xsd:float datatype. In OWL 2 terms, the vehicle drivers circulation scenario concerning R2 can be expressed as in Fig. 3.

Norm R2, expressing an obligation, states that, according to a specific country law, one cannot drive over 90 km/h. In our approach norm R2 is represented as a restriction on the property hasDrivingSpeed able to identify the class DriverR2Compliant of individuals for which the values of the property under consideration are in the range [0.0 km/h, 90.0 km/h], as shown in Fig. 3. In order to represent such constraints, the following restriction on the datatype property myo:hasDrivingSpeed to values (inclusively) between 0.0 and 90.0 km/h can be expressed by the xsd:minInclusive and xsd:maxInclusive datatype bound properties. The individuals of the class Driver complying with this norm are all those and only those belonging to the subclass DriverR2Compliant (Fig. 3). Also such a representation for the real world scenario and related norm, expressed by R2, results in the OWL 2 DL decidable profile. As in the previous example, the inferred model, produced by the DL reasoner, establishes a rdfs:subClassOf relation between DriverR2Compliant and Driver (as shown in Fig. 3). Therefore, compliance checking according to the norm R2 is a problem of checking if an individual of type Driver belongs also to the class DriverR2Compliant.

Fig. 3
figure 3

Norm R2 represented as restriction on the Driver’s property hasDrivingSpeed and examples of compliant (d1, d2, d3) and non-compliant (d4) individuals

As a concrete example, let’s consider the four individuals of the class Driver shown in Fig. 3. The individual d4 is not compliant with R2 (having speed 95.0 Km/h ≥ 90.0 Km/h) (Fig. 3). The following query

$$ \texttt {SELECT\,?x\, WHERE\;\{\;?x\;rdf:type\;myo:DriverR2Compliant\;\}} $$

is able to select the individuals which are complaint with R2 (in our case d1, d2 and d3). Also in this case norm compliance checking is performed within a decidable computational complexity profile.

6 Modeling norms defeasibility for legal compliance checking

Defeasibility is the property of an argumentation system for which a conclusion is open to revision in case evidence to the contrary is provided (Athan et al. 2015). This particularly holds in legal reasoning which is a typical case of non-monotonic reasoning, where norm conflicts or norm exceptions might breach a previous conclusion. In this section, two examples, one dealing with norm conflict and one with norm exception, are modeled within a description logic framework. We also show how such modeling can provide support for defeasible legal reasoning, for example in norm compliance checking.

As first example, let’s consider rule R2, modeled in Sect. 5, and the following new version of rule R2, introducing a more strict driving speed limit at 80 Km/h:

  1. R2:

    According to a [country] law, one cannot drive over 80 km/h

The new version of R2 can defeat the previous compliance conclusions, in the sense that individuals, which were compliant with the old version of R2, might not be compliant with it anymore (this is the case in the example in Fig. 4 of the individual d3). In order to cope with this change, the same model (without changing anything on the names of the classes) can be updated just by changing the original restriction on the datatype property hasDrivingSpeed with a new one expressed by the new version of R2, as shown in Fig. 4. Without changing anything on the individuals, their membership to the class DriverR2Compliant changes accordingly so that, for example, the individual d3, compliant with the old version of R2 (Fig. 3), is no more compliant with the new version of R2 (Fig. 4). Therefore, the query able to select compliant individuals remains the same:

$$\begin{aligned} \texttt {SELECT\,?x\, WHERE\,\{\; ?x\,rdf:type\,myo:DriverR2Compliant\;\}} \end{aligned}$$

it retrieves the only individuals compliant with the new version of R2, which are d1 and d2 .

Fig. 4
figure 4

New version of norm R2 represented as restriction on the Driver’s property hasDrivingSpeed and examples of compliant and non-compliant individuals

As second example, let’s consider the following rule R3Footnote 11 which establishes the limits for engaging credit activities in a jurisdiction, composed by the following 3 statements (\(R3 = R3a \cup R3b \cup R3c\)):

  1. (R3a)

    It is forbidden to engage in a credit activity without a credit license.

  2. (R3b)

    It is permitted to engage in a credit activity if acting on behalf of a principal and the principal holds a credit activity provided the principal has not been elected to the parliament.

  3. (R3c)

    It is permitted to engage in a credit activity if acting on behalf of a body corporate and the person has been appointed as representative of the body corporate.

The defeasibility of the norm R3 consists in an exception (R3a) which can defeat the previous compliance conclusions about the engagement of an agent in a credit activity, and in the exceptions of exception to it (R3b and R3c) which can defeat the conclusions about the prohibition established by R3a.

The whole scenario addressed by norm R3 can be modeled through an ontology (see Fig. 5) describing a class Agent and a specific subclass AgentEngagingCreditActivity of the subclass of agents who engage in a credit activity. Also in this case the deontic concepts Prohibition and Permission, expressed in R3a, R3b and R3c, are represented as restrictions on the datatype properties having domain AgentEngagingCreditActivity and expressing the conditions which the norm is subject to. The individuals of the class Agent can engage a credit activity, thus belonging to the subclass AgentEngagingCreditActivity. According to the constraints expressed in R3, individuals can:

  1. p1

    have a credit license (hasCreditLicense)

  2. p2

    act on behalf of a principal (isActingOnBehalfOfPrincipal)

  3. p3

    have principal holding a credit activity (isPrincipalHoldingCreditActivity)

  4. p4

    have principal elected in Parliament (isPrincipalElectedInParliament)

  5. p5

    act on behalf of a body corporate (isActingOnBehalfOfBodyCorporate)

  6. p6

    act as representative of a body corporate (isRepresentativeOfBodyCorporate)

Norm R3a states that engaging in a credit activity “is forbidden without a credit license”. Therefore, if an individual of the class AgentEngagingCreditActivity has a credit license (hasCreditLicence = “true”) the activity is permitted. This is modeled as restriction on the property hasCreditLicence so to create a subclass AgentEngagingCreditActivityR3aCompliant of individuals having “true” as value of the property hasCreditLicence. In Fig. 5 the individual ag2 is compliant to the norm R3a.

Fig. 5
figure 5

Norm R3 represented as restriction on the AgentEngagingCreditActivity’s properties (note that the subclass relations between AgentEngagingCreditActivity and classes of R3, R3a, R3b and R3c compliant or violating individuals are inferred)

Norm R3b states that the activity is permitted also when the individual “is acting on behalf of a principal” and “the principal holds a credit activity” and “the principal is not elected in Parliament”. This is modeled through a multiple restriction on the properties isActingOnBehalfOfPrincipal = true, isPrincipalHoldingCreditActivity = true and isPrincipalElectedInParliament = false, so to create a subclass of individuals for which the previous three restrictions contemporarily hold (the result is individuals belonging to the intersection of the subclasses created by the three restrictions). In Fig. 5 the individual ag3 is compliant with norm R3b, because it has the value “true” on both the properties isActingOnBehalfOfPrincipal and isPrincipalHoldingCreditActivity and “false” on the property isPrincipalElectedInParliament. Very similar considerations can be made for R3c modeling, concerning restrictions on the properties expressed by the conditions for individuals compliant with R3c.

The individuals compliant with the whole R3, composed by R3a, R3b and R3c, are therefore those belonging to the class AgentEngagingCreditActivityR3Compliant, obtained as disjoint union of the classes AgentEngagingCreditActivityR3aCompliant, AgentEngagingCreditActivityR3bCompliant, AgentEngagingCreditActivityR3cCompliant. In all the other cases, engaging in a credit activity is forbidden. Therefore, the individuals which do not respect the combination of property restrictions, violate norm R3, namely they belong to the class AgentEngagingCreditActivityR3Violating. In Fig. 5 the individual ag1 violates norm R3. The combination of the property restrictions p1, ..., p6 able to identify individuals violating norm R3 can be obtained by the negation of the combination of properties of compliant individuals. In the case of R3, and applying the De Morgan laws, we obtain:

$$\begin{aligned} &\lnot [p1 \vee (p2 \wedge p3 \wedge \lnot p4) \vee (p5 \wedge p6)] \\ & \quad = \lnot p1 \wedge (\lnot p2 \vee \lnot p3 \vee p4) \wedge (\lnot p5 \vee \lnot p6) \end{aligned}$$
(1)

In order to verify which individuals are compliant or are violating R3, the following queries on the inferred model are respectively sufficient:

$$\begin{aligned}&\texttt {SELECT\,?x\, WHERE}\\&\texttt {\{?x rdf:type myo:AgentEngagingCreditActivityR3Compliant\;\}} \end{aligned}$$
$$\begin{aligned}&\texttt {SELECT\,?x\,WHERE}\\&\texttt {\{?x rdf:type myo:AgentEngagingCreditActivityR3Violating\;\}} \end{aligned}$$

7 Patterns for deontic norms compliance checking

In this section we aim to generalise the approach presented in the previous sections, for representing deontic norms and implementing an automatic compliance checking procedure within a description logic computational framework.

The examples R1, R2 and R3, discussed in Sects. 5 and 6, represent deontic norms expressed in terms of prohibition, obligation or permission. More in general, given any action description A, prohibition, obligation and permission can be represented by formulas having the following structure:

  • Forb (A) (it is forbidden that A)

  • Oblig (A) (it is obliged that A)

  • Perm (A) (it is permitted that A)

As underlined in Sartor (2006) a minimal deontic logic can be expressed through the following definitions and axioms:

  • Being prohibited to perform an action means being obliged not to do it (Forb A = Obl NOT A).

  • Being permitted to perform an action means not being forbidden to do it (Perm A = NOT Forb A).

  • Being obliged to perform an action entails being permitted to perform it (IF Obl A THEN Perm A).

  • Being both obliged to perform action A and obliged to perform action B entails being obliged to perform both actions (IF (Obl A AND Obl B) THEN Obl (A AND B)).

Given the previous relations, the following implications hold:

$${\textbf{Forb}} (A) = {\textbf{Obl}} (\lnot A) \Longrightarrow {\textbf{Forb}} (\lnot A) = {\textbf{Obl}} (A)$$
(2)
$${\textbf{Perm}} (A) = \lnot {\textbf{Forb}} (A) \Longrightarrow \lnot {\textbf{Perm}} (A) = {\textbf{Forb}} (A)$$
(3)

Combining Eqs. (2) and (3) we have:

$${\textbf{Forb}} (A) = \lnot {\textbf{Perm}} (A) = {\textbf{Obl}} (\lnot A)$$
(4)

An example of equivalent relations at (4) is the statement R3a):

It is forbidden to engage in a credit activity without a credit license.

which is equivalent to:

It is not permitted to engage in a credit activity without a credit license.

and also equivalent to:

It is obliged to engage in a credit activity with a credit license.

where the action description A is:

to engage in a credit activity without a credit license.

An action description A can be decomposed in terms of a subject category S expressing behavioural or productive actions (Sartor 2006), as well as a set of properties \(p_i,\) whose negation \(q_i = \lnot p_i,\) represent conditions for A.

Therefore we have:

$${\textbf{Forb}} (A) = {\textbf{Forb}} (\textit{S} (q_1 \wedge q_2 \wedge ... \wedge q_i))$$
(5)

For example, being

  • R3a = It is forbidden to engage in a credit activity without a credit license

and given

  • A = To engage in a credit activity without a credit license

  • S = Agent engaging in a credit activity

  • \(q_1 = \lnot p_1 = {Has\; not\; credit\; license}\)

R3a can be expressed as:

  • R3a = it is forbidden that S without credit license

and represented as follows

  • R3a = Forb (S \((q_1)\))

Forb (A) can also be expressed as an obligation of \(\lnot A\) as follows:

$${\textbf{Forb}} (A) = {\textbf{Obl}} (\lnot A)$$
(6)
$$\begin{aligned}&{\textbf{Obl}} (\lnot S (q_1 \wedge q_2 \wedge ...\wedge q_i)) = {\textbf{Obl}} (S (p_1 \wedge p_2 \wedge ... \wedge p_i)), where\; p_i = \lnot q_i \end{aligned}$$
(7)

For example, considering

  • R3a = it is forbidden that S engages in a credit activity without credit license

  • = it is obligatory that S engages credit activity with credit license

    we have

  • R3a = Forb (S (\(q_1\))) = Obl (S (\(p_1\))) where:

  • S = Agent engaging in a credit activity

  • \(p_1\) = Has credit license

  • \(q_1 = {Has \; not\; credit\; license}\)

Therefore, given that Forb (A) = Obl (\(\lnot A\)) and Forb (\(\lnot A\)) = Obl (A), we can model the related norms, equivalently in terms of either obligation or prohibition. For example the norm R = Forb (A) = Obl (\(\lnot A\)) can be modeled in terms of:

  • S, representing the class of subjects which the norm applies to;

  • \(p_i\) (= \(\lnot q_i\)) representing the properties of S;

  • conjuction/disjunction of the properties restrictions \(p_i\) (= \(\lnot q_i\)) expressing the conditions which the norm is subject to.

Such restrictions create a subclass [S]RCompliant of all the individuals of the class S which are compliant with R, for which:

$$\begin{aligned} \bigwedge \limits _{i}{} p_i = true \quad \text{ or } \quad \lnot \bigvee \limits _{i}{}q_i = true \quad \text{ where: } \quad p_i = \lnot q_i \end{aligned}$$
(8)

While deontic qualifications “obligatory” and “forbidden” are complete (Sartor 2006), meaning that both the action they are concerned with and the complement of that action is completely determined, this is not the case of a permission. In fact, as pointed out by Sartor in Sartor (2006), if we only know that an action is permitted, we do not know the status of its complement. In particular, when a positive action is permitted (namely, the action is not forbidden: \({\textbf{Perm}} (A) = \lnot {\textbf{Forb}} (A)\)), then its omission can be either likewise permitted or forbidden (this will be the case when the action, besides being permitted, also is obligatory) (Sartor 2006).

Norm compliance can be deterministically checked when its deontic qualification is complete. For a permission this consists in two cases for an action S :

  1. 1.

    \({\textbf{Perm}} (S(p_1, p_2, ...p_i)) \wedge {\textbf{Perm}} (\lnot S(p_1, p_2, ...p_i))\): both the action A is permitted and its negation is permitted (in this case we talk about facultativeness) Sartor (2006)

  2. 2.

    \({\textbf{Perm}} (S(p_1, p_2, ...p_i))\) is an exception, subject to conditions \(p_1, p_2, ...p_i\), of a prohibition

The second case, in particular, can be explicitly expressed as a combination of norms, as for the cases R3a) and R3b) of our example in Sect. 6, or can be implicit, as for example a norm giving the possibility to smoke in a restaurant having a proper ventilation system, whose deontic qualification is complete because it represents an exception, subject to condition, to the more general norm which prohibits to smoke in restaurants.

In case of permissions, therefore, compliance can be checked when the deontic status of the action is complete, therefore it is associated with another norm expressing the permission of the complement of that action, or expressing the prohibition of that action, whose specialisation according to conditions is actually permitted. This means that, in case of permissions, compliance checking of an action has to involve the analysis of the norms which determine its complete deontic status. On the other hand, by analysing just a permission qualification of an action, we can deterministically conclude that, if an individual performs a permitted action, this individual is compliant with that permission, even if we cannot say anything about the compliance or not of the complement of that action.

In our approach checking compliance with a permission means verifying if an individual performs a permitted action, resulting compliant with that permission. The evaluation of the compliance or not compliance of the complement of that action is left to other related norms, if any, contributing to the complete deontic qualification of the permission. This is actually what happens when we want to determine the deontic status of an action by permissions interpretation.

Therefore, given that \({\textbf{Perm}} (A) = \lnot {\textbf{Forb}} (A),\) a permission can be modeled according to the approach followed for other deontic norms.

Following the notation previously introduced, since \(A = S (p_1 \wedge p_2 \wedge ... \wedge p_n),\) for a permission whose deontic qualification is complete, we have:

$$\begin{aligned} {\textbf{Perm}} (S (p_1 \wedge p_2 \wedge ... \wedge p_n))&= \lnot {\textbf{Forb}} (S (p_1 \wedge p_2 \wedge ... \wedge p_n))\nonumber \\&= {\textbf{Forb}} (S (\lnot p_1 \vee \lnot p_2 \vee ... \vee \lnot p_n)) \end{aligned}$$
(9)

For example considering:

  • R3b = It is permitted to engage in a credit activity if acting on behalf of a principal and the principal holds a credit activity provided the principal has not been elected to the parliament

    $$\begin{aligned} R3b = {\textbf{Perm}} (\textit{S} (p_1 \wedge p_2 \wedge p_3))&= {\textbf{Forb}} (S (\lnot p_1 \vee \lnot p_2 \vee ... \vee \lnot p_n)) \end{aligned}$$
    (10)
    $$\begin{aligned}R3b = {\textbf{Perm}} (\textit{S} (p_1 \wedge p_2 \wedge p_3))&= {\textbf{Forb}} (S (q_1 \vee q_2 \vee ... \vee q_n)) \end{aligned}$$
    (11)

    where S = “agent engaging credit activity”, \(p_1\) = “is acting on behalf of a principal”, \(p_2\) = “is principal holding a credit activity”, \(p_3\) = “is principal not elected in parliament”, \(q_1\) = “is not acting on behalf of a principal”, \(q_2\) = “is principal not holding a credit activity”, and \(q_3\) = “is principal elected in parliament”.

The norm R = \({\textbf{Perm}} (A) = \lnot {\textbf{Forb}} (A)\) can be modeled in terms of:

  • S, representing the class of subjects which the norm applies to;

  • \(p_i\) (= \(\lnot q_i\)) representing the properties of S;

  • conjuction/disjunction of the properties restrictions \(p_i\) (= \(\lnot q_i\)) expressing the conditions which the norm is subject to.

Such restrictions create a subclass [S]RCompliant of all the individuals of the class S which are compliant with R, for which:

$$\begin{aligned} \bigwedge \limits _{i}{} p_i = true \quad \text{ or } \quad \lnot \bigvee \limits _{i}{}q_i = true \quad \text{ where: } \quad p_i = \lnot q_i \end{aligned}$$
(12)

Similarly, the detection of the violation of norm R, whose deontic qualification is complete, results in the identification of the individuals which do not respect the combination of property restrictions of R. Such individuals belongs to the class [S]RViolating of the individuals for which the combination of properties \(p_i\) of compliant individuals are negated.

$$\begin{aligned} \lnot \bigwedge \limits _{i}{} p_i = true \quad \text{ or } \quad \bigvee \limits _{i}{}q_i = true \quad \text{ where } \quad p_i = \lnot q_i \end{aligned}$$
(13)

Note that the approach aims to test compliance of state of affairs (namely individuals of the real world scenario and facts) with respect to the norms, not to provide a framework for fully fledged reasoning about norms (namely deriving automatic conclusions giving premises).

8 Conclusions and future developments

In this paper we have presented an approach for legal compliance checking within the Semantic Web, to be effectively applied in a Linked Open Data framework. It is based on the representation of deontic norms, as distinct from the related provisions, in terms of domain ontology and ontology properties restrictions. The approach is implemented by decidable fragments of OWL 2, able to guarantee computational tractability and the possibility of using available reasoners. We have also shown how this approach can handle norm defeasibility.

Future developments of this work can use more complex modalities to express constraints for specific properties, as using SHACL.Footnote 12 Moreover, this approach can be used as a reference model for automatic procedures aimed to extract norms from legal texts and represent them “as code” with the aim of automatic compliance checking of specific state of affairs.