<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Validation of Evolving Graphs</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Shqiponja Ahmetaj</string-name>
          <email>shqiponja.ahmetaj@tuwien.ac.at</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Magdalena Ortiz</string-name>
          <email>magdalena.ortiz@tuwien.ac.at</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mantas Šimkus</string-name>
          <email>mantas.simkus@tuwien.ac.at</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute of Logic and Computation</institution>
          ,
          <addr-line>TU Wien</addr-line>
          ,
          <country country="AT">Austria</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2024</year>
      </pub-date>
      <abstract>
        <p>SHACL (SHApe Constraint Language) is a W3C standardized constraint language for RDF graphs. In this paper, we study SHACL validation in evolving RDF graphs. We identify an update language that can capture intuitive and realistic modifications on RDF graphs and study the problem of static validation under updates, which asks to verify whether a given RDF graph that validates a set of SHACL constraints will remain valid after applying a set of updates. Reducing this problem to usual validation (for a minor SHACL extension) on the current graph allows us to identify problematic updates before applying them to the graph, thus avoiding incorrect and costly computations on potentially huge RDF graphs. More importantly, it provides a basis for further services for reasoning about evolving RDF graphs. In this spirit, we provide preliminary results for a version ofstatic validation under updates that verifies whether every graph that validates a SHACL specification will still do so after applying a given update sequence. This result builds on previous work that addresses analogous problems but using Description Logics instead of SHACL to describe conditions on graphs.</p>
      </abstract>
      <kwd-group>
        <kwd>SHACL</kwd>
        <kwd>static analysis</kwd>
        <kwd>evolving data graphs</kwd>
        <kwd>update language</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>CEUR
ceur-ws.org</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>updates, which asks whether a given RDF graph will validate a SHACL shapes graph after
applying a sequence of updates. In this way, problematic updates may be detected before they
are applied, avoiding costly incorrect computations. We also provide preliminary results for a
more interesting version ofstatic validation under updates that verifies whether every graph
that validates a SHACL specification will still do so after applying a given update sequence.</p>
      <p>
        In our previous work [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], we explored the dynamics of graph-structured data that evolves
