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

SHACL: Use with hydra:expects #9

Open
tpluscode opened this issue Jun 17, 2021 · 3 comments
Open

SHACL: Use with hydra:expects #9

tpluscode opened this issue Jun 17, 2021 · 3 comments

Comments

@tpluscode
Copy link
Collaborator

Describe how sh:NodeShape can be used in place of (together with) hydra:Class to describe request payloads

@alien-mcl
Copy link
Member

I'd prefer "together with" - extensions should not replace hydra constructs which could lead to alternate reality available to clients understanding an extensions compared to those not understanding it.

@tpluscode
Copy link
Collaborator Author

Right. To elaborate, I see two possible scenarios, for the two possible kinds of shapes

Shape with implicit target

<Person> a hydra:Class, rdfs:Class, sh:NodeShape .

<CreatePersonOperation> a hydra:Operation ; hydra:expects <Person> .

This one is simple. The <Person> class simultaneously have sh:property and hydra:supportedProperty to provide descriptions for clients who understand the extension and those who do not.

sh:targetClass

<PersonShape> a sh:NodeShape ; sh:targetClass foaf:Person .
<AgentShape> a sh:NodeShape ; sh:targetClass foaf:Agent .

foaf:Person rdfs:subClassOf foaf:Agent .

<CreatePersonOperation> a hydra:Operation ; hydra:expects foaf:Person .

This one is a bit more problematic and potentially falls in the in place of bucket. The shape is super useful in describing API-specific graph structures for external classes. SHACL also supports subclassing by design. The server in this scenario would validate the model using constraints coming both from <PersonShape> as well as <AgentShape>.

There is an overlap with #10, where the client would have to be able to find these shapes so that they know how to construct a request. Of course the worst case scenario is that they would get all shapes and find the right ones in memory at the expense of fetching a larger collection.

The problem I have with trying to simultaneously provide description using both Core and SHACL in such scenarios is that you would end up with a bloated client and server code. I'd rather say in the spec that an API MAY provide the rudimentary Hydra Core descriptions but give them the option to require that clients understand only SHACL. This should be enough for semi-closed scenarios, such as internal APIs

@alien-mcl
Copy link
Member

give them the option to require that clients understand only SHACL

I think it is no more an extension. A replacement is a better name.

As for the examples - both looks fine to me. I feel a client would need to understand both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants