-
Notifications
You must be signed in to change notification settings - Fork 9
fix: add foaf:isPrimaryTopicOf to WebID profile #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,6 @@ const PIM = 'http://www.w3.org/ns/pim/space#'; | |
| */ | ||
| export function generateProfileJsonLd({ webId, name, podUri, issuer }) { | ||
| const pod = podUri.endsWith('/') ? podUri : podUri + '/'; | ||
| const profileDoc = webId.split('#')[0]; | ||
|
|
||
| return { | ||
| '@context': { | ||
|
|
@@ -39,12 +38,14 @@ export function generateProfileJsonLd({ webId, name, podUri, issuer }) { | |
| 'preferencesFile': { '@id': 'pim:preferencesFile', '@type': '@id' }, | ||
| 'publicTypeIndex': { '@id': 'solid:publicTypeIndex', '@type': '@id' }, | ||
| 'privateTypeIndex': { '@id': 'solid:privateTypeIndex', '@type': '@id' }, | ||
| 'isPrimaryTopicOf': { '@id': 'foaf:isPrimaryTopicOf', '@type': '@id' }, | ||
| 'mainEntityOfPage': { '@id': 'schema:mainEntityOfPage', '@type': '@id' } | ||
| }, | ||
| '@id': webId, | ||
| '@type': ['foaf:Person', 'schema:Person'], | ||
| 'foaf:name': name, | ||
| 'mainEntityOfPage': profileDoc, | ||
| 'isPrimaryTopicOf': '', | ||
| 'mainEntityOfPage': '', | ||
| 'inbox': `${pod}inbox/`, | ||
|
Comment on lines
46
to
49
|
||
| 'storage': pod, | ||
| 'oidcIssuer': issuer, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,11 +83,20 @@ describe('WebID Profile', () => { | |
| assert.ok(jsonLd['inbox'].endsWith('/webidtest/inbox/'), 'Should have inbox'); | ||
| }); | ||
|
|
||
| it('should have mainEntityOfPage', async () => { | ||
| it('should have mainEntityOfPage pointing to the document', async () => { | ||
| const res = await request(profilePath); | ||
| const jsonLd = await res.json(); | ||
|
|
||
| assert.ok(jsonLd['mainEntityOfPage'], 'Should have mainEntityOfPage'); | ||
| // Empty string is a relative URI reference to the document itself (JSON-LD) | ||
| assert.strictEqual(jsonLd['mainEntityOfPage'], '', 'mainEntityOfPage should be "" (self)'); | ||
| }); | ||
|
|
||
| it('should have isPrimaryTopicOf pointing to the document', async () => { | ||
| const res = await request(profilePath); | ||
| const jsonLd = await res.json(); | ||
|
|
||
| // Empty string is a relative URI reference to the document itself (JSON-LD) | ||
| assert.strictEqual(jsonLd['isPrimaryTopicOf'], '', 'isPrimaryTopicOf should be "" (self)'); | ||
| }); | ||
|
Comment on lines
+86
to
100
|
||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change adds
foaf:isPrimaryTopicOfon the#menode, but it still does not describe the profile document itself (e.g.,<> a foaf:PersonalProfileDocument; foaf:primaryTopic <#me>; foaf:maker <#me>). If this PR is intended to close #299 and support clients that discover a user by dereferencing the document URL and followingfoaf:primaryTopic, the profile generator likely needs to emit a document node (typically via@graph) in addition tofoaf:isPrimaryTopicOf.