through user or application operations, and investigated validation under updates and related
reasoning problems. At that time, in the absence of a widely accepted language for describing
the states of data instances and expressing constraints on them, we used a custom description
logic (DL) [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]—akin to the two-variable fragment of first-order logic with counting quantifiers—
that allowed us to efectively reduce static verification to its consistency problem, which is
decidable. Now, almost a decade later, SHACL has been developed and standardized specifically
for describing the types of constraints and conditions on graphs advocated in that work1][.
Ensuring that SHACL constraints are preserved during RDF graph updates is essential for
maintaining data integrity and validity. We revisit the ideas from 1[], focusing on SHACL
validation during RDF graph updates, and aim to leverage existing SHACL tools to perform
validation under these updates.
      </p>
      <p>
        This work describes our first steps in this direction. We present a framework for specifying
transformations on RDF graphs in the presence of SHACL constraints. We propose a language
to express modifications on RDF graphs, related to SPARQL Update, but also allowing sequences
of updates that admit conditional actions. In particular, the update language uses SHACL shapes
for selecting nodes or arcs for modification and for expressing the preconditions in conditional
actions. We then study the problem ofvalidation under updates in this setting, using SHACL
to describe the constraints that are to be preserved and in particular, we adapt theregression
method from [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], which rewrites the input shapes graph by incorporating the efects of the
actions ’backwards’. This allows us to show that validation under updates can be reduced
to standard validation in a small extension of SHACL. We also present some initial work on
a stronger, data independent form of static validation under updates, which checks whether
the execution of a given action preserves the SHACL constraints for every initial data graph.
Using the regression technique, we show that static validation under updates can be reduced
to (un)satisfiability of a shapes graph in (a minor extension of) SHACL. Since satisfiability is
known to be undecidable already for plain SHACL 3[], we leverage the results of [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] to identify
an expressive fragment for which the problem is feasible incoNexpTime.
      </p>
    </sec>
    <sec id="sec-3">
      <title>2. SHACL Validation</title>
      <p>
        In this section, we introduce RDF graphs and SHACLvalidation. We follow the abstract syntax
and semantics for the fragment of SHACL core studied in 5[]; for more details on the W3C
specification of SHACL core we refer to [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], and for details of its relation with DLs to 7[, 8].
RDF Graphs. We let   ,   ,   denote countably infinite, mutually disjoint sets of nodes
(constants), class names, and property names, respectively. An RDF (data) graph  is a finite set
of (ground) atoms of the form () and (, ) , where  ∈   ,  ∈   , and ,  ∈   .
expression  obeying the syntax:
      </p>
      <sec id="sec-3-1">
        <title>Syntax of SHACL.</title>
        <p>We assume a countably infinite set   of shape names, disjoint from
in  
  ,   ,   . A shape atom is an expression of the form() , where  ∈   and  ∈   . A
path expression  is a regular expression built using the usual operators∗, ⋅, ∪ from symbols
+ =   ∪ { − ∣  ∈   }, where  − is the inverse property of  . A (complex) shape is an
,  ′ ∶∶= ⊤ ∣  ∣  ∣  ∣  ∧</p>
        <p>′ ∣ ¬ ∣≥  . ∣  =  ∣ (, ) ∣ ( )
where  ∈   ,  ∈ 
 ,  ∈   ,  is a set of property names,  is a positive integer, and is a path</p>
        <p>′ instead of ¬(¬ ∧ ¬ ′); ≥  instead of ≥ .⊤ ; ∃.
expression. In what follows, we write ∨ 
instead of ≥1 .
; ∀.</p>
        <p>instead of ¬∃.¬ .</p>
        <p>A (shape) constraint is an expression of the form ↔  , where  ∈   and  is a possibly
complex shape. Targets in SHACL prescribe that certain nodes of the input data graph should
validate certain shapes. Atarget expression is of the form ( , ) , where  is a shape name and 
takes one of the following forms:
• constant from   , also called node target,
• class name from   , also called class target,
• expressions of the form∃ with  ∈   , also called subjects-of target,
• expressions of the form∃ − with  ∈   , also called objects-of target.</p>
        <p>A target is any set of target expressions. Ashapes graph is a pair (, ) , where  is a set of
constraints and  is a set of targets. We assume that each shape name appearing in  occurs
exactly once on the left-hand side of a constraint, and each shape name occurring in must
also appear in  . A set of constraints is recursive, if there is a shape name in  that directly or
indirectly refers to itself. In this work, we focus onon-recursive constraints.</p>
      </sec>
      <sec id="sec-3-2">
        <title>Semantics of SHACL.</title>
        <p>The semantics of SHACL can naturally be given in terms of
interand an interpretation function⋅ that maps each shape name or class name  ∈ 
pretations. More precisely, an interpretation consists of a non-empty finite domain Δ ⊂  
set   ⊆ Δ and each property name  ∈   to a set of pairs   ⊆ Δ × Δ. The evaluation of
complex shape expressions w.r.t. an interpretation is given in terms of a function⋅ that maps
 ∪   to a
a shape expression  to a set of nodes, and a path expression to a set of pairs of nodes as
in Table 1. Then, an interpretation  satisfies a constraint s ↔  if s =   , and  satisfies a
shapes graph (, )
, if  satisfies all constraints in  and   ⊆   for each( , ) ∈ 
. If  satisfies
Γ, for Γ a constraint, set of constraints, target, or shapes graph, we say is a model of Γ and
denote it in symbols by  ⊧ Γ . An interpretation  is a shape assignment for a data graph  , if

 = { ∣ () ∈ }
for each class name , and   = {(, ) ∣ (, ) ∈ }
for each property name  .</p>
        <p>Intuitively,  is a shape assignment for  if class and property names are interpreted as specified
by  . For simplicity, in this work, we view shape assignments as sets of atoms of the form
 ∪  , where  = {() ∣  ∈</p>
        <p>} is a set of shape atoms. A data graph  validates a shapes graph
(, )</p>
        <p>if there exists a shape assignment  for  that satisfies (, ) .</p>
        <p>Clearly, for non-recursive constraints, which is the setting we consider here, the unique
assignment  ,</p>
        <p>obtained in a bottom-up fashion, starting from and evaluating each
constraint once, is a model of . More precisely, since the constraints i n are non-recursive,
⊤ = Δ</p>
        <p>= {}
s = { ∣ s() ∈  }
(≥ .)  = { ∣ |{(, ) ∈ ()
( = )  = { ∣ ∀ ∶ (, ) ∈ ()
 and  ∈ ()  }| ≥ }
 if (, ) ∈ ()</p>
        <p>}
((, ))
(())
 = { ∣ ∄ ∶ (, ) ∈ ()
 = { ∣ ∀ ∉  ∶  ∉ (∃)
()  = {(, ) ∣ (, ) ∈  }</p>
        <p>(
( ⋅  ′) = {(, ) ∣ ∃ ∶ (, ) ∈ ()
 and (, ) ∈ ()</p>
        <p>}

}
−) = {(, ) ∣ (, ) ∈  }
 and (, ) ∈ ( ′) }
  = { ∣ () ∈  }
(¬)  = Δ ⧵ ()</p>
        <p>( 1 ∧  2) = ( 1) ∩ ( 2)
( ∪  ′) = ()  ∪ ( ′)
( ∗) = {(, ) ∣  ∈ Δ} ∪ ()
 ∪ ( ⋅ )  ∪ ⋯
one can start from constraints of the form 1 ↔  1, where  1 has no shape names, and add
of the form  2 ↔  2, where  2 has only shape names occurring in 1 and add in  2 all  2()
∪ 1; the new assignment is  ∪ 
1 ∪  2. We proceed like this with the
rest of the constraints, by evaluating each of them once, until all of them are processed. The
such that  ∈ J
 1K
 and obtain  ∪  1</p>
        <p>. We then proceed with constraints
is unique and is a model that satisfies all the constraints in  ; we call
the model of  and  . Then, we can formulate validation as follows: a data
if  ,
satisfies ( , )
for every target( , ) ∈ 
.</p>
        <p>Example 2.1. Consider the following data graph  and shapes graph (,  ) :
 = {  (
1),   (
2),    (
1),    (</p>
        <p>2), (), (), ( ),
    (, 
1),     (, 
1),     ( , 
2)}
 = { PrjShape ↔     ∨  ℎ  ,</p>
        <p>EmplShape ↔  ∨</p>
        <p>∃    .   },
 = {(  ,
Intuitively, the data graph contains 2 projects,  1,  2 which are also active projects, as well as
three employees, 
, 
,  
; the first two work for  1 and  
works for  2. Together, the
constraints and target intuitively state that all projects must be either active or finished, and
all those working for some projects must be instances of the class 
or work for some active
project. In this case,  validates (,  )
PrjShape( 2), EmplShape(),</p>
        <p>; this is witnessed by the assignment  ∪ { PrjShape( 1),
EmplShape(),</p>
        <p>EmplShape( )}
which satisfies  .</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>3. Extending SHACL for Evolving RDF Graphs</title>
      <p>In this section, we propose an extention of SHACL with a construc(t, )
for a singleton property
and with diference of properties. We also allow for complex target expressions( , ) , where 
can now be any complex shape expression without shape names, and we allow for variables to
occur in the place of constants. Moreover, we allow for targets to support Boolean combinations
of target expressions. We denote with SHACL+ this extended version of SHACL. This extension
turns out to be necessary to capture the efects of actions on SHACL constraints and to express
preconditions in the update language defined in the following section.</p>
      <p>Assume a countable set   of variables (disjoint from the rest). More precisely, SHACL+
properties are defined according to the following syntax:</p>
      <p>,  ′ ∶∶=  ∣ ( 1,  2) ∣  − ∣  ⧵  ′
where  1,  2 ∈   ∪   and  ∈   ; we call them complex properties. Paths  over complex
properties and (complex) shape expressions over such paths are defined as expected. Targets are
extended to allow variables in the places of nodes and complex shapes and Boolean combinations
of target expressions as well.</p>
      <p>More formally, SHACL+ target expressions are defined as follows:
• ( , ) , where  is a complex shape expression without shape names, is a target,
• a target expression(, ) , where  ∈   ∪   is a target,
• if  1 and  2 are targets, then  1 ∧  2,  1 ∨  2, and ¬ 1 are targets.</p>
      <p>If no variables appear in  (or  ), then it is calledground. Now, when an assignment is a model
of a target is naturally defined as follows.</p>
      <p>Definition 3.1. Consider a shape assignment  and a ground target in SHACL+. Then,  is a model
of  , that is  ⊧  , if the following hold:
•   ∈   , if  is a target expression of the form ( , ) ,
•  ⊧  1 and  ⊧  2, if  is of the form  1 ∧  2,
•  ⊧  1 or  ⊧  2, if  is of the form  1 ∨  2, and
•  ⊧ ̸ 1, if  is of the form ¬ 1</p>
      <p>Finally, in SHACL+ we also allow for Boolean combinations of shapes graphs. More formally,
a SHACL+ shapes graph is defined recursively as follows:
• (,  ) is a SHACL+ shapes graph, where  and  are ground SHACL+ sets of constraints
and targets, respectively, and
• if  1,  2 are SHACL+ shapes graphs, then  1 ∧  2,  1 ∨  2, and ¬ 1 are SHACL+ shapes
graphs.</p>
      <p>A SHACL+ shapes graph is called normal, if it is of the form(,  ) , where  and  are ground
SHACL+ constraints and targets, respectively. Validation is naturally defined as follows.
Definition 3.2. Consider SHACL+ shapes graph  and data graph  . Then,  validates  , if the
following hold:
•  , ⊧  , if  is of the form (,  ) ,
•  validates  1 and  2 if  if of the form  1 ∧  2,
•  validates  1 or  2 if  if of the form  1 ∨  2, and
•  does not validate  1 if  is of the form ¬ 1</p>
      <p>Allowing Boolean combinations of shapes graphs is just syntactic sugar, as each SHAC+L
shapes graphs  can be converted into equivalent normal shapes graphs by simply renaming the
shape names in each normal shapes graph appearing in  , taking the union of all constraints,
and pushing the Boolean operators to the targets.</p>
      <p>Proposition 3.3. Consider a shapes graph  in SHACL+ and consider a data graph  . Then, 
can be converted in linear time into a normal SHACL+ shapes graph (  ,   ) such that for every
data graph  , it holds that  validates  if  validates (  ,   ).</p>
      <p>The above proposition shows that allowing Boolean combinations of shapes graphs is just
syntactic sugar, since we can equivalently transform such shapes graphs into a unique normal
shapes graph (,  ) in SHACL+.</p>
    </sec>
    <sec id="sec-5">
      <title>4. Update Language for RDF Graphs</title>
      <p>We now present the action language for updating RDF graphs. It is composed of two types of
actions, namely basic and complex actions. Roughly, the basic actions allow to insert or delete
constants from the evaluation of a shape expression or arbitrary property over the graph to a
class or property name, respectively. The complex actions allow for composing various actions
and to perform conditional checks over the data. In particular, we assume that a set of SHACL
constraints that contains all the necessary and suficient shape constraints is given in the input
together with the set of actions. The preconditions in the actions are targets in SHAC+L,that is
any Boolean combination of target expressions that will be checked w.r.t. a set of constraints.</p>
      <p>Basic actions  are defined by the following grammar:
 ∶∶= (
⊕
⟵ ) ∣ (
⊖
⟵ ) ∣ (
⊕
⟵ ) ∣ (
⊖
⟵ )
where  is a class name,  a complex shape without shape names,  a property name, and  a
complex property. Complex actions  are defined by the following grammar:
 ∶∶= ∅ ∣  ⋅  ∣ ((, 
+)?[]) ⋅ 
where  is a basic action,∅ is an empty action,  is a complex action, and(,  +) is a SHACL+
normal shapes graph. We may sometimes write ( +?[]) ⋅  , omitting  from the actions if
is given in the input, and the precondition target s + are required to be applied on the input .</p>
      <p>A substitution is a function from   to   . For a Boolean target, an action, or an action
sequence , we use  ( ) to denote the result of replacing in every occurrence of a variabl e
by a constant  () . An action is ground if it has no variables, and ′ is a ground instance of
an action if  ′ =  () for some substitution .</p>
      <p>Intuitively, an application of a ground action( ⟵⊕ ) on a graph  and a ground set of
constraints  , stands for the addition of() to  for each  that makes true  in the model
 , of  and  ; analogously for( ⟵⊖ ) , where now () will be removed from  for each
 that makes true  in  , . The two operations can also be performed on complex properties.
Composition stands for successive action execution, and a conditional actio((n,  +)? 1[ 2])
expresses that  1 is executed if is true in  , , and  2 is performed otherwise. If 2 = ∅, then
we have an action with a simple precondition as in classical planning languages, and we write
it as (,  +)? 1, without  2. The semantics of applying actions on data graphs, w.r.t. a set of
constraints, is defined only on ground actions and constraints.</p>
      <p>Definition 4.1. Let  be a data graph, and  a ground complex action. Then, the result   of
applying  on  is defined recursively as follows:
• if  is a basic action, then
–   =  ∪ {() ∣  ∈ 
–   =  ⧵ {() ∣  ∈ 
–   =  ∪ {(, ) ∣ (, ) ∈ 
–   =  ⧵ {(, ) ∣ (, ) ∈ 
 } for  of the form (
 } for  of the form (
⊕
⟵ ) ,
⊖
⟵ ) ,</p>
      <p>⊕
 } for  of the form ( ⟵  ) , and</p>
      <p>⊖
 } for  of the form ( ⟵  )
• if  is a complex action  of the form  ⋅  , then   = (  )
• if  is a complex action  of the form ((,  +)? 1[ 2]) ⋅  , then   is
–   1⋅ , if  , satisfies  ,
–   2⋅ if  ,</p>
      <p>does not satisfy  .</p>
      <p>We illustrate the efects of an action update on a data graph with an example.</p>
      <p>Example 4.2. Consider again  and (,  ) from Example 2.1. Now, consider the action  that
expresses the termination of project  2, which is removed from the active projects and added to the
ifnished ones; the employees working only for this project are removed.</p>
      <p>= (   
⊖
⟵  2) ⋅ ( ℎ  
⊕
⟵  2) ⋅ (
⊖
⟵ ∀    .
2)
After applying  to  , we obtain the updated data graph   = ( ⧵ {   ( 2), ( )}) ∪
{ ℎ  ( 2)}. The updated data graph   does not validate the shapes graph (,  ) since now
  will still have a     -relation to project  2, but he does not satisfy the constraint for the
shape name EmplShape–  is not an employee and does not work for an active project.</p>
      <p>Note that we have not defined the semantics of actions with variables, that is non-ground
actions. In our approach, all variables of an action are seen as parameters whose values are
given before execution by a substitution with actual constants, such as by grounding. Note that
the execution of actions on an initial data graph is allowed to modify the extensions of class
and property names, yet the domain remains fixed. In many scenarios, we would like actions
to have the ability to introduce “fresh” nodes to a data graph. Intuitively, the introduction of
new nodes can be modeled in our setting by separating the domain of an assignment into the
active domain and the inactive domain. The active domain consists of all nodes that occur in
the data graph, whereas the inactive domain contains the remaining nodes, which can be seen
as a supply of fresh nodes that can be introduced into the active domain by executing actions.
Since we are interested only in finite sequences of actions, a suficient supply of fresh constants
can always be ensured by taking a suficiently large yet still finite inactive domain in the initial
instance. We remark also that deletion of nodes can naturally be modeled in this setting by
actions that move objects from the active domain to the inactive domain.</p>
      <p>Example 4.3. Consider again our running example. Now consider the following action:
 ′ = ({ ↔ ∀    .
2}, {(, )})?(   
⊖
⟵ {(,  2)})
Under the substitution  ()</p>
      <p>=  
the shapes graph ({ ↔ ∀    .
  by deleting     ( , 
of the ground complex action  ⋅</p>
      <p>′
5. Capturing Efects of Updates
, which maps the variable  to</p>
      <p>, the data graph  validates
2}, {( , )})
. Hence, the ground action</p>
      <p>′
2). The resulting data graph satisfies</p>
      <p>(,  )
on  results in a valid data graph.</p>
      <p>can be applied to
. Thus, the application
In this section, we define a transformation    (,  )
that essentially rewrites the input shapes
graph (,  )</p>
      <p>to capture all the efects of an action  . This transformation can be seen as a form
of regression, which incorporates the efects of a sequence of actions “backwards,” from the last
one to the first one. More precisely, the transformation    (,  )
(,  )
and an action  and rewrites them into a new shapes graph (  ,   ), possibly in SHACL+,
takes a SHACL shapes graph
such that for any data graph  the following holds:
  validates (,  )</p>
      <p>if  validates (  ,   )</p>
      <p>If  is without preconditions, the result of applying the transformation is a shapes graph
(  ,   ), where   is a SHACL set of constraints, and  is a set of target expressions( , )
(similarly as in plain SHACL), but may contain complex shape expressions in place of .
Intuitively, the idea is to simply update the bodies of constraints i n and target expressions in
 accordingly, namely the actions replace a concept name occurring in and  with  ∧ 
(or
⊕
⟵  (or 
⊖
⟵  ), and a property  with  ∪  (or  ⧵  ) if the action is

⊕
⟵  (or 
 ∧ ¬ ) if the action is</p>
      <p>⊖
is satisfied by  ,
Definition 5.1.
as follows:
⟵  ). Now consider the case, where the action is of the form(, 
+)? 1[ 2]. Then,
intuitively, we create two shapes graphs: one shapes graph(  1
,   1) if the SHACL+ target  +
and (  2</p>
      <p>,   2) if the SHACL+ target  + is not satisfied by  , .
the new SHACL+ shapes graph that is obtained from  by replacing in  every class or property
name  with the expression  ′. Then, the transformation    ( ) of  w.r.t.,  is defined recursively
Assume SHACL+ shapes graph  and and an action  . We use  ← ′ to denote</p>
      <p>( ) = 
( ⟵⊕ )⋅ ( ) = ( 
( ⟵⊖ )⋅ ( ) = ( 
( ⟵⊕)⋅
( ⟵⊖)⋅
( ) = ( 
( ) = ( 
 ( )) ←∨
 ( )) ←∧¬
 ( )) ←∪
 ( )) ←⧵
  ((, +)? 1[ 2])⋅ ( ) = (¬(, 
+) ∨    1⋅ ( )) ∧ ((, 
+) ∨    2⋅ ( ))</p>
      <p>Note that in the presence of conditional actions, we may obtain Boolean combinations of
normal shapes graphs, whose number may be exponential in the size of the input action .
However, each of the normal shapes graphs will be of polynomial size. When no conditional
actions are present, then the result of the transformation on a SHACL shapes graph is a
normal SHACL+ shapes graph that simply uses role diference in constraints (role union can be
captured by paths) and possibly complex expressions without shape names in target expressions.
Moreover, note that by proceeding as in Proposition3.3, the result of    ( ) can be converted
in an equivalent SHACL+ normal shapes graph (  ,   ).</p>
      <p>
        Using similar arguments as in the proof of Theorem 4.2 in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], and arguing about the additional
constructs allowed in SHACL+, we can show that this transformation correctly captures the
efects of complex actions.
      </p>
      <p>Theorem 5.2. Given a ground action  , a data graph  and a SHACL shapes graph  . Then,  
validates  if and only if  validates    ( ) .</p>
      <p>This allows us to perform validation under updates leveraging standard, static validators for
SHACL+. We illustrate the transformation above with an example.</p>
      <p>Example 5.3. Consider the shapes graph (,  ) and the action  from our running example. Then,
the transformation    ((,  )) of (,  ) w.r.t.  is the new shapes graph ( ′,  ′), where:
 ′ = {PrjShape ↔ (    ∧ ¬</p>
      <p>EmplShape ↔ ( ∧ ¬∀    .
 ′ = {(  ,</p>
      <p>PrjShape), (∃    ,
2) ∨ ( ℎ   ∨</p>
      <p>2),
2) ∨ ∃    .(    ∧ ¬
EmplShape)}
2)},</p>
    </sec>
    <sec id="sec-6">
      <title>6. Static Validation under Updates for Arbitrary Graphs</title>
      <p>In this section, we consider a stronger form of reasoning about updates. We have seen that, for
each input graph, validation under updates can be reduced to usual validation. Now we look at
whether a sequence of actions is compatible with the constraints, independently of a concrete
data graph, that is, whether the execution of a given sequence of actions always preserves the
satisfaction of a given shapes graph, for every data graph.</p>
      <p>Definition 6.1. Let  be a shapes graph and let  be an action. Then  is a  -preserving action if
for every data graph  that validates  , it holds that   validates  . The static validation under
updates problem is:</p>
      <p>Given an action  and a shapes graph  , is   -preserving?</p>
      <p>Using the transformation from Definition 5.1, we can reduce static validation under updates
to unsatisfiability of shapes graphs: an action  is not  -preserving if and only if there is some
data graph that does not validate    ∗( ) , where  ∗ is obtained from  by replacing each
variable with a fresh constant name not occurring in the input.</p>
      <p>
        Analogously to Theorem 5.2 in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], we can show the correctness of the following theorem.
Theorem 6.2. Let  be a complex action and  a SHACL+ shapes graph. The following are
equivalent:
•  is not  -preserving,
•  ∧ ¬   ∗( ) is satisfiable, where ∗ is obtained from  by replacing each variable with a
fresh constant not occurring in  and  .
      </p>
      <p>
        It has been shown in [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] that checking satisfiability is undecidable already for (plain) SHACL
shapes graphs. However, if we restricts the constructs allowed in the SHAC+L shape expressions
to the     fragment studied in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], we can obtain better upper-bounds. In particular, it
was shown in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] that the static validation under updates problem is in coNExpTime when the
input is in     and in ExpTime when the input KB is expressed in  . Hence, if we
disallow path expressions (other than role union, which can be allowed), equality, disjointness,
and closed constraints in SHACL+ shapes graphs, then the resulting  ∧ ¬  ∗ ( ) can be easily
converted into an    knowledge base–with shape names, which can be treated as class
names–showing the membership in coNExpTime. Further, if we restrict cardinality constraints
and are left with   knowledge bases, then we obtain membership in ExpTime. Note
that using similar arguments as in [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] we can argue that each normal shapes graph appearing
in  ∧ ¬  ∗ ( ) is of polynomial size. For the lower bounds, we can reduce theNexpTime
problem of finite satisfiability of    (or ExpTime of   ) into the co-problem of
static validation for SHACL under updates.
      </p>
    </sec>
    <sec id="sec-7">
      <title>7. Conclusion and Future Work</title>
      <p>We have presented some preliminary work on formalizing updates for RDF graphs over SHACL
