Abstract
Although the Semantic Web Rule Language (SWRL) is not a W3C standard, it is widely used for semantic web-based projects as well as for innovative rule-based applications. Thereby, it is used to infer new knowledge from a given fact base. Today, SWRL rules are developed and managed by technical experts in text-based editors using software applications such as the Stanford Protégé toolkit. In this paper we present a visual approach which allows users to analyse and modify SWRL rules. By building upon a visual modeling language, the approach includes validation mechanisms and layouting algorithms for visually representing new as well as existing rules. The approach further provides import and export interfaces to common SWRL exchange formats. In this way, its compatibility with widely-used reasoners and semantic web platforms is guaranteed. For ensuring its feasibility, the approach has been prototypically realized using the SeMFIS platform and evaluated using the sample rules as provided in the SWRL specification.
Introduction
Rule-based systems as well as the corresponding formalisms constituted for a long time an important research area for expert systems [61]. Today, they have become popular again, especially for semantic web-based applications and for enterprise information systems [60]. For example, in the domain of enterprise information systems, rules are today being applied for specifying business process decisions and constraints as well as for compliance checking, e.g. [18,54]. The Semantic Web Rule Language (SWRL) is thereby considered as a prominent technology towards the semantic web that is adequate for many types of information systems [52]. So, it is supported by reasoners, e.g. Pellet [29] and HermiT [30], rule engines, e.g. Jess1
In a previous paper we therefore proposed a first idea for a visual modeling language that covers all concepts of SWRL [22]. The paper at hand extends this idea and contains an in-depth description of a comprehensive, visual modeling approach for SWRL. A main goal is to realize a modeling language that includes all necessary constructs in a visual form. In more detail, this led us to the following list of requirements for such a modeling approach: (i) Visual modeling of all atoms as defined in the SWRL specification, (ii) Explicit visual representation of variables and data values, (iii) Linkage to visually represented OWL ontologies using the previously developed SeMFIS modeling language [19,26], (iv) Serialization and De-serialization of visual SWRL models in OWL-XML syntax, (v) Prototypical implementation of the approach to evaluate its feasibility.
In this paper we describe how we met these requirements. In particular, the contributions are as follows:
Detailed description of the metamodel of the visual modeling language,
Formalization of the modeling language for an implementation-independent representation,
Development of implementation-independent rules for transforming the model to concrete syntax representations and vice versa,
Description of the prototypical implementation using the SeMFIS platform based on ADOxx [21]
This work is driven by the vision of creating a visual modeling language for SWRL that can be used both for use cases dealing with the analysis of existing SWRL rules, e.g. to enhance the understanding of a rule, as well as for use cases where SWRL rules have to be specified by non-technical experts, e.g. to conduct compliance checking by business users [54]. While the visual approach might boost understandability (see [59]), a systematic empirical evaluation of the usability will be part of our future research.
The remainder of the paper is structured as follows: In Section 2 foundations of conceptual modeling and SWRL as well as related work is analyzed. The modeling language for SWRL is introduced in Section 3. In Section 4 the transformation from the SWRL model to a SWRL syntax and vice versa is introduced. The technical implementation of the approach is introduced in Section 5 followed by a use case which is presented in Section 6. In Section 7 the limitations of the approach are discussed. The paper ends with a conclusion in Section 8.
In this section we discuss at first foundations of conceptual modeling that are necessary for describing our approach. This includes a characterization of modeling methods as it is typically used in the area of enterprise modeling and the formalization of modeling languages. Second, we regard the contents of the W3C SWRL proposal that is the basis for the subsequently presented modeling language.
Foundations of conceptual modeling methods
According to Karagiannis and Kühn, a modeling method consists of (i) a modeling language, which encompasses a visual notation, syntax and semantics, (ii) a modeling procedure, which describes how to use a modeling language, and (iii) algorithms and mechanisms, which can be applied to the models [38]. In the paper at hand we focus on the description of the modeling language as well as on algorithms and mechanisms.
For describing modeling languages, specific formalisms have been designed in the past [11,63]. Examples include EMF [58] or a specific formalism for the UML OCL specification.3
In FDMM, a metamodel
A model
The specification of the Semantic Web Rule Language (SWRL) is available as a proposal by Horrocks et al. on the W3C website [35]. SWRL is defined as an ontology – called
A SWRL rule consists of an antecedent – denoted as
The proposal for OWL 2 [49] was published a few years later after the release of the SWRL proposal in 2004. Thereby, SWRL rules were not added to the OWL 2 proposal. Rather, the introduction of OWL 2 raised compatibility issues with the SWRL proposal. Glimm et. al. [29] state that the existing rule syntax of the SWRL proposal is “
So, they developed an updated SWRL version to align it with the OWL 2 proposal [29]. The updated version is intended as a substitute of the SWRL proposal issued by the W3C [35]. For ensuring decidability, primarily two restrictions are introduced – for more details we refer to [29]: (i)
For describing the syntax of the updated SWRL, Glimm et. al. reverted to the generic functional syntax. The updated SWRL – which we will use as foundation for our subsequent elaborations – is widely supported by reasoners, e.g. Pellet [29] and HermiT [30].
Today, a variety of syntaxes for OWL 2 ontologies exist. For example, the current version of Stanford Protégé [50] offers eight different syntaxes for serializing ontologies. However, the OWL-XML syntax of the W3C SWRL proposal [35] is currently not supported by this platform.8 The files provided at
In addition to SWRL, a couple of related rule languages exist, which are summarized in the following – a good overview is presented e.g. in [3]. In 2009, the W3C released the first working draft on the Rule Interchange Format (RIF)9
SWRL rules are heavily used in industry and in the scientific community. Recently, SWRL rules were used for language processing [40], food selection systems [51], health care [16], annotation of media data [10,44], communication protocols [2] and risk management [56]. Applications and frameworks which use or support SWRL rules are e.g. Menthor Editor [48], RuQAR [6], or i-RM [41]. SWRL also served as a starting point for novel rule-based formalisms and approaches. For example, a fuzzy extension for SWRL was introduced in [64]. Jajaga et al. developed a SWRL-based language called C-SWRL for reasoning over stream data [36] and in [12] an approach was introduced for identifying dependencies between SWRL rules.
To the best of the authors knowledge, a comprehensive visual language for SWRL rules has so far not been made available. Although a generic metamodel for supporting the creation of visual rules was introduced in [15], this approach does not support all SWRL atoms. A visual language for SWRL was introduced in [42,43] which neither supports the import of existing SWRL models nor the different built-in types defined in SWRL.
A further implementation presented in [5] neglects export functionalities, the visualization of SWRL atoms as well as OWL constructs. The SWRLTab bundled with Stanford Protégé allows a text-based modification of rules. In the same way, the ORE editor offers a text-based editing of rules.14
In summary, our related work analysis shows that a tool for the visual creation and editing of SWRL rules does not exist yet. Although certain attempts have been made in this direction, a more complete and systematic approach for a visual, model-based representation of SWRL is needed.
The visual modeling approach for SWRL that we present in the following is structured along three layers as depicted in Fig. 1. The
The ontology can either be stored as a file, as an in-memory data structure or as a visual model. In this section we focus on the visual modeling language for SWRL rules which consists of the (i) syntax, (ii) a visual notation, (iii) and semantics [38].

