Skip to content

add typescript classes created with script for review#13

Open
tgra wants to merge 3 commits intomainfrom
feature/add-auto-objects
Open

add typescript classes created with script for review#13
tgra wants to merge 3 commits intomainfrom
feature/add-auto-objects

Conversation

@tgra
Copy link
Member

@tgra tgra commented Mar 20, 2026

Branch created with Typescript classes created from SHACL shapes in https://github.com/solid/shapes using https://github.com/theodi/shacl-shape-converter-typescript

this.overwrite("http://rdfs.org/sioc/ns#content", value, TermMapping.stringToLiteral);
}
get relatedChatChannel(): Set<string> {
return this.objects("n3-52", ValueMapping.literalToString, TermMapping.stringToLiteral);
Copy link
Contributor

Choose a reason for hiding this comment

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

The string used as predicate looks like a blank node label. I'm sure this is unintentional. It would not work.

It probably highlights some fundamental parser/generator problem in the converter.

Copy link
Member Author

Choose a reason for hiding this comment

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

unresolved - the SHACL shape property from SolidOS uses [ sh:path [ sh:inversePath flow:message ]

[ sh:path [ sh:inversePath flow:message ] ;
          sh:minCount 1 ; 
          rdfs:label "Related Chat" ;
          rdfs:comment "The chat channel or conversation to which this message belongs." ;
          sh:codeIdentifier "relatedChatChannel";
        ] 

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for all your feedback @langsamu :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

the SHACL shape property from SolidOS uses [ sh:path [ sh:inversePath flow:message ]

I highly recommend that we don't try to support this pattern in the converter.

I can imagine some interpretations that would make sense in the context of generating classes/properties from these shapes.
But I still think that restricting these shapes to using only 'simple' sh:paths with IRI objects is the correct current approach.

@tgra
Copy link
Member Author

tgra commented Mar 20, 2026

https://github.com/solid/object/blob/main/src/solid/Container.ts

import { TermWrapper } from "rdfjs-wrapper"
import { Resource } from "./Resource.js"
import { LDP } from "../vocabulary/mod.js"

export class Container extends Resource {
    public get contains(): Set<Resource> {
        return this.objects(LDP.contains, TermWrapper.as(Resource), TermWrapper.as(Resource))
    }
}

compare with
https://github.com/solid/object/blob/feature/add-auto-objects/src/solid/Container.ts

import { Resource } from './Resource.js';
import { TermWrapper, ObjectMapping } from "rdfjs-wrapper";

export class Container extends TermWrapper {

  get contains(): Set<Resource> {
    return this.objects("http://www.w3.org/ns/ldp#contains", ObjectMapping.as(Resource), ObjectMapping.as(Resource));
  }
}

@tgra
Copy link
Member Author

tgra commented Mar 25, 2026

Hi @langsamu @matthieubosquet - there is a of blocker for the solid/shapes and shapes transform work, that @jeswr would like to have resolved today.

Wonder if you're able to take a look and advise on this please:

With the current version of Container.ts, why is Container extending Resource rather than TermWrapper?

https://github.com/solid/object/blob/main/src/solid/Container.ts

import { TermWrapper } from "rdfjs-wrapper"
import { Resource } from "./Resource.js"
import { LDP } from "../vocabulary/mod.js"

export class Container extends Resource {
    public get contains(): Set<Resource> {
        return this.objects(LDP.contains, TermWrapper.as(Resource), TermWrapper.as(Resource))
    }
}

@langsamu
Copy link
Contributor

langsamu commented Mar 25, 2026

RE #13 (comment)

With the current version of Container.ts, why is Container extending Resource rather than TermWrapper?

Because a Container is a Resource (see LDP via Solid) and because inheritance is a fundamental tenet of object-oriented programming. As such it is a crucial feature of RDF/JS Wrapper library.

In my opinion, the SHACL translator should support this feature.

However there is nothing in my mind that requires modelling any particular mapping class as extending any other.

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