constraints. We addressed an important question: validation under updates, which asks to
verify whether a given RDF graph that validates a set of SHACL constraints, will remain valid
after applying a set of updates. This allows to identify problematic updates before applying
them to the graph, and thus to avoid incorrect and very costly computations on potentially
huge RDF graphs. In particular, it is beneficial to know if a set of updates leads to a valid graph
in case returning to the initial valid state is dificult, or that the user does not have suficient
permissions in the system. To realize this form of static validation, we first identify a suitable
update language, that can capture intuitive and realistic modifications on RDF graphs, covers a
significant fragment of SPARQL updates and extends them to allow for conditional updates.</p>
      <p>We also present a stronger form of static validation under updates that considers validation
on every graph that validates a given SHACL shapes graph. We show that the latter problem
can be reduced to (un)satisfiability of a shapes graph in SHACL +, a minor extension of SHACL,
which is known to be undecidable already for plain SHACL, but feasible incoNexpTime for
some expressive fragments.</p>
      <p>SHACL+ mainly extends SHACL with singleton properties and diference of properties, which
are needed to capture the efects of the proposed actions on SHACL constraints. We also allow
for more complex targets. However, most of the extensions allowed in the targets in this work
are “syntactic sugar” and can be incorporated into plain SHACL. We note that the SHACL
Community Group is working on extending SHACL to support some of the features allowed in
this work, including more expressive targets as so-called SPARQL-based targets, with ongoing
review and documentation in the SHACL Advanced Features draft 1.</p>
      <p>Toward lowering the complexity of static validation, we plan to analyze the problem for other