Layers of the visual modeling approach for SWRL.
The syntax describes the model elements and valid combinations of them [31]. For the description of the syntax of visual modeling languages, it is often reverted to semi-formal visual metamodels [24,27].
For the development of the modeling language we tried to balance the trade-offs between expressiveness and usability. For example, a large number of object types simplifies the transformation of the model on the transformation layer. On the contrary, large numbers of object types aggravate modeling. Moody denotes this trade-off as See

Excerpt of the SWRL metamodel which is integrated with the OWL metamodel, bottom shows an excerpt of the metamodel of the serialization.
An excerpt of the metamodel of the SWRL modeling language in UML class diagram notation is depicted in Fig. 2. It is grouped into three parts: an OWL part, a SWRL part, and a SWRL serialization part. The OWL part and the SWRL part correspond to the configuration layer. The SWRL serialization part in the bottom of the figure belongs to the transformation layer and will be discussed later on. The boxes are UML classes, which are used to represent object types. The classes with names in italics are abstract. These classes do not have a visual representation and can therefore not be instantiated by modelers. The solid connector which has an unfilled triangle (⊲) at its end is used to establish a hierarchy between classes similar to inheritance in object oriented programming languages such as Java. It corresponds to the ⪯ operator in FDMM as described in Section 2.1.
The classes
We specify model hyperlinks/references from the SWRL metamodel to the OWL metamodel for keeping the SWRL model self contained. This means that the transformation layer should be able to produce valid SWRL rules of the SWRL model, even if no OWL model exists. In total, four classes contain model hyperlinks to the OWL metamodel: (i)
The visual notation of the most important object types is shown in Table 1. For the design of the visual notation we took into account the principles of Moody, in particular
For improving the readability of the notation we use dynamic notation. Such a notation changes based on certain attribute states of model elements [21,25]. I.e., textual information is dynamically added to symbols at run-time, as shown in Fig. 4. In the example, the names of the OWL elements are dynamically displayed below the atoms based on the current state of the reference attributes.
Excerpt of the elements used for the SWRL modeling language [22]
Excerpt of the elements used for the SWRL modeling language [22]
The modeling language was developed in order to create SWRL rules. Hence, the semantics of the model elements is identical to the corresponding concepts of the SWRL proposal and the updated version – see [35] and [29] for a detailed semantic description.
In the modeling method itself, no operational SWRL or OWL semantics are included, e.g. in the form of algorithms [32]. It is rather reverted to transformations from the model information to machine-processable representations as will be shown in the next section.
Transformation of SWRL models
The transformation layer is responsible for generating machine-processable SWRL rules from the SWRL models on the configuration layer. Therefore, transformation rules as well as a transformation engine is necessary as depicted in Fig. 3. The transformation rules describe how to transform the models to a concrete syntax. The transformation engine processes the models according to the given transformation rules.

