You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cap/docs/v2-announcement.md
+42-43Lines changed: 42 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
-
title: "From the Cinema to the Cloud: Announcing v2.0"
2
+
title: "From the Cinema to the Cloud: Announcing v2.0 of the Cloud CAP HANA SWAPI Sample"
3
3
---
4
4
5
-
# From the Cinema to the Cloud: Announcing v2.0
5
+
# From the Cinema to the Cloud: Announcing v2.0 of the Cloud CAP HANA SWAPI Sample
6
6
7
7
## A Long Time Ago in a Cinema Far, Far Away
8
8
9
9
I was six years old in 1980.
10
10
11
-
Which means I was exactly the right age to have my brain completely rewired by *The Empire Strikes Back*.
11
+
Which means I was exactly the right age to have my brain completely rewired by *Star Wars: The Empire Strikes Back*.
12
12
13
-
I remember sitting in that darkened theater, eyes wide, watching Star Destroyers that filled the entire screen, an asteroid field that felt genuinely dangerous, and a revelation at the end that I'm still not going to spoil even though everyone on earth has had 45 years to catch up. I walked out of that cinema convinced of two things: space was real and stories mattered.
13
+
I remember sitting in that darkened theater, eyes wide, watching Star Destroyers that filled the entire screen, an asteroid field that felt genuinely dangerous, and a revelation at the end that I'm still not going to spoil even though everyone on earth has had 45 years to catch up. I walked out of that cinema convinced of two things: space was really interesting and stories mattered.
14
14
15
-
Those two convictions have shaped everything I've done since — including, it turns out, this project.
15
+
Those two convictions have shaped everything I've done since including, it turns out, this project.
16
16
17
17
I became a developer, but I never stopped being someone who believed that the *way* you tell a story about technology matters as much as the technology itself. Which is probably why, when I needed a dataset to demonstrate SAP Cloud Application Programming Model patterns, I reached for the one universe I've loved since I was six.
18
18
@@ -24,20 +24,20 @@ If you've spent any time in web development over the last decade, you've probabl
24
24
25
25
Paul Hallett built it in 2014 as a REST learning tool, and it became something of a cultural fixture in developer education. Every tutorial that needed "some real data to work with" reached for SWAPI. It has 87 characters, 60 planets, 37 starships, 39 vehicles, 14 species, and 6 films — all neatly organized, consistently structured, and immediately recognizable.
26
26
27
-
The brilliance of SWAPI as a teaching tool is that **you already know the data**. When a tutorial shows you `{"name": "Luke Skywalker", "height": "172", "homeworld": "Tatooine"}`, you don't need to understand the domain. You already live there. That frees your brain to focus on what the tutorial is actually teaching.
27
+
The brilliance of SWAPI as a teaching tool is that so many of **you already know the data**. When a tutorial shows you `{"name": "Luke Skywalker", "height": "172", "homeworld": "Tatooine"}`, you don't need to understand the domain. You already live there. That frees your brain to focus on what the tutorial is actually teaching.
28
28
29
29
---
30
30
31
31
## SWAPI Meets CAP
32
32
33
-
About two years ago I needed a sample application to demonstrate SAP CAP patterns — specifically the parts that are genuinely tricky to teach: many-to-many relationships, multi-database profiles, exposing the same data model as OData v4, OData v2 (via adapter), GraphQL, and REST all at once, managed entities with `cuid`, authorization roles, event-driven patterns.
33
+
A few years ago I needed a sample application to demonstrate SAP CAP patterns, specifically the parts that are genuinely tricky to teach: many-to-many relationships, multi-database profiles, exposing the same data model as OData v4, OData v2 (via adapter), GraphQL, and REST all at once, managed entities with `cuid`, authorization roles, and event-driven patterns.
34
34
35
35
SWAPI was the obvious choice. Here's why it works so well:
36
36
37
37
-**Many-to-many relationships everywhere**: Films connect to characters, planets, starships, vehicles, and species. Every junction table is a teaching moment.
38
-
-**Familiar data, unfamiliar patterns**: Learners already understand who Han Solo is. They can focus on *how* the data is modeled, not *what* it represents.
38
+
-**Familiar data, unfamiliar patterns**: Most learners already understand who Han Solo is. They can focus on *how* the data is modeled, not *what* it represents. And even if you haven't seen any of the films (what have you been doing with your life?), the data is still fun, engaging, and easy to explore.
39
39
-**Multi-profile story**: The same schema runs on SQLite locally, PostgreSQL for teams, and SAP HANA Cloud for production. The data doesn't care which backend you use.
40
-
-**Rich enough to be realistic**: 87 characters across 6 films gives you enough data that queries feel real, but small enough that everything loads fast.
40
+
-**Rich enough to be realistic**: 87 characters across 6 films gives you enough data that queries feel real, but small enough that everything loads fast and local development is smooth.
41
41
42
42
The original `cloud-cap-hana-swapi` was well-received. It showed developers exactly what it was designed to show, and I was happy with it.
43
43
@@ -51,34 +51,34 @@ SWAPI covers six films.
51
51
52
52
Episodes I through VI. The Phantom Menace through Return of the Jedi. The dataset that was complete in 2014 when Paul built it, and hasn't changed since.
53
53
54
-
Meanwhile, the Star Wars universe exploded. The Mandalorian. Andor. The Book of Boba Fett. Obi-Wan Kenobi. Ahsoka. Bad Batch. Two more films announced. The franchise that was six films when SWAPI launched is now fifteen live-action shows and counting — not to mention Visions, Tales of the Jedi, and everything else.
54
+
Meanwhile, the Star Wars universe exploded. The Mandalorian. Andor. The Book of Boba Fett. Obi-Wan Kenobi. Ahsoka. Bad Batch. Two more films announced. The franchise that was six films when SWAPI launched is now fifteen live-action shows and counting, not to mention Visions, Tales of the Jedi, and everything else.
55
55
56
-
From a CAP modeling standpoint, I was also leaving the most interesting part of the problem unsolved. The original sample had no concept of a *Show* or an *Episode* — no composition relationships, no parent-child cascades, no aggregation views. Just films and their related entities, flat.
56
+
From a CAP modeling standpoint, I was also leaving the most interesting part of the problem unsolved. The original sample had no concept of a *Show* or an *Episode*, no composition relationships, no parent-child cascades, no aggregation views. Just films and their related entities, many-to-many but flat.
57
57
58
58
I wanted Shows. I wanted Episodes. I wanted the real data to go with them.
59
59
60
-
Which meant I needed to go to Wookieepedia.
60
+
Which meant I needed to go to the source: Wookieepedia.
61
61
62
62
---
63
63
64
64
## Scraping Wookieepedia (Or: How I Spent My Weekend)
65
65
66
-
[Wookieepedia](https://starwars.fandom.com/wiki/Wookieepedia) is the Star Wars wiki — a remarkable volunteer effort that documents essentially every episode, character, and planet across the entire franchise.
66
+
[Wookieepedia](https://starwars.fandom.com/wiki/Wookieepedia) is the Star Wars wiki. It's a remarkable volunteer effort that documents essentially every episode, character, and planet across the entire franchise.
67
67
68
68
It also exposes the [MediaWiki API](https://www.mediawiki.org/wiki/API:Main_page), which made it possible to build a scraper.
69
69
70
-
The scraper — `cap/scraper/` — works in two passes:
70
+
The scraper, `cap/scraper/`, works in two passes:
71
71
72
72
1.**Discovery**: Fetch the list of all Star Wars films and live-action shows, with their episode lists.
73
-
2.**Enrichment**: For each episode, fetch detailed metadata — director, writer(s), air date, season and episode number, opening crawl (where available), and the full cast of characters, planets, starships, vehicles, and species that appear.
73
+
2.**Enrichment**: For each episode, fetch detailed metadata, such as director, writer(s), air date, season and episode number, opening crawl (where available), and the full cast of characters, planets, starships, vehicles, and species that appear.
74
74
75
75
The challenges were real:
76
76
77
-
-**Rate limiting**: Wookieepedia is a volunteer project. The scraper uses conservative rate limits and backs off on 429s. Be respectful.
78
-
-**Inconsistent data**: "Ahsoka Tano" and "Ahsoka" and "Ahsoka Tano (Fulcrum)" are the same person. The normalization logic to reconcile entity names across 772 episodes is... something.
79
-
-**Caching**: Once you have the data, you don't want to re-fetch it. The scraper writes a disk cache that's committed to the repo. `npm run scrape` uses the cache by default. `npm run scrape:bypass-cache` hits the live API and prompts you to confirm before making network calls.
77
+
-**Rate limiting**: Wookieepedia is a volunteer project. The scraper uses conservative rate limits and backs off on 429s. We needed to be respectful.
78
+
-**Inconsistent data**: "Ahsoka Tano" and "Ahsoka" and "Ahsoka Tano (Fulcrum)" are the same person. The normalization logic to reconcile entity names across 772 episodes is... a lot.
79
+
-**Caching**: Once you have the data, you don't want to re-fetch it. The scraper writes a disk cache that's committed to the repo. `npm run scrape` uses the cache by default. `npm run scrape:bypass-cache` hits the live API and prompts you to confirm before making network calls. This way, you can update the dataset if you want, but it's not going to happen by accident and if you just want to use the sample right after a pull, you don't have to wait for the scraper to run.
80
80
81
-
The result: **11 films, 15 shows, 772 episodes**. Every episode linked to its characters, planets, vehicles, starships, and species. Everything cross-referenced. The SWAPI dataset is still in there — it's just no longer the whole story.
81
+
The result: **11 films, 15 shows, 772 episodes**. Every episode linked to its characters, planets, vehicles, starships, and species. Everything cross-referenced. The SWAPI dataset is still in there, but it's no longer the whole story.
82
82
83
83
---
84
84
@@ -88,9 +88,9 @@ The new data model is where v2.0 really earns its version number.
88
88
89
89
### Shows and Episodes
90
90
91
-
The `Show` entity represents a Star Wars series or film anthology —*The Mandalorian*, *Andor*, *The Clone Wars*. Each show has basic metadata: title, release year, total seasons.
91
+
The `Show` entity represents a Star Wars series or film anthology, like*The Mandalorian*, *Andor*, or*The Clone Wars*. Each show has basic metadata: title, release year, total seasons.
92
92
93
-
`Episode` is a **composition child of `Show`**— meaning episodes belong to their show and cascade-delete with it. Each episode carries its own metadata: `director`, `writer`, `season_number`, `episode_number`, `air_date`, and `opening_crawl` (for the films that have one).
93
+
`Episode` is a **composition child of `Show`**which means episodes belong to their show and cascade-delete with it. Each episode carries its own metadata: `director`, `writer`, `season_number`, `episode_number`, `air_date`, and `opening_crawl` (for the films that have one).
94
94
95
95
```cds
96
96
entity Show : managed {
@@ -118,7 +118,7 @@ entity Episode : managed {
118
118
119
119
### Episode Junction Tables
120
120
121
-
Five `Episode2*` junction entities link episodes to the core character set — `Episode2People`, `Episode2Planets`, `Episode2Starships`, `Episode2Vehicles`, `Episode2Species`. Because they're compositions of `Episode`, they cascade correctly. They also let you ask the interesting questions: which characters appear across both *Rebels* and *Andor*? Which planets show up in both the Clone Wars and the live-action shows?
121
+
Five `Episode2*` junction entities link episodes to the core character set: `Episode2People`, `Episode2Planets`, `Episode2Starships`, `Episode2Vehicles`, `Episode2Species`. Because they're compositions of `Episode`, they cascade correctly. They also let you ask the interesting questions like which characters appear across both *Rebels* and *Andor*? Which planets show up in both the Clone Wars and the live-action shows?
122
122
123
123
### Show2* Aggregation Views
124
124
@@ -137,29 +137,35 @@ No physical tables. The view derives from episode data automatically. Want to kn
137
137
138
138
A new `StarWarsEpisode` read-only service exposes all of this:
139
139
140
-
```
140
+
```bash
141
141
GET /odata/v4/StarWarsEpisode/Shows
142
142
GET /odata/v4/StarWarsEpisode/Episodes
143
143
GET /odata/v4/StarWarsEpisode/Episode2People
144
144
```
145
145
146
-
And the Media Browser Fiori app gives you a UI to explore it — filter by show, drill into episodes, see the full cast.
146
+
And the Media Browser Fiori app gives you a UI to explore it. You can filter by show, drill into episodes, or see the full cast.
147
147
148
148
---
149
149
150
150
## The Docs Site That Finally Does It Justice
151
151
152
-
One of my ongoing frustrations with this project was that the interesting architectural decisions were buried in a README that nobody reads.
152
+
One of my ongoing frustrations with this project was that the interesting architectural decisions were buried in a README that was difficult to navigate and easy to miss. The data model is the real star of the show, but it was hidden in a wall of text.
153
153
154
-
v2.0 ships a proper documentation site built with [VitePress](https://vitepress.dev/). You're reading it right now.
154
+
v2.0 ships a [proper documentation site](https://sap-samples.github.io/cloud-cap-hana-swapi/) built with [VitePress](https://vitepress.dev/).
155
+
156
+

155
157
156
158
A few things worth calling out:
157
159
158
160
**The themes.** The site ships with two CSS themes: *Imperial Dark* (a high-contrast dark theme that probably looks familiar if you've ever seen the inside of a Star Destroyer) and *Jedi Archives* (warm, parchment-toned light mode). Toggle between them with the theme switcher in the nav.
159
161
160
162
**The opening crawl.** The homepage has an animated Star Wars opening crawl. It's not subtle and I have no regrets.
161
163
162
-
**The CDS Cheat Sheet.** This one I'm genuinely proud of. If you work with SAP CAP, bookmark [the cheat sheet](https://sap-samples.github.io/cloud-cap-hana-swapi/reference/cheat-sheet.html). It covers:
164
+
**The CDS Cheat Sheet.** This one I'm genuinely proud of. If you work with SAP CAP, bookmark [the cheat sheet](https://sap-samples.github.io/cloud-cap-hana-swapi/reference/cheat-sheet.html).
165
+
166
+

167
+
168
+
It covers:
163
169
164
170
- Entity definition patterns with `managed`, `cuid`, `temporal`
165
171
- Many-to-many with explicit junction entities (the right way)
@@ -171,40 +177,33 @@ A few things worth calling out:
171
177
- Virtual fields and computed properties
172
178
- Multi-profile configuration
173
179
174
-
It's the reference I wish I'd had when I started learning CAP.
175
-
176
180
**Architecture deep-dives.** The Shows & Episodes section walks through the full composition hierarchy, the view aggregation pattern, and why the data model is designed the way it is.
177
181
178
-
**Five hands-on labs.** From "model your first entity" to "write authorization tests" — step-by-step exercises with the Star Wars dataset as the playground.
179
-
180
-

181
-
182
-

183
-
184
182

185
183
184
+
**Five hands-on labs.** From "model your first entity" to "write authorization tests": step-by-step exercises with the Star Wars dataset as the playground.
185
+
186
186
---
187
187
188
188
## A Fresh Look at the Data
189
189
190
-
The original data viewer in this project was... functional.
190
+
The original data viewer in this project was... functional. I had borrow it from another of the SAP CAP Samples. It got the job done, but it wasn't going to win any design awards.
191
191
192
-
The v2.0 viewer app is something you'd actually want to use.
192
+
The v2.0 viewer app is something you'll hopefully actually want to use.
193
193
194
-
It ships with two themes (*Galaxy* — deep space dark mode, and *Light* — for when you're working in a bright room and don't want to feel like you're reading a terminal). Pagination that actually works, including graceful handling when `@odata.count` comes back as 0. Sortable columns. A filter bar. Keyboard navigation.
194
+
It ships with two themes (*Galaxy* — deep space dark mode, and *Light*, keeping with the Star Wars aesthetic). Pagination that actually works, including graceful handling when `@odata.count` comes back as 0. Sortable columns. A filter bar. Keyboard navigation.
195
+

195
196
196
-
The feature I use most: the **detail panel**. Click any row and a panel slides in from the right showing the full entity details — without navigating away from the list. It's the difference between "I can look up data" and "I enjoy looking up data."
197
+
The feature I use most: the **detail panel**. Click any row and a panel slides in from the right showing the full entity details without navigating away from the list. It's the difference between "I can look up data" and "I enjoy looking up data."
197
198
198
199

199
200
200
201

201
202
202
-
And the Fiori launchpad ties everything together — one page with tiles for People, Films, and Shows, each launching the appropriate Fiori Elements app:
203
+
And the Fiori launchpad ties everything together with one page with tiles for People, Films, and Shows, each launching the appropriate Fiori Elements app:
203
204
204
205

205
206
206
-

207
-
208
207
---
209
208
210
209
## Try It
@@ -230,6 +229,6 @@ If you find issues, [open an issue on GitHub](https://github.com/SAP-samples/clo
230
229
231
230
---
232
231
233
-
*If you want to understand the data model, start with the [CDS Cheat Sheet](https://sap-samples.github.io/cloud-cap-hana-swapi/reference/cheat-sheet.html) — it'll save you hours.*
232
+
*If you want to understand the data model, start with the [CDS Cheat Sheet](https://sap-samples.github.io/cloud-cap-hana-swapi/reference/cheat-sheet.html). It'll save you hours.*
234
233
235
234
*If you want to understand why this project exists, rewatch Empire Strikes Back. You'll figure it out.*
0 commit comments