relevant fragments of SHACL. We will also study other basic static analysis problems such as,
for instance, the static type checking problem 9[], which for a given action, a source and target
shapes graph, asks whether, for every data graph that validates the source shapes graph, the
data graph after applying the action also validates the target shapes graph. Other interesting
problems related to planning ask to check whether there exists a sequence of actions that leads
a given data graph into a desired (or undesired) state where some property holds (or does not
hold). An important direction for future work is to provide an implementation of the regression
method. This method allows us to perform validation under updates by leveraging standard
validators, provided that they can support SHACL+; this is not the case for current validators,
but we believe that this extension is not hard to incorporate to existing validators, and plan to
address this in our future work.</p>
    </sec>
    <sec id="sec-8">
      <title>Acknowledgements</title>
      <p>This work was supported by the Austrian Science Fund (FWF) and netidee SCIENCE project
T1349-N and the FWF project P30873.</p>
      <p>Lecture Notes in Computer Science, Springer, 2023, pp. 19–32. URL: https://doi.org/10.1007/
978-3-031-39784-4_2. doi:10.1007/978-3-031-39784-4\_2.
[8] B. Bogaerts, M. Jakubowski, J. V. den Bussche, SHACL: A description logic in disguise,
in: G. Gottlob, D. Inclezan, M. Maratea (Eds.), Logic Programming and Nonmonotonic
Reasoning - 16th International Conference, LPNMR, volume 13416 ofLecture Notes in
Computer Science, Springer, 2022, pp. 75–88. URL: https://doi.org/10.1007/978-3-031-15707-3_7.
doi:10.1007/978-3-031-15707-3\_7.
[9] I. Boneva, B. Groz, J. Hidders, F. Murlak, S. Staworko, Static analysis of graph database
transformations, in: Proceedings of the 42nd ACM SIGMOD-SIGACT-SIGAI Symposium
on Principles of Database Systems, PODS, ACM, 2023, pp. 251–261. URL: https://doi.org/10.
1145/3584372.3588654. doi:10.1145/3584372.3588654.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ahmetaj</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Simkus</surname>
          </string-name>
          ,
          <article-title>Managing change in graph-structured data using description logics</article-title>
          ,
          <source>ACM Trans. Comput. Log</source>
          .
          <volume>18</volume>
          (
          <year>2017</year>
          )
          <volume>27</volume>
          :
          <fpage>1</fpage>
          -
          <lpage>27</lpage>
          :
          <fpage>35</fpage>
          . URL:https: //doi.org/10.1145/3143803. doi:
          <volume>10</volume>
          .1145/3143803.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>F.</given-names>
            <surname>Baader</surname>
          </string-name>
          , I. Horrocks,
          <string-name>
            <given-names>C.</given-names>
            <surname>Lutz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Sattler</surname>
          </string-name>
          , An Introduction to Description Logic, Cambridge University Press,
          <year>2017</year>
          . URL: http://www.cambridge.org/de/academic/ subjects/computer-science/
          <article-title>knowledge-management-databases-and-data-mining/ introduction-description-logic?format=</article-title>
          <source>PB#17zVGeWD2TZUeu6s.9.7</source>
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>P.</given-names>
            <surname>Pareti</surname>
          </string-name>
          ,
          <string-name>
            <given-names>G.</given-names>
            <surname>Konstantinidis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Mogavero</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T. J.</given-names>
            <surname>Norman</surname>
          </string-name>
          ,
          <article-title>SHACL satisfiability and containment</article-title>
          ,
          <source>in: The Semantic Web - ISWC 2020 - 19th International Semantic Web Conference</source>
          , volume
          <volume>12506</volume>
          of Lecture Notes in Computer Science, Springer,
          <year>2020</year>
          , pp.
          <fpage>474</fpage>
          -
          <lpage>493</lpage>
          . URL: https://doi. org/10.1007/978-3-
          <fpage>030</fpage>
          -62419-4_
          <fpage>27</fpage>
          . doi:
          <volume>10</volume>
          .1007/978- 3-
          <fpage>030</fpage>
          - 62419- 4\_
          <fpage>27</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ahmetaj</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Calvanese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Šimkus</surname>
          </string-name>
          ,
          <article-title>Managing change in graph-structured data using description logics</article-title>
          ,
          <source>ACM Trans. Comput. Log</source>
          . (
          <year>2017</year>
          ). URL:https://doi.org/10.1145/ 3143803. doi:
          <volume>10</volume>
          .1145/3143803.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>S.</given-names>
            <surname>Ahmetaj</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>David</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Polleres</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Shehu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Simkus</surname>
          </string-name>
          ,
          <article-title>Reasoning about explanations for non-validation in SHACL</article-title>
          ,
          <source>in: Proceedings of KR</source>
          <year>2021</year>
          ,
          <article-title>Online event</article-title>
          ,
          <source>November</source>
          <volume>3</volume>
          -
          <issue>12</issue>
          ,
          <year>2021</year>
          ,
          <year>2021</year>
          , pp.
          <fpage>12</fpage>
          -
          <lpage>21</lpage>
          . URL: https://doi.org/10.24963/kr.2021/2. doi:
          <volume>10</volume>
          .24963/KR.
          <year>2021</year>
          /2.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <article-title>[6] Shapes constraint language (SHACL</article-title>
          ),
          <year>2017</year>
          . URL:https://www.w3.org/TR/shacl/.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>M.</given-names>
            <surname>Ortiz</surname>
          </string-name>
          ,
          <article-title>A short introduction to SHACL for logicians</article-title>
          , in: Logic, Language, Information, and Computation - 29th International Workshop, WoLLIC
          <year>2023</year>
          , volume
          <volume>13923</volume>
          of
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>