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

Vocabulary extensions #182

Closed
wants to merge 3 commits into from
Closed

Vocabulary extensions #182

wants to merge 3 commits into from

Conversation

alien-mcl
Copy link
Member

@alien-mcl alien-mcl commented Jan 30, 2019

Extended vocabulary with these features:

In general, these imperfect attempt to extend the Hydra Core Vocabulary (HCV) should enable the it for some of the uses cases that appeared on various occasions. Feel free to deliberate more, but I hope these will find their way to the final specification.

I tried to keep backward compatibility so current implementations using the vocabulary in it's current state won't get broken. Unfortunately, there are some minor changes to some of the elements.

I've also added an updated version of the vocabulary.png diagram (including source code).

I'll try to provide a proper PR for Heracles.ts reference client covering these features ASAP.

- enable operations for non-RDF resources
- enable operations for headers
- enable operations with explicit operation target (API documentation)
- enable strongly typed collections (API documentation)
- enable client-side initiated pagination
"vs:term_status": "testing"
},
{
"@id": "hydra:name",
Copy link

Choose a reason for hiding this comment

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

hydra:name sounds very generic, as if you could name anything. Only the comment states, it is used to name a header. I would prefer hydra:headerName

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Here you go!

@alien-mcl
Copy link
Member Author

I've just pushed PR to Heracles.ts with support for these features.

Copy link
Contributor

@tpluscode tpluscode left a comment

Choose a reason for hiding this comment

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

I strongly disapprove of this pull request!

Please check my comments to individual pieces but there are bigger problems:

  1. looks like there are several unrelated changes
  2. none of the proposed changes have a related (or mentioned) PR and have not gone through some analysis beforehand
  3. it literally came out of the blue

Instead of haphazardly submitting PRs we must follow a more structured workflow and follow some ground rules as closely as possible (I accept that there will be exceptions):

  1. each PR should address a specific issue or at least related issues
  2. each issue should be first discussed, deemed important and have a rough idea of the solution
  3. PR with new features should not only introduce vocabulary elements but also extend upon the human-readable part of the spec.

I could go one step further and suggest that the prose should even come slightly before vocabulary. That way it could be easier to understand the intent and gauge the effect of said changes. On the other hand a discussion under the related issue would serve that purpose too.

@@ -59,6 +59,19 @@
"mapping": "hydra:mapping",
"IriTemplateMapping": "hydra:IriTemplateMapping",
"variable": "hydra:variable",
"skip": { "@id": "hydra:skip", "@type": "xsd:integer" },
"take": { "@id": "hydra:take", "@type": "xsd:integer" },
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 that skip/take are too specific go beyond Hydra Core. Sound more like Data than generic API description language.

I agree it's a desired feature but maybe this could became part of an extension focused on handling collections in different way?

Copy link
Member Author

Choose a reason for hiding this comment

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

If it is a desired feature, it should be provided in the core. I'm opened for alternative approaches though. These are just terms that are commonly used in other querying languages like SQL (TOP, LIMIT), LINQ (Skip, Take), etc.

"@id": "hydra:target",
"@type": "rdf:Property",
"label": "invocation target",
"comment": "Explicit target of the invocation of the operation.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to #154?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, as it is stated in the PR's description at the very beginning

"domain": "hydra:Operation",
"range": "xsd:string",
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

How about possibleResponseHeader? That ways it's aligned with possibleStatus and HTTP terminology

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 actually tried to be consistent with returns/expects. Indeed, for returned header possible may work. For expected it won't

"domain": "hydra:Operation",
"rangeIncludes": ["hydra:Header", "hydra:HeaderTemplate"],
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto, I propose to rename to requestHeader for example

Copy link
Member Author

Choose a reason for hiding this comment

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

While I believe both returned and expected headers should be connected to each other conceptually, this name is OK for me. For returned it should be then responseHeader

"label": "Template",
"comment": "Some abstract template.",
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

This is way too vague. Why do you think we need an "abstract template"? Sound very much like OOP

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 was for backward compatibility - I didn't want to introduce another term for template in headers, thus I had to revamp the domain of the existing one. I also didn't want to replace domain with other predicate, thus this is why the abstract

"label": "Header template",
"comment": "Specification of the header template with variables to be replaced with actual values.",
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the practical need for this Header template?

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 was just wondering i.e. about an Authorization header where you mark the authorization scheme and the secret following it. Maybe other vendor-specific headers would require this.
In general, this is indeed a feature covering exotic scenarios.

"@id": "hydra:Header",
"@type": "rdfs:DataType",
"label": "Header",
"comment": "Specification of the header, including name and value(s).",
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder, what is the current stand on Hydra vs HTTP?

I mean, adding headers to the core signifies a close relation with the protocol. Did we ever decide to keep Hydra somewhat agnostic in that regard?

@RubenVerborgh @lanthaler

Copy link
Member Author

Choose a reason for hiding this comment

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

There are possibleStatus and method - these are already quite strictly bound to the protocol. Also headers are not HTTP specific - other protocols may have similar notion. SOAP is a bad example here (as it can be over HTTP), but the envelope has a notion of the header as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

Point taken

"label": "Collection specification",
"comment": "Describes a collection returned by the operation.",
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does that come from? How would this come up against the "manages block"? Sounds similar

Copy link
Member Author

Choose a reason for hiding this comment

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

Ther was an issue on denoting on the API what the collection describes. This was an attempt of enabling that part of the spec with such a description.

"label": "Media type",
"comment": "An RFC 6838 compliant media type specification.",
"vs:term_status": "testing"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

The media type stuff is cool in principle but how does it relate to the other changes within this PR?

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 wanted to enable hydra to expect/return resources other than RDF. One of the approach of describing a resource would be to use the media type, i.e. for JPG or DOCX file that would be expected by the API

@alien-mcl
Copy link
Member Author

alien-mcl commented Feb 9, 2019

I strongly disapprove of this pull request!

Ok. Indeed this is an imperfect attempt.

looks like there are several unrelated changes

Indeed - there are several topics onboard

none of the proposed changes have a related (or mentioned) PR and
have not gone through some analysis beforehand

I partially disagree - operations with explicit targets were discussed quite extensively; other thing it didn't end up with any specific conclusion

it literally came out of the blue

I disagree - most of topics touched here were either discussed or at least mentioned; I also did advertised this attempt in various occasions

Instead of haphazardly submitting PRs we must follow a more structured
workflow and follow some ground rules as closely as possible

What kind of structured workflow? I agree that we didn't provide any detailed roadmap for future work, but GH is full of unresolved issues that needs to be addressed and should be treated as that roadmap. I remember how we did work in last several years and look were we are now.
I'd like to take a more agile approach with fail-fast attempts. I prefer to provide imperfect but working prototype (look at this PR at Heracles.ts) than to plot and plan and have endless discussions of greatness of Ionian school over Milesian school.

each PR should address a specific issue or at least related issues

I can cherry-pick each implemented feature as a separate PR if that will work for you.

each issue should be first discussed, deemed important and have a rough idea of the solution

As I already said - some of the features were discussed - some of them indeed may need some discussion. This is why that PR came anyway - to start discussion on some real approaches. I don't want to raise new issues to address other issues - it's pointless.

PR with new features should not only introduce vocabulary elements
but also extend upon the human-readable part of the spec.

I may agree with this, but this would imply enormous effort on me still having a large risk of a complete failure. Once I confirm that these changes are going in the right direction, I may consider spec changes.

I could go one step further and suggest that the prose should even come slightly before vocabulary.
That way it could be easier to understand the intent and gauge the effect of said changes.
On the other hand a discussion under the related issue would serve that purpose too.

Also a discussion on some real implementation still serves that purpose. Cherry-picking each feature with some brief would improve how these changes should be understood.

@tpluscode
Copy link
Contributor

Without going into detailed discussions here I think this PR should be split into 3 PRs, which address the three linked issues it aims to resolve. The other two bullets should (non-RDF payloads and headers) should be first discussed as issues.

Splitting into smaller chunks will allow for focused discussions and prevent one change block an unrelated one from being merged.

On a technical note, it's best to avoid submitting PR from downstream master branch because such can cause conflicts once it's merged.

@alien-mcl
Copy link
Member Author

Yep - I've just noticed master branch. One more reason to split it. As for new features - I'll try to dig through GH to find related issues. I'm pretty sure headers were mentioned somewhere.

@alien-mcl
Copy link
Member Author

I've divided it into separate PRs (#183, #184, #185 and #186) - this PR is obsoleted by those.

@alien-mcl alien-mcl closed this Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants