ShapeUML: RDF Constraints Visualization based on UML

Unofficial Draft

Editors:
(Ghent University — IDLab — imec)
Anastasia Dimou (Ghent University — IDLab — imec)
Author:
(Ghent University — IDLab — imec)

Abstract

This document defines ShapeUML, a visual notation for RDF constraints which is based on the Unified Modeling Language [UML]. It specifies the visualization primitives to represent constraints to users.

Status of This Document

This document is draft of a potential specification. It has no official standing of any kind and does not represent the support or consensus of any standards organization.

This document is the result of research and the accompanying paper is currently under submission at the 22nd International Conference on Knowledge Engineering and Knowledge Management (EKAW 2020).

1. Introduction

This section is non-normative.

Knowledge Graphs defined with the Resource Description Framework [RDF] consist of vocabulary terms and instance data both described using the graph model of RDF. Several constraint languages exist to define conditions on such RDF graphs, one such language is the W3C recommended Shapes Constraint Language [SHACL] which itself is represented using RDF. Users rely on different types of constraints offered by constraint languages to define conditions on RDF graphs.

With respect to visual notations, the Unified Modeling Language [UML] is widely used in many disciplines. A specific UML-profile for RDF [ODM] states how RDF classes and properties are mapped to UML classes. ShapeUML follows this profile but also adapt graphical symbols to the needs for RDF constraints.

2. Terminology

Throughout the document, the following terminology is used.

2.1 General

(anonymous) entity
An entity is something that exists as a distinct, independent, or self-contained unit. Examples are people, companies, buildings and so on. If you want to uniquely address an entity then it needs to have a unique name. Therefore, entities use HTTP URIs. However, when a entity does not have a URI we call it an anonymous entity [MapVOWL].
attribute
More information is provided about an entity by adding attribute to it. Examples are the name of a person, the VAT number of a company and so on [MapVOWL].
relationship
An entity and its attributes are connected with each other using relationships. A relationship describes how a attribute relates to its entity [MapVOWL].
constraints
A constraint is a condition on data which should be satisfied. Several types of constraints exist, e.g. a datatype constraint on a property restricts the value of that property to be of a specific datatype and a cardinality constraint on a property restricts the number of that property [SHACL-core-constraints].
data shape
A data shape is a set of conditions on RDF data [SHACL-abstract]. It provides context for constraints, i.e. a datatype constraint can be used in different data shapes which corresponds to different contexts.
node shape
A node shape is a specific data shape which represents conditions on nodes, i.e. subjects and objects of triples [SHACL].
property shape
A property shape is a specific data shape which represents conditions on properties and their values, i.e. predicates and related objects of triples [SHACL].
closed data shape
A closed data shape may only have values for the properties explicitly enumerated via property shapes [SHACL].
severity
Each data shape has a severity which qualifies the violation of the stated conditions, i.e. it categorizes validation results [SHACL]. By default a data shape has the severity "violation" but other severities can be defined, i.e. the SHACL core specifies the three severities "violation", "warning" and "information".

2.2 Visualization

node
A node is a visual representation of either an entity or an attribute [MapVOWL].
edge
An edge is a line connecting two nodes. It represents the relationship between two entities or one entity and one attribute [MapVOWL].
graph
A graph is a collection of nodes and edges [MapVOWL].

3. Graphical Primitives

Name Primitive Description
rectangle data shape
solid line
  • relationship between a node and a property shape
dashed line
  • relationship between nodes and data shapes or property shapes and node shapes (not between node shapes and property shapes)
  • vertically subsuming individual relationships: one-to-many relationships
arrowhead relationship direction
text text labels, constraints and other textual information

4. Colors

4.1 General

Abstract Color Name Concrete Color Recommendation Description Application
canvas #ffffff white Bright color with a good contrast to all other colors. canvas where are all other graph elements are shown on
foreground #000000 black Very dark color with a good contrast to all other colors. border of elements and edges
base color see next table Color is not material to UML; we recommend no specific color, i.e. the same as the canvas color. standard fill color of elements
highlight see next table For each data shape the highlight color is a darker shade of the base color of that element. fill color of the graph elements when selected
severity see next table Every severity has its own color. fill color of the data shape based on its severity; default severity is violation

4.2 Color Schemas

Color Schema Name Base Color Highlight
Data shape #ffffff #981c1c
severity violation #e06666 #b7b7b7
severity warning #ffd966 #bf9000
severity information #93c47d #b7b7b7

5. Constraints

First, we provide a mapping from constraint-specific terminology to labels for the visual notation. Next, we elaborate on how constraints and data shapes are visualized. Then we explain splitting rules with respect to the visualization of property shapes. Finally, we provide a complete visual example.