Transformation rules and the transformation engine as parts of the transformation layer.
An example transformation is shown in Fig. 4, which represents Example 5.1-1 of the SWRL proposal [35]. The arrows between the atoms (round symbols with the letter ‘A’) and the properties (yellow symbols with the letter ‘P’) represent the model hyperlinks, which were added to the figure in order to improve readability. The visual SWRL rule is identical to the SWRL rule in the textual notation shown at the bottom of the figure. Such a textual notation is typically used on platforms such as Stanford Protégé. Each atom of the visual SWRL rule is transformed to the corresponding string in the textual SWRL rule.

Transformation of a visual SWRL rule to a textual SWRL rule.
In the following, we describe the core transformation rules for transforming visual SWRL models. Therefore, we first define both, the SWRL model as well as the serialization using a formalism. Based on the description, the transformation rules are introduced. The description of the serialization is based on the functional rule syntax of [29] and therefore independent of concrete syntaxes. With a focus on SWRL, we do not describe the transformation of OWL constructs such as OWL individuals or OWL properties in the following subsections. We also neglect the description of exception cases where e.g. referenced OWL concepts are missing in the model. However, we support these transformations in our prototype described in Section 6.
A description of the SWRL modeling language as well as it’s serialization using FDMM is given in Appendix A and B. For the following transformation rules we will only require a subset of this formalization. In particular, we will refer to the model type for OWL as
For navigating to an attribute, the FDMM formalism requires the use of triple statements. For example, consider an instance of an OWL
In the following we use an abbreviation for the navigation via triples by using a dot syntax similar to the Object Constraint Language (OCL) in UML. Thereby, the previously described two triples are summarized as follows:
For the description of the rules, we will use the following arrow types. The left side of the arrow ⇒ shows the input value which the rule receives while the right side of the arrow shows the return value of the rule. The arrow ↦ is used as an operator to assign values to attributes. If the attribute is a set, then the value on the left side is added to the set. Even if the rules are independent from its concrete serialization, we use OWL-XML serialization examples to improve understandability.
When designing transformation rules for the serialization of the visual SWRL models to OWL, some differences have to be taken into account beforehand. This concerns the following four aspects: i. Anonymous Classes, ii. Model Hyperlinks, iii. BuiltIn Terms, and iv. Variables. This will be discussed in more detail in the following.
(i)

