-
Notifications
You must be signed in to change notification settings - Fork 1
/
LBD-school_1.html
701 lines (584 loc) · 30.4 KB
/
LBD-school_1.html
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<!doctype html>
<html>
<!--
TODO
1. Tilføj noget om K4A
2. Fyld mere tekst på timeline
3. Tilføj lecture notes
-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>LBD School lecture 2</title>
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/mhra.css">
<!-- Theme used for syntax highlighted code -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
<!-- Custom styles -->
<style>
li{
font-size: 0.8em;
}
p{
font-size: 0.8em;
}
.two-col {
display: flex;
height: 100vh;
}
.col {
flex: 1;
padding: 50px;
}
.footer-left {
position: absolute;
bottom: 27px;
left: 80px;
padding: 0;
margin: 0;
display: flex;
flex-direction: row;
gap: 10px;
align-content: flex-start;
align-items: center;
}
.box {
background-color: rgba(255, 255, 255, 0.5);
border-top: 1px solid black;
border-bottom: 1px solid black;
font-size: 1em !important;
color: black;
padding: 1vh;
}
.box-top-left {
position: absolute;
left: 0vw;
top: -30vh;
background-color: rgba(255, 255, 255, 0.5);
border-top: 1px solid black;
border-bottom: 1px solid black;
font-size: 1em !important;
color: black;
padding: 1vh;
}
.top-right {
position: static;
right: 0vw;
top: 0vh;
bottom: 40vh;
z-index: 10;
background-color: red;
}
.note{
font-family: Consolas, monaco, monospace;
font-size: 0.4em;
font-weight: bold;
}
.coded{
font-family: Consolas, monaco, monospace;
font-size: 0.7em;
font-weight: 100;
}
</style>
</head>
<body>
<div class="reveal">
<!-- Captions -->
<cap
style="position: absolute; bottom: 12vh; left: 0px; width: 100%; z-index:500; text-align: center; font-size: 1.9vw; font-style: italic; color: #65625e">
</cap>
<!-- Footer left -->
<!-- <div class="footer-left">
<span style="font-size: 0.6em">LBD School Lecture 1</span>
</div> -->
<!-- Slides -->
<div class="slides">
<section>
<h1>LBD School lecture 1</h1>
<h3>Introduction to Linked Building Data</h3>
<p>By Mads Holten Rasmussen</p>
<p style="font-size: 0.6em">v0</p>
</section>
<!-- Foreword -->
<section>
<section>
<p>This tutorial is part of a series in the <a href="./LBD-school_overview.html">Linked Building Data (LBD) School</a> 🏫</p>
<p class="fragment fade-up">The slides are quite detailed and text-heavy as they are supposed to be read rather than presented.</p>
<p class="fragment fade-up">As I have been using the technologies for a while there might be topics that I take for granted and therefore skip over too fast. Please let me know if this is the case! 🙏</p>
<p class="fragment fade-up">Also, since this is something I do in my freetime, please support me by buying me a coffee 🤗☕💙</p>
</section>
<section>
<h2>What you will learn</h2>
<ul>
<li>the Linked Data principles</li>
<li>intro to Resource Description Framework (RDF)</li>
<li>different serializations of RDF</li>
<li>the Building Topology Ontology (BOT) and other LBD ontologies</li>
</ul>
</section>
</section>
<!-- Intro -->
<section>
<section>
<h2>Linked Building Data? 🤔</h2>
</section>
<section>
<p>Linked Building Data (LBD) encapsulates all the ontologies that are being developed and maintained by the <a href="https://www.w3.org/community/lbd/">W3C Linked Building Data Community Group</a></p>
<p class="fragment fade-up">They are an alternative to the <a href="https://www.w3.org/TR/owl-primer/">Web Ontology Language (OWL)</a> version of <a href="https://www.buildingsmart.org/standards/bsi-standards/industry-foundation-classes/">IFC</a> (ifcOWL) that are easier to understand, extend and query 👌</p>
<p class="fragment fade-up">...but before we can dig into the content of these we will need to learn the basics. So jump to next slide and we will get to it! 💪🏃💨</p>
</section>
</section>
<!-- Linked Data -->
<section>
<section>
<h2>Linked Data</h2>
<p>The concept of Linked Data was <a href="https://www.w3.org/DesignIssues/LinkedData">coined in 2006</a> by sir Tim Berners-Lee, the inventor of the web, and is therfore not entirely new 👴👵</p>
<p class="fragment fade-up">It basically refers to a set of best practices for publishing structured data on the Web</p>
<style>
.cap-ld cap:after {
content: "¹https://www.w3.org/DesignIssues/LinkedData";
}
</style>
</section>
<section>
<h2>Linked Data Principles 🤓</h2>
<ol>
<li>Use URIs <span class="note">(Uniform Resource Identifiers)</span> as names for things</li>
<li class="fragment fade-up">Use HTTP URIs <span class="note">(web addresses)</span> so that people can look up those names 👀</li>
<li class="fragment fade-up">When someone looks up a URI, provide useful information, using the standards (RDF, SPARQL) <span class="note">(more on this later)</span> 💡</li>
<li class="fragment fade-up">Include links to other URIs so that they can discover more things 🔭🧭🗺️</li>
</ol>
</section>
<section>
<h2>Summary</h2>
<p>A network of resources that are interlinked and identified by web addresses.</p>
<p class="fragment fade-up">Beware that you will often see resorces that are described in a namespace that doesn't really exist <span class="note">(e.g. https://example.com/my-resource).</span> This is not preferred but yet perfectly okay in order to learn and get started. 🩹</p>
<p class="fragment fade-up">Also note that not all linked data needs to be open data. You can restrict the access to it 🚦🦺</p>
</section>
</section>
<!-- RDF -->
<section>
<section>
<h2>The Resource Description Framework</h2>
<p>As the name reveils, <a href="https://www.w3.org/TR/rdf11-primer/">RDF</a> is a framework and not a format. It includes the terminology you need to describe Linked Data resources <span class="note">(e.g. the type of resource, its attributes and its relationships to other resources)</span>.</p>
<p class="fragment fade-up">This is all done by creating statements: so-called "triples".</p>
</section>
<section data-background-image="./static/images/SPO.svg"></section>
<section data-background-image="./static/images/SPO2.svg"></section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro01"></section>
<section>
<p>Multiple triples form a graph if the object of one triple matches the subject of another</p>
<p class="fragment fade-up">This is often referred to as a "Knowledge Graph"</p>
</section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro02"></section>
<section>
<p>Predicates that connect resources are called <span class="coded">"object properties"</span></p>
<p class="fragment fade-up"><span class="coded">"has_window"</span> and <span class="coded">"adjacent_element"</span> from the previous graphs are examples of object properties</p>
</section>
<section>
<p>RDF also describes simple properties that point to an object which is simply a literal value. Those are called <span class="coded">"datatype properties"</span></p>
</section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro03"></section>
<section>
<p>As a last thing, RDF allows you to classify a thing by assigning one or more types to it.</p>
</section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro04"></section>
<section>
<p>Adding classes to things provide a better way for others to understand your dataset. And for computers!</p>
<p>You and I could probably deduce that <span class="coded">Wall_002</span> is a Wall, but now it is explicitly stated.</p>
</section>
<section>
<p>That's it! Now you know the basic principles of RDF! 🥳🎉</p>
</section>
<section>
<p>Oh, not too fast! The Linked Data principles state that we should use HTTP URIs as names for things, so actually it looks more like shown on next slide... 😱🤯</p>
</section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro05"></section>
<section>
<p>But don't worry! With the use of prefixes, it will look more like this 😌</p>
</section>
<section data-background-iframe="./static/interactive/spo-graph/index.html?file=rdf-intro06"></section>
<section>
<p>The prefixes are abbreviations for the full URI so:</p>
<p><span class="coded">inst:Wall_002</span> = <span class="coded">https://my-company.com/Wall_002</span></p>
<p><span class="coded">inst:Space_013</span> = <span class="coded">https://my-company.com/Space_013</span></p>
<p><span class="coded">ont:has_window</span> = <span class="coded">https://my-ontology.com#has_window</span></p>
</section>
<section>
<p>In the example we use two prefixes (<span class="coded">inst:</span> and <span class="coded">ont:</span>) and therefore these refere to our instance namespace and the ontology namespace.</p>
<p class="fragment fade-up">...and this brings us to the concepts ABox and TBox.</p>
<p class="fragment fade-up">TBox is the "terminology layer" <span class="note">(i.e. the dictionaries)</span> where predicates and classes are defined. These can later be used by various people to describe something. 📙</p>
<p class="fragment fade-up">ABox is our "assertions layer" <span class="note">(i.e. the instance data)</span> where we make actual statements about the world by using the TBox.</p>
</section>
<section>
<p>It is common to see multiple ontologies to describe one dataset. This is one of the absolute strengths about Linked Data. That it can be both an <span class="coded">ifc:Building</span> as defined by <a href="https://www.buildingsmart.org/">buildingSMART</a>, an <span class="coded">citygml:Building</span> as described by <a href="https://www.ogc.org/">OGC</a> and a <a href="https://dbpedia.org/resource/Building"><span class="coded">dbpedia:Building</span></a> referring to Wikipedias description of a building.</p>
<p class="fragment fade-up">In LBD we would typically at least describe it as a <a href="https://w3id.org/bot#Building"><span class="coded">bot:Building</span></a>, but more on this later.</p>
</section>
<section>
<p>Also the instance data can be distributed so part of the data can reside on one server and other parts on another.</p>
<p class="fragment fade-up">Thereby there is a huge decentralization potential in the technologies that we will hopefully cover in a later class! 🚀🚀🚀</p>
</section>
</section>
<!-- RDF vs tables -->
<section>
<section>
<h2>RDF vs. tables</h2>
</section>
<section>
<p>Most of us are used to storing information in spreadsheets <span class="note">(or relational databases (RDBs) for the more advanced)</span>, but in RDF we use a graph structure. So how do those compare?</p>
<p class="fragment fade-up">Let's take a look at a very simple table example to find out!</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-01.svg"></section>
<section>
<p>From an RDF perspective we see too subjects. One for each data row. And they are even identified with an ID.</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-02.svg"></section>
<section>
<p>Each column contains a statement about those subjects and the predicate value is given by the column header.</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-03.svg"></section>
<section>
<p>The value of the subject-predicate pair can then be found in the cell.</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-04.svg"></section>
<section data-background-image="./static/images/RDF-en-simple-05.svg"></section>
<section>
<p>And with RDF we can combine table data as long as we can find a common identifier for the rows.</p>
<p class="fragment fade-up">For example, we could have another table with middle names.</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-06.svg"></section>
<section>
<p>It's not a problem that there is no middle name for Alexander. RDF builds on an open world assumption meaning that if we have the information that's great and if we don't that's also alright. Then Alexanders middle name is simply unknown to us.</p>
<p class="fragment fade-up">In RDBs it's common to have dedicated tables that deal with many-to-many relationships. These are also easily translated.</p>
</section>
<section data-background-image="./static/images/RDF-en-simple-07.svg"></section>
<section>
<p>So now we also understand the difference and similarities between RDF and tables. And you can probably see how this data structure will save us for a ton of null values. 😃</p>
<p class="fragment fade-up">And compared to RDBs there is the benefit that the data model makes sense from a logical perspective and not only from a data management perspective. This benefit will be more obvious when we start to query the datasets later!</p>
</section>
</section>
<!-- RDF serializations -->
<section>
<section>
<h2>RDF Serializations</h2>
<p>This is a more advanced topic for those that are familiar with XML or JSON.</p>
<p class="fragment fade-up">You can press the right arrow to skip this section, but if you're up for it, hit the down arow! 💪</p>
</section>
<section>
<p>Let's first take a look at what RDF looks like in the simplest of all serializations called <a href="https://www.w3.org/TR/n-triples/">NTriples</a>.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
<https://my-company.com/Wall_002> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Wall> .
<https://my-company.com/Wall_002> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Element> .
<https://my-company.com/Wall_002> <https://my-ontology.com#has_window> <https://my-company.com/Window_022> .
<https://my-company.com/Wall_002> <https://my-ontology.com#U_value> "0.21 W/m2K" .
<https://my-company.com/Wall_002> <https://my-ontology.com#thickness> "240 mm" .
<https://my-company.com/Space_013> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Space> .
<https://my-company.com/Space_013> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Zone> .
<https://my-company.com/Space_013> <https://my-ontology.com#adjacent_element> <https://my-company.com/Wall_002> .
<https://my-company.com/Space_013> <https://my-ontology.com#area> "12.4 m2" .
<https://my-company.com/Space_013> <https://my-ontology.com#number_of_occupants> 2 .
<https://my-company.com/Space_013> <https://my-ontology.com#heated> true .
<https://my-company.com/Window_022> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Window> .
<https://my-company.com/Window_022> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://my-ontology.com#Element> .
<https://my-company.com/Window_022> <https://my-ontology.com#height> "1200 mm" .
<https://my-company.com/Window_022> <https://my-ontology.com#width> "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>This syntax is incredibly simple and super fast for computers to read.</p>
<p class="fragment fade-up">Triples are stated in their full length and a dot indicates the end of a triple.</p>
<p class="fragment fade-up">However, for humans it is impossible to read and it takes up a lot of space!</p>
</section>
<section>
<p>The Terse RDF Triple Language <a href="https://www.w3.org/TR/turtle/">Turtle</a> simplifies this a whole lot by introducing some syntactic sugar.</p>
<p class="fragment fade-up">All this sugar is not covered here, but part of it is since this is also the syntax used in queries. Let's start by defining the prefixes as described in previous section.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix inst: <https://my-company.com/> .
@prefix ont: <https://my-ontology.com#> .
inst:Wall_002 rdf:type ont:Wall .
inst:Wall_002 rdf:type ont:Element .
inst:Wall_002 ont:has_window inst:Window_022 .
inst:Wall_002 ont:U_value "0.21 W/m2K" .
inst:Wall_002 ont:thickness "240 mm" .
inst:Space_013 rdf:type ont:Space .
inst:Space_013 rdf:type ont:Zone .
inst:Space_013 ont:adjacent_element inst:Wall_002 .
inst:Space_013 ont:area "12.4 m2" .
inst:Space_013 ont:number_of_occupants 2 .
inst:Space_013 ont:heated true .
inst:Window_022 rdf:type ont:Window .
inst:Window_022 rdf:type ont:Element .
inst:Window_022 ont:height "1200 mm" .
inst:Window_022 ont:width "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>In turtle <span class="coded">a</span> can be used as an abbreviation for <span class="coded">rdf:type</span>, so we can further simplify it to.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
@prefix inst: <https://my-company.com/> .
@prefix ont: <https://my-ontology.com#> .
inst:Wall_002 a ont:Wall .
inst:Wall_002 a ont:Element .
inst:Wall_002 ont:has_window inst:Window_022 .
inst:Wall_002 ont:U_value "0.21 W/m2K" .
inst:Wall_002 ont:thickness "240 mm" .
inst:Space_013 a ont:Space .
inst:Space_013 a ont:Zone .
inst:Space_013 ont:adjacent_element inst:Wall_002 .
inst:Space_013 ont:area "12.4 m2" .
inst:Space_013 ont:number_of_occupants 2 .
inst:Space_013 ont:heated true .
inst:Window_022 a ont:Window .
inst:Window_022 a ont:Element .
inst:Window_022 ont:height "1200 mm" .
inst:Window_022 ont:width "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>We can further use <span class="coded">";"</span> instead of <span class="coded">"."</span> to state the end of a triple where the same subject is to be reused in next triple.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
@prefix inst: <https://my-company.com/> .
@prefix ont: <https://my-ontology.com#> .
inst:Wall_002 a ont:Wall ;
a ont:Wall ;
ont:has_window inst:Window_022 ;
ont:U_value "0.21 W/m2K" ;
ont:thickness "240 mm" .
inst:Space_013 a ont:Space .
a ont:Zone ;
ont:adjacent_element inst:Wall_002 ;
ont:area "12.4 m2" ;
ont:number_of_occupants 2 ;
ont:heated true .
inst:Window_022 a ont:Window ;
a ont:Wall ;
ont:height "1200 mm" ;
ont:width "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>Lastly, we can use <span class="coded">","</span> to state the end of a triple where the same subject-predicate pair is to be reused in next triple.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
@prefix inst: <https://my-company.com/> .
@prefix ont: <https://my-ontology.com#> .
inst:Wall_002 a ont:Wall ,
ont:Element ;
ont:has_window inst:Window_022 ;
ont:U_value "0.21 W/m2K" ;
ont:thickness "240 mm" .
inst:Space_013 a ont:Space ,
ont:Zone ;
ont:adjacent_element inst:Wall_002 ;
ont:area "12.4 m2" ;
ont:number_of_occupants 2 ;
ont:heated true .
inst:Window_022 a ont:Window ,
ont:Wall ;
ont:height "1200 mm" ;
ont:width "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>Since line breaks are ignored we can also write it more compact as shown on next slide. Further, the order is of no importance.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="text">
@prefix inst: <https://my-company.com/> .
@prefix ont: <https://my-ontology.com#> .
inst:Wall_002
a ont:Wall , ont:Element ;
ont:has_window inst:Window_022 ;
ont:U_value "0.21 W/m2K" ;
ont:thickness "240 mm" .
inst:Space_013
a ont:Space , ont:Zone ;
ont:adjacent_element inst:Wall_002 ;
ont:area "12.4 m2" ;
ont:number_of_occupants 2 ;
ont:heated true .
inst:Window_022
a ont:Window , ont:Wall ;
ont:height "1200 mm" ;
ont:width "900 mm" .
</code></pre>
</div>
</section>
<section>
<p>RDF can also be serialized as XML and JSON. <a href="https://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a> will not be covered <span class="note">(who uses XML anyways?)</span>, but the new cool kid on the block <a href="https://www.w3.org/TR/json-ld11/">JSON-LD</a> will for sure.</p>
</section>
<section>
<p>Like Turtle JSON-LD can have many shapes and forms. The simplest form is the expanded version .</p>
<p class="fragment fade-up">JSON-LD is just JSON but it adds some special keys like <span class="coded">@id</span> to define the subject and <span class="coded">@type</span> to assign <span class="coded">rdf:type</span>.</p>
<p class="fragment fade-up">Similarly to NTriples, the expanded JSON-LD uses the full URIs. Since RDF allows for multiple assignments of classes or any other value for that matter, the value of any key is always an array.</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="json">
[
{
"@id": "https://my-company.com/Wall_002",
"@type": [
"https://my-ontology.com#Wall",
"https://my-ontology.com#Element"
],
"https://my-ontology.com#U_value": [
{
"@value": "0.21 W/m2K"
}
],
"https://my-ontology.com#has_window": [
{
"@id": "https://my-company.com/Window_022"
}
],
"https://my-ontology.com#thickness": [
{
"@value": "240 mm"
}
]
},
{
"@id": "https://my-company.com/Space_013",
"@type": [
"https://my-ontology.com#Space",
"https://my-ontology.com#Zone"
],
"https://my-ontology.com#adjacent_element": [
{
"@id": "https://my-company.com/Wall_002"
}
],
"https://my-ontology.com#area": [
{
"@value": "12.4 m2"
}
],
"https://my-ontology.com#heated": [
{
"@value": true
}
],
"https://my-ontology.com#number_of_occupants": [
{
"@value": 2
}
]
},
{
"@id": "https://my-company.com/Window_022",
"@type": [
"https://my-ontology.com#Window",
"https://my-ontology.com#Element"
],
"https://my-ontology.com#height": [
{
"@value": "1200 mm"
}
],
"https://my-ontology.com#width": [
{
"@value": "900 mm"
}
]
}
]
</code></pre>
</div>
</section>
<section>
<p>By stating a <span class="coded">@context</span> and use the concept of compaction it is possible to simplify this tremendously.</p>
<p class="fragment fade-up">The <span class="coded">@graph</span> component of the result presents all our resources in a flat list.</p>
<p class="fragment fade-up">JSON-LD comes with tools to change between these representations on the fly which is a really strong tool. In a later tutorial we might take a look at framing!</p>
</section>
<section>
<div class="row down-5" style="opacity: 0.8">
<pre><code data-trim class="json">
{
"@context": {
"inst": "https://my-company.com/",
"ont": "https://my-ontology.com#"
},
"@graph": [
{
"@id": "inst:Wall_002",
"@type": ["ont:Wall", "ont:Element"],
"ont:has_window": {"@id": "inst:Window_022"},
"ont:U_value": "0.21 W/m2K",
"ont:thickness": "240 mm"
},
{
"@id": "inst:Space_013",
"@type": ["ont:Space", "ont:Zone"],
"ont:adjacent_element": {"@id": "inst:Wall_002"},
"ont:area": "12.4 m2",
"ont:number_of_occupants": 2,
"ont:heated": true
},
{
"@id": "inst:Window_022",
"@type": ["ont:Window", "ont:Element"],
"ont:height": "1200 mm",
"ont:width": "900 mm"
}
]
}
</code></pre>
</div>
</section>
<section>
<p>At the <a href="https://json-ld.org/playground/">JSON-LD playground</a> you can get a more detailed introduction to the possibilities. Next slide for example demonstrates a compaction that maps to danish keys in the JSON object.</p>
</section>
<section data-background-iframe="https://json-ld.org/playground/#startTab=tab-compacted&json-ld=%7B%22%40context%22%3A%7B%22inst%22%3A%22https%3A%2F%2Fmy-company.com%2F%22%2C%22ont%22%3A%22https%3A%2F%2Fmy-ontology.com%23%22%7D%2C%22%40graph%22%3A%5B%7B%22%40id%22%3A%22inst%3AWall_002%22%2C%22%40type%22%3A%5B%22ont%3AWall%22%2C%22ont%3AElement%22%5D%2C%22ont%3Ahas_window%22%3A%7B%22%40id%22%3A%22inst%3AWindow_022%22%7D%2C%22ont%3AU_value%22%3A%220.21%20W%2Fm2K%22%2C%22ont%3Athickness%22%3A%22240%20mm%22%7D%2C%7B%22%40id%22%3A%22inst%3ASpace_013%22%2C%22%40type%22%3A%5B%22ont%3ASpace%22%2C%22ont%3AZone%22%5D%2C%22ont%3Aadjacent_element%22%3A%7B%22%40id%22%3A%22inst%3AWall_002%22%7D%2C%22ont%3Aarea%22%3A%2212.4%20m2%22%2C%22ont%3Anumber_of_occupants%22%3A2%2C%22ont%3Aheated%22%3Atrue%7D%2C%7B%22%40id%22%3A%22inst%3AWindow_022%22%2C%22%40type%22%3A%5B%22ont%3AWindow%22%2C%22ont%3AElement%22%5D%2C%22ont%3Aheight%22%3A%221200%20mm%22%2C%22ont%3Awidth%22%3A%22900%20mm%22%7D%5D%7D&context=%7B%22%40context%22%3A%7B%22inst%22%3A%22https%3A%2F%2Fmy-company.com%2F%22%2C%22ont%22%3A%22https%3A%2F%2Fmy-ontology.com%23%22%2C%22areal%22%3A%7B%22%40id%22%3A%22ont%3Aarea%22%7D%2C%22uVaerdi%22%3A%7B%22%40id%22%3A%22ont%3AU_value%22%7D%2C%22harVindue%22%3A%7B%22%40id%22%3A%22ont%3Ahas_window%22%7D%2C%22tykkelse%22%3A%7B%22%40id%22%3A%22ont%3Athickness%22%7D%2C%22tilstoedendeBygningsdel%22%3A%7B%22%40id%22%3A%22ont%3Aadjacent_element%22%7D%2C%22opvarmet%22%3A%7B%22%40id%22%3A%22ont%3Aheated%22%7D%2C%22personer%22%3A%7B%22%40id%22%3A%22ont%3Anumber_of_occupants%22%7D%2C%22hoejde%22%3A%7B%22%40id%22%3A%22ont%3Aheight%22%7D%2C%22bredde%22%3A%7B%22%40id%22%3A%22ont%3Awidth%22%7D%7D%7D"></section>
</section>
<!-- BOT etc -->
<section>
<section>
<h2>The Building Topology Ontology (BOT)</h2>
</section>
<section>
<p>To be continued...</p>
</section>
</section>
</div>
</div>
<!-- Buy me a coffee -->
<a href="https://www.buymeacoffee.com/madsholten" class="coffee-btn" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee"></a>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2/reveal.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2/plugin/notes/notes.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2/plugin/markdown/markdown.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/4.1.2/plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [RevealMarkdown, RevealHighlight, RevealNotes]
});
</script>
</body>
</html>