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

Enable hydra to expect and return non RDF resources #200

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions spec/latest/core/core.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"subClassOf": { "@id": "rdfs:subClassOf", "@type": "@vocab" },
"subPropertyOf": { "@id": "rdfs:subPropertyOf", "@type": "@vocab" },
"seeAlso": { "@id": "rdfs:seeAlso", "@type": "@id" },
"domainIncludes": { "@id": "schema:domainIncludes", "@type": "@id" }
"domainIncludes": { "@id": "schema:domainIncludes", "@type": "@id" },
"rangeIncludes": { "@id": "schema:rangeIncludes", "@type": "@id" }
},
"@id": "http://www.w3.org/ns/hydra/core",
"@type": "owl:Ontology",
Expand Down Expand Up @@ -253,7 +254,8 @@
"label": "expects",
"comment": "The information expected by the Web API.",
"domain": "hydra:Operation",
"range": "hydra:Class",
"range": "hydra:Resource",
"rangeIncludes": ["hydra:Resource", "hydra:Class"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's redundant to repeat hydra:Resource here. In fact, a Resource itself is not useful as an object of expects/returns. It has to be something more specific, like Class

Suggested change
"rangeIncludes": ["hydra:Resource", "hydra:Class"],
"rangeIncludes": ["hydra:Class"],

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't agree. I think it's useful to have both predicates to contain hydra:Resource. Previously used rdfs:range is more for compatibility, but I'd like to use schema:rangeIncludes in future implementations - it has weaker semantics.

I'd leave it as I suggested, at least untill some more specific alternatives are available.

Copy link
Member

@asbjornu asbjornu Sep 10, 2019

Choose a reason for hiding this comment

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

Isn't hydra:Resource what enables non-RDF payloads? I.e., won't hydra:Class restrict payloads to RDF?

Copy link
Member Author

Choose a reason for hiding this comment

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

@asbjornu, schema:rangeIncludes doesn't have that strong semantics as rdfs:range. Putting only hydra:Class inside schema:rangeIncludes doesn't infer no other types can be used - it's more of a hint (well the name has it - range includes, but not restricts). Still, I'd prefer to have both so clients doesn't have to concatenate both rdfs:range and schema:rangeIncludes to discover what's actually allowed.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Thanks for the explanation, @alien-mcl!

Copy link
Contributor

Choose a reason for hiding this comment

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

But Resource is range includes is actually not truthful. Most classes of Hydra are subclasses of hydra:Resource but they will not make sense as expects/returns. This hint is misleading.

"vs:term_status": "testing"
},
{
Expand All @@ -262,7 +264,8 @@
"label": "returns",
"comment": "The information returned by the Web API on success",
"domain": "hydra:Operation",
"range": "hydra:Class",
"range": "hydra:Resource",
"rangeIncludes": ["hydra:Resource", "hydra:Class"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

Suggested change
"rangeIncludes": ["hydra:Resource", "hydra:Class"],
"rangeIncludes": ["hydra:Class"],

"vs:term_status": "testing"
},
{
Expand Down
6 changes: 5 additions & 1 deletion spec/latest/core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,11 @@ <h3>Documenting a Web API</h3>
certain operations depend on the permissions of the current user. It
makes it, e.g., possible to show a "delete" link only if the current
user has the permission to delete the resource. Otherwise, the link
would simply be hidden in the representation.</p>
would simply be hidden in the representation.<br />
alien-mcl marked this conversation as resolved.
Show resolved Hide resolved
Example shown below describes the operation's expected and returned
alien-mcl marked this conversation as resolved.
Show resolved Hide resolved
value as a dereferencable resource (an RDF resource of a given class),
but the vocabulary is not limited to only those originating
from RDF and is enabled to other types of resources.</p>

<pre class="example nohighlight" data-transform="updateExample"
title="Documenting the supported operations of link properties">
Expand Down