Display of Data Patterns
Not all information related to a reference entity is expressed as simple key-value triples. Corresponding display patterns can be configured to display more complicated and nested data patterns in a user-friendly way.
A display pattern contains two components:
-
A condition that specifies to which resources the rule should be applied:
- Resources of a certain type or
- Resources that are referred to with certain predicates.
-
A list of expressions concatenated together to form the final value:
- Plain Text,
- Newlines or
- References to other properties
Example: Resources of type qudt:QuantityValue
contain both numeric values (e.g. 50.3
) and a unit (e.g. kg
).
A display pattern rule could define that the whole resource
is presented to the user as 50.3 kg
.
Configuration
Display patterns can be administrated in the "admin" view, "configuration" tab, in the section "Display Patterns".
New patterns can be added with the "plus" symbol in the upper right corner, existing patterns can be edited or deleted.
The pattern's configuration consists of the following parts:
- Name: The name should briefly describe the pattern and allow administrators to recognize it quickly. It does not affect the application of the pattern itself.
- Entity Types: A value must have one of the given entity types for the display pattern to be applied. Each type is a valid URI. If no entity type is given, the type is not checked. If several types are given, it is sufficient if the entity has one of the types.
-
Properties: The value to display must be referred to by one of the given properties. If no property is given, all properties are accepted. If several properties are given, the entity to display must be referred to by one of them.
There must be at least one entity type or property specified. If both entity types and properties are specified, the rule matches when the value is linked to the entity by one of the properties and the value is of one of the properties. * Concatenated Values: When an entity is matched according to the entity types and properties described above, a list of expressions are evaluated and concatenated to calculate the result. Each expression can be one of the following types:
- Text: The given text is appended to the result.
- Newline: A new line is started. The shown value can be spread over several lines with options.
- Path: Starting from the value, the given SPARQL path
is evaluated, and the found solution is
shown. This option is used to extract certain values from the data.
Only sequences of URIs are supported. Each URI is put in angle brackets (like
<http://www.w2.org/2000/01/rdf-schema#type>
). A sequence is a list of such URIs, separated by slashes (/
).
Examples
The following Turtle file shows an example of a unit definition (Kilogram) and an entity with a "QuantityValue" and an address. In reality, the definition of a unit and the value often reside in separate datasets.
We show two examples of configuring Accurids to present these values concisely.
@prefix test: <http://accurids.com/demo#>
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#>
unit:KiloGM a qudt:Unit ;
qudt:hasDimensionVector <http://qudt.org/vocab/dimensionvector/A0E0L0I0M1H0T0D0> ;
qudt:hasQuantityKind <http://qudt.org/vocab/quantitykind/Mass> ;
qudt:symbol "kg" ;
rdfs:label "Kilogram"@en.
test:AnEntity
a test:Example ;
rdfs:label "Example with Address" ;
test:hasAddress [
test:street "Eisenbahnweg 7-9" ;
test:city "52078 Aachen"
] ;
test:hasWeight [
a qudt:QuantityValue ;
qudt:numericValue 60.0 ;
qudt:unit unit:KiloGM
] .
When the two example display patterns below are configured, the example's entity should be presented as shown here:
Example: QUDT Quantity Value
The first pattern will match QUDT quantity values and shows the value and the unit together as a short string. For
the example above as 60.0 kg
.
- Name:
Quantity Value
(can be chosen arbitrarily) - Entity types:
http://qudt.org/schema/qudt/Quantity Value
(The pattern should be applied to entities of this type) - Properties: None, the pattern is applied to values of all properties.
- Concatenated Values:
- Path:
<http://qudt.org/schema/qudt/numericValue>
is the property that should be printed first. - Text: A single space should separate value and unit.
- Path:
<http://qudt.org/schema/qudt/unit>/<http://qudt.org/schema/qudt/symbol>
is a SPARQL path consisting of two steps. First, we navigate from the displayed entity via the unit property to the unit entity, then we look for the unit's symbol property which iskg
in the example.
Example: Simple Address
This pattern shows how the properties are used to specify to which values the display pattern should be applied.
- Name:
Address
(can be chosen arbitrarily) - Entity types: None, the pattern is applied to all kinds of entities.
- Properties:
http://accurids.com/demo#hasAddress
specifies that this rule should only be applied to values that are referenced with this predicate. - Concatenated Values:
- Path:
<http://accurids.com/demo#street>
The first line contains the street. - Newline: Between street and city should be shown a line break.
- Path:
<http://accurids.com/demo#city>
The second line contains the city.