5.1 Labels

Labels in the visual notations may differ from the terminology of RDF constraints. In the following we list the mappinng between terminology and visual notation labels.
Term source Term Label Description
SHACL Node Shape Node Conditions The type of a data shape
SHACL Property Shape Property Conditions The type of a data shape
SHACL IRI IRI The unique identifier of a data shape
SHACL targetNode appliesOn instance(x) Specifies on which data a data shape applies by default
SHACL targetClass appliesOn class(x) Specifies on which data a data shape applies by default
SHACL targetSubjectsOf appliesOn subjectsOf(x) Specifies on which data a data shape applies by default
SHACL targetObjectsOf appliesOn objectsOf(x) Specifies on which data a data shape applies by default
SHACL minCount 1..* The inclusive min count is the left number. In case only maximum but no minimum is specified, the minimum is 0
SHACL maxCount 0..1 The inclusive max count is the right number. In case only minimum but no maximum is specified, the maximum is '*'
SHACL pattern, flags /pattern/flags The constraint type 'pattern', a regular expression separated with a dash from possible flags
SHACL Xone OneOf The logical relationship representing exclusive or
SHACL node compliesWith The constraint type expressing that one data shape should comply with another data shape
SHACL property - Not used, instead the property path of the property shape is displayed as label
SHACL qualifiedValueShape, qualifiedMinCount, qualifiedMaxCount compliesWith, 1..2 The constraint type expressing that the specified number of a data shape should comply with another data shape
SHACL ignoredProperties otherAllowedProperties Specifies which properties of a node are allowed even in a closed data shape
SHACL in valueIn This constraint type specifies that a value needs to be member of a provided list
SHACL sequence path property1/property2 A property path following the SPARQL 1.1 specification
SHACL alternative path property1 | property2 An alternative property path following the SPARQL 1.1 specification
SHACL inverse path ^property1 An inverse property path following the SPARQL 1.1 specification
SHACL zero-or-more path property1/property2* Zero or more property path following the SPARQL 1.1 specification
SHACL One-or-more path property1/property2+ One or more property path following the SPARQL 1.1 specification
SHACL Zero-or-more path property1/property2? Zero or more property path following the SPARQL 1.1 specification

5.2 Visualization

Visualization Description
A node shape which by default contains three compartments:
  • the upper compartment defines the type in guillemets (quotes), which is either Condtions, NodeCondtions or PropertyConditions, and an optional label in bold
  • the middle compartment lists keys and values which represent characteristics of the node shape, such as its unique identifier or severity
  • the lower compartment lists keys and values which represent constraints and their values
A relationship between a node shape and a property shape: conditions of the property shape in combination with the conditions of the node shape.
A one-to-many relationship using logical operators
A property shape refering to a node shape indicated by a dashed connection.

5.3 Splitting rules

Node shapes can be reused by a directed dashed connection and property shapes can be reused by directed solid connections. Property shapes are visualized only once, however, ingoing solid connections with a property path as label and cardinalities on the arrow head are splitted. I.e. a property shape which is reused n times will be visualilzed only once but will have n ingoing solid edges with the property path as label and cardinalities on the arrow head.

5.4 Example

Below you can find an example for constraints expressed with ShapeUML.

Figure 1 A person should not be an anonymous entity, also it should either have at least one schema:givenName property and at least one schema:familyName property, or exactly one ex:fullName property; all names of datatype xsd:string. Additionally, a person should have at least one and maximum two addresses, from which at least one address must comply with the linked existing data shapes.

A. References

A.1 Informative references

[MapVOWL]
MapVOWL. rml.io. URL: https://rml.io/specs/mapvowl/
[ODM]
Ontology Definition Metamodel (ODM). Object Management Group (OMG). URL: https://www.omg.org/spec/ODM/1.1/
[RDF]
RDF 1.1 Concepts and Abstract Syntax. W3C. URL: https://www.w3.org/TR/rdf11-concepts/
[SHACL]
Shapes Constraint Langauge (SHACL). W3C. URL: https://www.w3.org/TR/shacl/
[SHACL-abstract]
Shapes Constraint Langauge (SHACL) - Abstract. W3C. URL: https://www.w3.org/TR/shacl/#abstract
[SHACL-core-constraints]
Shapes Constraint Langauge (SHACL) - Constraint Types. W3C. URL: https://www.w3.org/TR/shacl/#core-components
[UML]
Unified Modeling Language (UML). Object Management Group (OMG). URL: https://www.omg.org/spec/UML/2.5.1