Skip to content
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

Is it possible to have one instance and validate for multiple classes? #18

Open
danielbeeke opened this issue Mar 10, 2024 · 3 comments

Comments

@danielbeeke
Copy link

Is it possible to have one instance and validate for multiple classes?

@bergos
Copy link
Member

bergos commented Mar 12, 2024

You can pass a list of shapes to the .validate() method.

If you use grapoi, you can directly pass the pointer:

await validator.validate({ dataset }, ptr)

Otherwise, the structure must contain a terms property:

await validator.validate({ dataset }, [{ terms: [rdf.namedNode('...')] }])

@danielbeeke
Copy link
Author

Okay, that works. It fails when there is no shape loaded for a class.

file:///home/daniel/Development/centergraph/node_modules/shacl-engine/Validator.js:69
        targets = shape.resolveTargets(shapeContext)
                        ^

TypeError: Cannot read properties of null (reading 'resolveTargets')
    at Validator.validate (file:///home/daniel/Development/centergraph/node_modules/shacl-engine/Validator.js:69:25)

If you agree that that should be fixed, I can do a PR.

@bergos
Copy link
Member

bergos commented Mar 19, 2024

I will have a closer look. I'm not sure yet if it should be ignored when the shapes are explicitly given and don't exist.

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

No branches or pull requests

2 participants