Skip to content

edit bookmark shape add annotea bookmark and bookmark topic shapes#57

Merged
tgra merged 2 commits intomainfrom
tgra/edit-bookmark-shape
Apr 22, 2026
Merged

edit bookmark shape add annotea bookmark and bookmark topic shapes#57
tgra merged 2 commits intomainfrom
tgra/edit-bookmark-shape

Conversation

@tgra
Copy link
Copy Markdown
Member

@tgra tgra commented Apr 22, 2026

Type of Change


* [ x] Update existing domain file

If updating:

* [x ] New shape
* [x] Additional constraints 
* [x] New version of existing shape

I have created a Solid bookmark app and would like to use the new bookmark shapes (based on Annotea Bookmark schema, as the existing Bookmark shape is) transformed to TypeScript rdfjs-wrapper classes, to demonstrate use of shapes repo, shacl-converter and @solid-data/models.


Domain

bookmarks

Shape Details

Updated existing BookmarkShape with reference to source

:BookmarkType
  a ui:NamedNodeURIField ;
  ui:property rdf:type ;
  ui:default "http://www.w3.org/2002/01/bookmark#Bookmark" .

:SearchTopic
  a ui:SingleLineTextField ;
  ui:property bk:hasTopic ;
  ui:default "Search Engine" .

:BookmarkLabel
  a ui:SingleLineTextField ;
  ui:property rdfs:label ;
  ui:label "Label"@en .

:BookmarkUrl
  a ui:NamedNodeURIField ;
  ui:property bk:recalls ;
  ui:label "URL"@en .

:BookmarkTopic
  a ui:SingleLineTextField ;
  ui:property bk:hasTopic ;
  ui:label "Topic"@en .

:BookmarkDescription
  a ui:MultiLineTextField ;
  ui:property rdfs:comment ;
  ui:label "Description"@en .
  • form with single field input - added constraint maxCount 1
  • added rdfs:label

Example transform to TypeScript

Bookmark.ts

import { TermWrapper, LiteralAs, LiteralFrom, OptionalFrom, OptionalAs, RequiredFrom, RequiredAs } from "@rdfjs/wrapper";

export class Bookmark extends TermWrapper {

  get label(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/2000/01/rdf-schema#label", LiteralAs.string);
  }
  set label(value: string | undefined) {
    OptionalAs.object(this, "http://www.w3.org/2000/01/rdf-schema#label", value, LiteralFrom.string);
  }

  get url(): string {
    return RequiredFrom.subjectPredicate(this, "http://www.w3.org/2002/01/bookmark#recalls", LiteralAs.string);
  }
  set url(value: string) {
    RequiredAs.object(this, "http://www.w3.org/2002/01/bookmark#recalls", value, LiteralFrom.string);
  }

  get topic(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/2002/01/bookmark#hasTopic", LiteralAs.string);
  }
  set topic(value: string | undefined) {
    OptionalAs.object(this, "http://www.w3.org/2002/01/bookmark#hasTopic", value, LiteralFrom.string);
  }

  get description(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/2000/01/rdf-schema#comment", LiteralAs.string);
  }
  set description(value: string | undefined) {
    OptionalAs.object(this, "http://www.w3.org/2000/01/rdf-schema#comment", value, LiteralFrom.string);
  }
}

BookmarkAnnotea

import { BookmarkTopic } from './BookmarkTopic.js';
import { TermWrapper, LiteralAs, LiteralFrom, TermAs, TermFrom, SetFrom, OptionalFrom, OptionalAs, RequiredFrom, RequiredAs } from "@rdfjs/wrapper";

export class BookmarkAnnotea extends TermWrapper {

  get type(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", LiteralAs.string);
  }
  set type(value: string | undefined) {
    OptionalAs.object(this, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", value, LiteralFrom.string);
  }

  get title(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/title", LiteralAs.string);
  }
  set title(value: string | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/title", value, LiteralFrom.string);
  }

  get recalls(): string {
    return RequiredFrom.subjectPredicate(this, "http://www.w3.org/2002/01/bookmark#recalls", LiteralAs.string);
  }
  set recalls(value: string) {
    RequiredAs.object(this, "http://www.w3.org/2002/01/bookmark#recalls", value, LiteralFrom.string);
  }

  get hasTopic(): Set<BookmarkTopic> {
    return SetFrom.subjectPredicate(this, "http://www.w3.org/2002/01/bookmark#hasTopic", TermAs.instance(BookmarkTopic), TermFrom.instance);
  }

  get description(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/description", LiteralAs.string);
  }
  set description(value: string | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/description", value, LiteralFrom.string);
  }

  get creator(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/creator", LiteralAs.string);
  }
  set creator(value: string | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/creator", value, LiteralFrom.string);
  }

  get created(): Date | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/2000/10/annotation-ns#created", LiteralAs.date);
  }
  set created(value: Date | undefined) {
    OptionalAs.object(this, "http://www.w3.org/2000/10/annotation-ns#created", value, LiteralFrom.date);
  }

  get lastModified(): Date | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/date", LiteralAs.date);
  }
  set lastModified(value: Date | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/date", value, LiteralFrom.date);
  }
}

Bookmark Topic

import { TermWrapper, LiteralAs, LiteralFrom, SetFrom, OptionalFrom, OptionalAs, RequiredFrom, RequiredAs } from "@rdfjs/wrapper";

export class BookmarkTopic extends TermWrapper {

  get type(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", LiteralAs.string);
  }
  set type(value: string | undefined) {
    OptionalAs.object(this, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type", value, LiteralFrom.string);
  }

  get title(): string {
    return RequiredFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/title", LiteralAs.string);
  }
  set title(value: string) {
    RequiredAs.object(this, "http://purl.org/dc/elements/1.1/title", value, LiteralFrom.string);
  }

  get subTopicOf(): Set<string> {
    return SetFrom.subjectPredicate(this, "http://www.w3.org/2002/01/bookmark#SubTopicOf", LiteralAs.string, LiteralFrom.string);
  }

  get description(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/description", LiteralAs.string);
  }
  set description(value: string | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/description", value, LiteralFrom.string);
  }

  get creator(): string | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/creator", LiteralAs.string);
  }
  set creator(value: string | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/creator", value, LiteralFrom.string);
  }

  get created(): Date | undefined {
    return OptionalFrom.subjectPredicate(this, "http://www.w3.org/2000/10/annotation-ns#created", LiteralAs.date);
  }
  set created(value: Date | undefined) {
    OptionalAs.object(this, "http://www.w3.org/2000/10/annotation-ns#created", value, LiteralFrom.date);
  }

  get lastModified(): Date | undefined {
    return OptionalFrom.subjectPredicate(this, "http://purl.org/dc/elements/1.1/date", LiteralAs.date);
  }
  set lastModified(value: Date | undefined) {
    OptionalAs.object(this, "http://purl.org/dc/elements/1.1/date", value, LiteralFrom.date);
  }
}


Validation

* [x] SHACL validation run

@tgra tgra requested review from jeff-zucker, jeswr and langsamu April 22, 2026 09:18
Copy link
Copy Markdown

@langsamu langsamu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one file changed yet CI does not validate anything.

@tgra tgra merged commit 3ae90e2 into main Apr 22, 2026
2 checks passed
@tgra tgra deleted the tgra/edit-bookmark-shape branch April 22, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants