Skip to content

Commit 787c176

Browse files
committed
feat: support browsing through JSON-LD documents
Fixed in latest rdflib, here included as a pre-release version together with a test, that proves it is working.
1 parent f246806 commit 787c176

File tree

5 files changed

+91
-408
lines changed

5 files changed

+91
-408
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"@context": {
3+
"schema": "http://schema.org/"
4+
},
5+
"@graph": [
6+
{
7+
"@id": "#it",
8+
"@type": "schema:Thing",
9+
"schema:name": "Something",
10+
"schema:image": {
11+
"@id": "thing.png"
12+
},
13+
"schema:description": "A very generic item",
14+
"schema:parentItem": {
15+
"@id": "#parent",
16+
"@type": "schema:Thing",
17+
"schema:name": "Related Thing",
18+
"schema:description": "This is somehow related to the other thing"
19+
}
20+
}
21+
]
22+
}

apps/tests/reading-jsonld.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { test } from "./fixtures";
2+
import { expect } from "@playwright/test";
3+
4+
test("shows data from a JSON-LD document", async ({ page, navigationBar }) => {
5+
// when opening PodOS Browser
6+
await page.goto("/");
7+
8+
// and navigating to a generic resource
9+
await navigationBar.fillAndSubmit(
10+
"http://localhost:4000/alice/public/generic/resource.jsonld#it",
11+
);
12+
13+
// then page shows a heading with the resource name
14+
const heading = page.getByRole("heading");
15+
await expect(heading).toHaveText("Something");
16+
17+
// and it shows the description of the resource
18+
const overview = page.getByRole("article", { name: "Something" });
19+
await expect(overview).toHaveText(/A very generic item/);
20+
21+
// and the type of the resource
22+
await expect(overview).toHaveText(/Thing/);
23+
24+
// and the image
25+
const image = overview.getByAltText("Something");
26+
await expect(image).toHaveAttribute("src", /blob:/);
27+
});

core/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to
77
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9+
## Unreleased
10+
11+
### Changed
12+
13+
- PodOS can now handle JSON-LD documents as regular RDF documents and work with their data
14+
915
## 0.18.0
1016

1117
### ⚠ BREAKING CHANGES

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"buffer": "^6.0.3",
5454
"lunr": "^2.3.9",
5555
"rdf-namespaces": "^1.16.0",
56-
"rdflib": "^2.2.37",
56+
"rdflib": "2.2.37-38360c03",
5757
"rxjs": "^7.8.2",
5858
"slugify": "^1.6.6",
5959
"url": "^0.11.4"

0 commit comments

Comments
 (0)