OWL class hierarchy in schematic overview (left) and in the model (right).
Figure 5b shows the corresponding visual model of the OWL ontology using the SeMFIS modeling language for OWL [19]. Thereby, the class b is anonymous. Such properties are typically set by the user by reverting to property windows in a modeling tool. We will use this for the prototypical implementation of the modeling language – see Fig. 9. In the serialization The paper introducing the syntax we use here [29] is available at

Example for the serialization of an anonymous class in OWL-XML using the subclass axiom
The following rule (
If the referenced OWL

Schematic overview of the model elements (class
As class atoms, but also

Serialization of a class atom
This issue originates from a structural problem: anonymous classes can have multiple axioms but a class atom can only contain a single axiom. In order to create valid SWRL serializations even in such scenarios, we wrap the content of anonymous classes into an
The following rule describes the transformation of the
For the serialization of the
The serialization of the
For the
The transformation rule for the
The model element
The
The following rule is called within other rules for the serialization of OWL
This rule is called to resolve the referenced OWL classes, e.g. in intersection of axioms:
With the following rule a helper rule for creating variables and literals is provided:
This rule is called for creating a wrapping
This Rule is used for creating a variable used within atoms:
The following rule is called within other rules for the serialization of the OWL
The following rule is called for creating a list of values used in
Due to the serialization, a loss of information occurs: the references to anonymous classes are replaced by the content of the class. If an anonymous class is called several times, its content is inserted several times in the serialization. In the serialization it is not possible to find out if two identical anonymous code sections result from the same class or from two different anonymous classes of the visual model. Further, it is not possible to find out if two class description axioms such as

Schematic OWL class relations (of the visual model) with identical serializations.
An example is depicted in Fig. 7. The classes

Non-anonymous class deserialization strategy
However, if the serialization has two identical axioms17 Two axioms with the same name and which belong to the same class.

Anonymous class deserialization strategy
We identified two fundamental strategies for their deserialization: (a)
As the example illustrates, the multiple class strategy usually results in the creation of more anonymous classes than the single class strategy. In the following rules, we revert to the multiple class strategy as it does not make any assumptions regarding the grouping.
Our metamodel distinguishes between four different types of terms. However, in the serialization only variables can be explicitly defined without distinguishing between individual variables and data variables. The atom which contains the variable has to be analyzed in order to find out if the variable is an individual variable or a data variable. If e.g. the defined variable is used as individual in a class atom, then this variable is an individual variable. If the variable is used in a
The following rule describes the transformation of the
The following rule describes the deserialization of an
For the serialization of the
The introduced modeling language distinguishes between
For the
The transformation rule for the
The
The following rule is a helper rule for creating
The following rule is a helper rule which creates either a non-anonymous class or an anonymous class. The latter is done in the empty else branch – we neglected it here with a focus on the serialization/deserialization of SWRL constructs:
The following transformation rule describes the creation of a variable that is created based on a name:
This rule creates or finds an OWL
The following transformation rule describes the creation of a variable which is created based on a name:
The following rule creates a dataconstant whereby the name is created randomly:
In order to evaluate the feasibility of the presented approach, we created a prototypical technical implementation. This comprised the implementation of the visual modeling language as well as the transformation rules for the serialization and deserialization of the models. Figure 8 shows technologies and syntaxes used for the implementation.

Technologies used for implementing the configuration, transformation, and execution layer.
On the configuration layer we reverted to the SeMFIS platform, which offers a generic import and export interface for models in the ADOxml format. The transformation layer was realized using XSLT, and for the execution layer we used Stanford Protégé and the included APIs. In the following we will discuss the used technologies and platforms as well as the developed mechanisms and algorithms in more detail.
The modeling language was implemented by extending the SeMFIS platform [19], which is based on the metamodeling platform ADOxx [21]. The modeling languages for OWL ontologies as well as for frames ontologies are already part of SeMFIS. The introduced modeling language for SWRL references to constructs of the OWL modeling language. The attributes of the model elements can be accessed using a property window in SeMFIS. An excerpt of the property window of a class from the ontology model (see Fig. 5b) is depicted in Fig. 9. The entries of the listbox represent model hyperlinks to the class elements

Property window in SeMFIS for accessing attributes of model elements – example of class element
In SeMFIS, each model can be exported to a generic, standardized XML format called ADOxml,18 The schema is defined in
The transformation layer has been realized with XSLT. It transforms ADOxml to OWL-XML and vice versa. The transformation layer has been integrated into the SeMFIS platform to ensure a seamless user experience.
For the implementation, the XSLT transformation engine Saxon19
In addition to the import and export functionalities, we implemented further algorithms and mechanisms for the SWRL modeling language. In the following we focus on a layout and a validation algorithm.

Layout of imported models.
The basic working of the algorithm is as follows. For every serialization that is imported, the algorithm first positions the
Evaluation of the approach along the examples provided by the W3C
In the ontology model, a separate row is created for all instances of a certain metaclass, the order is the following: Namespace, Class, Property, Instance, Predicate, AllDifferent and Package. The algorithm works in a responsive way, which means that if an entire row is being deleted, the objects below will “move up” one row if the layout algorithm is applied again.
Currently, we are working together with ADOxx in order to create an installer which allows to use our software. Please visit our project page21

Use case – export of model, processing and import of model.
For the evaluation of our approach, we took two directions. First, we evaluated our approach along the examples provided by the W3C in the SWRL proposal. These are used to illustrate the capabilities of SWRL and can therefore serve as examples that are easily accessible and well documented. Second, we applied our approach to a use case to assess how the approach would behave for an existing comprehensive rule set.
W3C examples
From a general perspective, artifacts in design-oriented and engineering research can be evaluated using different approaches [53]. In the case of the introduced visual modeling language for SWRL, the most important aspect was to assess, whether the models created with it conform to the recommendation by W3C for SWRL and its extension introduced [29]. We evaluated the completeness by modeling the example rules introduced in the SWRL recommendation.22
We then modeled the SWRL rule presented in Example 5.1-3 of the SWRL recommendation25

Excerpt of the serialization of the use case
In this section we describe how to use our approach for modifying an existing set of rules. Therefore we reverted to the SWRL rule set published within the Protégé project.27

Extended visualization of the rules (excerpt).
We plan further evaluations for assessing the performance of the introduced transformation rules. Additionally, usability tests and empirical studies are planned for testing the usability of the developed approach, e.g. to assess the ease of use of the modeling language and the features for manipulating SWRL rules in the form of models. This will have to include different stakeholder groups and domains to receive profound empirical evidence.
In this section we present an initial feature comparison with TopBraid28
TopBraid offers a tree-based modification and visualization approach for ontologies similar to Stanford Protégé. It further offers a graph and a diagram tab for the visualization of the relationships between entities such as OWL classes but not a visualization of rules. For the visualization of the relationships – which can be represented as a graph – three layouting options exist: (i) Layouting from top-to-bottom (ii) Layouting from bottom-to-top (iii) Layouting from left-to-right. Currently, we introduced a single layouting algorithm.
In TopBraid the rules have to be formalized in a textual way as the screenshot of Fig. 14 shows. As depicted in Fig. 15 TopBraid supports a visualization mechanism for a better analysis of SHACL rules. However, a mechanism which supports the construction of rules in a drag-and-drop manner was not identified within our analysis and correspondence with TopBraid.
AllegroGraph offers the Gruff toolkit (A Grapher-Based Triple-Store Browser for AllegroGraph) inter-alia for visually constructing SPARQL queries – we were unable to identify an approach for the visual construction of rules during our analysis and correspondence with AllegroGraph. The construction of the SPARQL queries is done via the context menu which allows to add e.g. predicates and variables and so complete SPARQL queries can be constructed as e.g. depicted in Fig. 16. A property window as e.g. shown in Fig. 9 does not exist as well as a drag-and-drop mechanism. Gruff offers a couple of layouting options such as a re-organization of the displayed graph which represents a SPARQL query. All tools allow to refer to existing ontologies. Syntactical validations and export/import functionalities are offered in our approach as well as in the two analyzed tools. Table 3 summarizes our findings.

Screenshot of a rule in the stanford protégé editor.

Screenshot of a rule-construction in the TopBraid editor.

Screenshot of a rule visualization in the TopBraid editor.

Creation of a visual SPARQL query using gruff.
In industrial settings, the support of non-technical users for managing complex formalisms and formal systems is essential [22]. An initial empirical study, which identified a possible usability benefit of visualized rules, was introduced in [59]. In the study, it was found that the visual approach outperforms the text-based approach in all measured categories in both user groups – experts and novices. However, further empirical evaluation will be necessary due to the small sample size. With the presented visual modeling language for SWRL, domain experts can use the predefined modeling elements and algorithms for composing rules. In this way, the modeling language can be considered as a substitution for the widely-used text-based syntax for SWRL rules. The described visual approach is also useful for visualizing existing rules to domain experts which have to document, improve and inspect them.
Compared to the textual syntax, the introduced modeling language is able to re-use existing rule parts. The independence of our tool requires the usage of standardized serialization formats. Therefore, we implemented in addition to the validation and layout algorithms, import and export facilities for the standardized OWL-XML syntax. This enables compatibility with semantic web platforms such as Stanford Proégé and other industry applications.
The introduced visual modeling approach does not exempt the modelers from understanding the basic concepts of SWRL. For large rules, e.g. with thousands of atoms, advanced visualization techniques such as groupings will have to be introduced.
While we considered an inclusion of a SWRL engine to our modeling toolkit, we rather decided to support standardized SWRL syntaxes so that external rule engines can process them. This is because we see the modeling tool as a platform- and engine- independent application.
Currently, the support of annotations in the SWRL modeling language is limited. We will add this functionality within the next SeMFIS release.
Feature comparison of tools
Feature comparison of tools
In the current implementation, a visual ontology model has to be created or imported. While the introduced import function allows to import already existing ontologies, there are several use cases for which direct references to OWL serializations – not to the visual model – might be beneficial. For example in cases, in which the ontology is gathered from the web.
The current implementation focuses on the support of the OWL-XML syntax. Libraries such as OWLAPI or SWRLAPI can be used to convert OWL-XML serializations to other concrete syntaxes.
In this paper we conceptualized a visual modeling language for SWRL rules. Instead of
For visualizing and modifying already existing rules, our approach provides an import functionality. Additionally, the rule models can be exported in order to process the rules using rule engines. Therefore, we introduced generic transformation rules in the paper which can be adapted for syntaxes such as RDF-XML. We also discussed issues which occur during the transformations and strategies for handling them.
The introduced approach has been implemented by extending the SeMFIS platform. The transformation was realized with XSLT whereby we support the OWL-XML syntax for importing and exporting rules.
In our further research we plan to add support for further syntaxes such as RDF-XML. With a special aim on assisting business users we want to improve validation algorithms (e.g. by making suggestions for solving validity issues). We also consider providing mechanisms which allow direct references from SWRL atoms to OWL ontology concepts – currently OWL ontologies have to be imported as a model in order to reference their concepts. An empirical evaluation of the benefits of the introduced visual approach as well as a comparison to text-based rules is necessary and will be a main pillar for further improvements.
Footnotes
Acknowledgements
The authors would like to thank the reviewers for their valuable comments which helped to improve the paper. We also want to thank TopQuadrat for their fast response to our questions. Further, we are very pleased that FanzInc (creator of Gruff) created a demo account for us and answered our questions quickly.
SWRL modeling language in FDMM
In the following we list the details of the SWRL modeling language as expressed in the FDMM formalism [23]. The visual modeling language for the SWRL consists of a single model type
The ordering of the object types is described in the following:
The range function assigns datatypes to attributes used in object types. The range functions are listed in the following:
In the following we describe an excerpt of the visual OWL model using the FDMM which we require for formalizing the model transformation.
The domain functions are then described in the following.
SWRL serialization in FDMM
For a clear description of the transformation from the model to the serialization and vice versa we mapped the functional syntax described in [29] – which references to OWL 2 elements described in [49] – to the FDMM. The functional syntax is described using production rules and the mapping to FDMM was done as follows: (i) For each terminal symbol an object type in the FDMM was created except for the single brackets which are used in the functional syntax for grouping. An excerpt of a production rule used in [29] and [8] is shown in the following: For example, the FDMM object types A distinction between the different string content is not done in the given transformation.
The following description using the FDMM starts with the production rule
The serialization of the rules is described using the model type
The object types used in the model type are described in the following equation.
All attributes used in the object types are part of the set
In the following, the domain functions are used to establish a mapping between the attributes and the object types:
