Skip to content

add typescript classes created with script for review#13

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

add typescript classes created with script for review#13
tgra wants to merge 2 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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any justification for generating mapping classes that lack properties.

When a shape would result in such then we should probably throw.

Copy link
Member Author

Choose a reason for hiding this comment

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

added check with latest commit ce4907d - doesn't throw error but doesn't create class

@@ -0,0 +1,15 @@
import { AcpAccessControl } from './AcpAccessControl';
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't we need .js at the end of these imports?

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.

Please remove redundant EOL comments.

@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));
  }
}

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