schimatos / shacl-form-react

Core logic to generate a form based on *any* SHACL constraint
Other
7 stars 0 forks source link

Instructions not clear #468

Open vemonet opened 2 years ago

vemonet commented 2 years ago

Hi @jeswr, thanks for making this project available publicly!

I was trying to use your package to generate a web form from a SHACL shape, but I could not find how to call it and pass the SHACL shapes + data in the right format. Nor how to import the SHACLForm

The README says:

export function MyApp() {
  return <SHACLForm
      shacl={shacl}
      data={data}
    />
}

And that the component uses rdf-object

I found some uses in the mock files, but still unsure what should be in data and how to load a RDF string as an rdf-object: https://github.com/schimatos/shacl-form-react/blob/main/__tests__/mocks/mock-form.tsx

For the import, it seems like we need to import Form? https://github.com/schimatos/shacl-form-react/blob/main/lib/index.ts#L4

Do you have an example a bit more detailed? Which shows how to import SHACLForm and how to instantiate the shacl shape and data

jeswr commented 2 years ago

You're quite right - the docs are currently incorrect/incomplete, I made this release a while back when I needed to use it internally as a dep and haven't had the time to come back and properly clean it up - as this was done when I was in the middle of some exams/assessments.

The shacl should be an rdf-object-proxy, and the data should be an ldflex entity, there are also some other undocumented parameters.

You can see an example usage here https://github.com/schimatos/desktop-distribution/blob/main/src/App.tsx#L191-L200 (again, this file is very messy as it was thrown together in a limited amount of time).

I'm now getting around to tying up a few loose ends such as this with the project - as part of this I'm planning to release new (likely major/breaking) version of this package which is properly documented in the next couple of weeks, so it would be best to wait for that if your project is not time critical.

vemonet commented 2 years ago

Thanks for the pointer @jeswr , I am just taking a look at the current solutions for visualizing/editing/validating RDF snippets, so it's not urgent. I'll check for your future release to try it out

Just one question to better understand the scope of this component: if I understand well it is used by your Schimatos project, and it helps to generate forms like the one show in the latest screenshot here? https://github.com/schimatos/schimatos.org

shacl

jeswr commented 2 years ago

Pretty much! However this is actually a re-write of the form generation code from https://github.com/schimatos/schimatos.org (both to clean up the codebase and the UI).

Another of the loose ends I mentioned release a new version of https://github.com/schimatos/schimatos.org which does indeed use this directly as a dependency.

SebSeis commented 2 years ago

Can you provide some new information on how to use the tool? I am also not able to generate a web form from a SHACL shape.

jeswr commented 2 years ago

Just to provide an update since I have been silent on this repo for a while - I'm still interested in finishing this off; but unfortunately I was swamped by some higher priority tasks at the time, and am unlikely to get around to this until the end of May.

For more of a discussion see https://github.com/SolidLabResearch/Challenges/issues/19#issuecomment-1072348932