-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.bs
160 lines (116 loc) · 6.75 KB
/
index.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<pre class='metadata'>
Title: RDF Triple Compounds
Shortname: RTC
Level: 1
Status: LS
URL: https://w3id.org/rtc
Repository: rtc-org/spec
Editor: Marcel Otto
Abstract: This document defines the concept of a triple compound as a set of RDF statements. Since RDF graphs are basically just sets of triples, triple compounds can be understood as logical RDF graphs inside of physical RDF graphs. Above this, a way for a further nesting of compound structures is defined.
Markup Shorthands: markdown yes
Markup Shorthands: dfn yes
Markup Shorthands: css no
</pre>
Introduction {#intro}
=====================
The RDF-star extension [[!RDF-star]] of RDF [[RDF-Concepts]] provides a solution to the problem of how to make statements about statements, which occurs in several situations, e.g. when we want to state assertions about the certainty or provenance of some statements.
Sometimes, however, we have a bunch of triples we want to annotate. For example, if we get a set of triples from a form like these:
```turtle
PREFIX : <http://www.example.org/>
:employee38
:firstName "John" ;
:familyName "Smith" ;
:jobTitle "Assistant Designer" .
```
If we want to store these statements now with provenance information to capture when they were created and by whom, we're faced with the problem that we can only annotate a single triple. So, we could try this approach:
```turtle
PREFIX : <http://www.example.org/>
:employee38
:firstName "John" {| :statedBy :bob ; :statedAt "2022-02-16" |} ;
:familyName "Smith" {| :statedBy :bob ; :statedAt "2022-02-16" |} ;
:jobTitle "Assistant Designer" {| :statedBy :bob ; :statedAt "2022-02-16" |} .
```
Not only is the repetition of the provenance annotations in this approach problematic in terms of space and maintenance, it also doesn't model the situation correctly. These statements weren't stated independently just coincidental at the same time by the same person, but as a whole.
A better approach would be to introduce a new node that represents the set of statements as a dedicated resource, and assign the triples as elements to this resource using RDF-star statements.
This vocabulary defines a class and properties for exactly this purpose.
So, triple compounds are a general way to represent sets of triples inside a graph, i.e. named sub-graphs, and as such, might be useful in many use cases, for example:
- for custom [bounded descriptions](https://patterns.dataincubator.org/book/bounded-description.html)
- everywhere where named graphs are too course-grained or can not be used for other reasons
By introducing a standard class and properties for this RDF-star usage pattern, it is possible to create more broadly reusable tools for this, in particular libraries offering an abstraction that allows to work with such compounds like normal graphs and deal with required annotations under the hood.
Triple compounds {#triple-compounds}
====================================
A *triple compound* is a set of triples formed by assigning triples to a shared node.
The triples are assigned to a compound with an RDF-star statement using the `rtc:elementOf` property.
```turtle
PREFIX : <http://www.example.org/>
PREFIX rtc: <https://w3id.org/rtc#>
:employee38
:firstName "John" {| rtc:elementOf :compound1 |} ;
:familyName "Smith" {| rtc:elementOf :compound1 |} ;
:jobTitle "Assistant Designer" {| rtc:elementOf :compound1 |} .
:compound1 a rtc:Compound ;
:statedBy :bob ;
:statedAt "2022-02-16" .
```
Alternatively, the `rtc:elements` property as the inverse of `rtc:elementOf` can be used.
```turtle
PREFIX : <http://www.example.org/>
PREFIX rtc: <https://w3id.org/rtc#>
:employee38
:firstName "John" ;
:familyName "Smith" ;
:jobTitle "Assistant Designer" .
:compound1 a rtc:Compound ;
:statedBy :bob ;
:statedAt "2022-02-16" ;
rtc:elements
<< :employee38 :firstName "John" >> ,
<< :employee38 :familyName "Smith" >> ,
<< :employee38 :jobTitle "Assistant Designer" >> .
```
Note, that the `rdf:type` statement declaring the triple compound as a `rtc:Compound` explicitly is just used for educational purposes. It is not required and could be inferred from the use of the `rtc:elementOf` or `rtc:elements` properties having the `rtc:Compound` as its `rdfs:range` resp. `rdfs:domain`.
The triples of a triple compound MUST be quoted triples. They MAY be asserted or unasserted triples.
Sub-compounds {#sub-compounds}
=====================
Note: The triple compounds as described above can be used with any system implementing RDF-star. However, as the semantics of the following feature can not be expressed in RDFS, a proper interpretation relies on explicit implementations of the specified behaviour.
A triple compound can be defined as a sub-compound of another one with the `rtc:subCompoundOf` property.
The set of triples of the sub-compound MUST then be interpreted by an implementation as becoming a subset of the triples of the super-compound.
All statements about the super-compound MUST be interpreted to also apply to all of its sub-compounds, except for the `rtc:elements` statements.
For example, we could introduce a dedicated compound for all triples from a user and further structure this set with sub-compounds of triples stated at a certain date.
```turtle
PREFIX : <http://www.example.org/>
PREFIX rtc: <https://w3id.org/rtc#>
:employee38
:firstName "John" ;
:familyName "Smith" ;
:jobTitle "Assistant Designer" .
:employee39
:firstName "Jane" ;
:familyName "Doe" ;
:jobTitle "HR Manager" .
:compound1 a rtc:Compound ;
:statedBy :bob .
:compound2
rtc:subCompoundOf :compound1 ;
:statedAt "2022-02-16" ;
rtc:elements
<< :employee38 :firstName "John" >> ,
<< :employee38 :familyName "Smith" >> ,
<< :employee38 :jobTitle "Assistant Designer" >> .
:compound3
rtc:subCompoundOf :compound1 ;
:statedAt "2022-02-17" ;
rtc:elements
<< :employee39 :firstName "Jane" >> ,
<< :employee39 :familyName "Doe" >> ,
<< :employee39 :jobTitle "HR Manager" >> .
```
In an implementation, the `:statedBy :bob` statement is interpreted to become part of the sub-compounds `:compound2` and `:compound3` and the triples in `:compound2` and `:compound3` would become part of the triples in `:compound1`.
Vocabulary {#vocab}
===================
<span><a href="vocab/rtc.ttl" target="_blank"><img src="https://img.shields.io/badge/Format-Turtle-blue.svg" alt="Turtle"></a> </span>
<span><a href="vocab/rtc.nt" target="_blank"><img src="https://img.shields.io/badge/Format-NTriples-blue.svg" alt="N-Triples"></a> </span>
<span><a href="vocab/rtc.rdf" target="_blank"><img src="https://img.shields.io/badge/Format-RDF/XML-blue.svg" alt="RDF/XML"></a> </span>
<pre class=include>
path: vocab_spec.bs
</pre>