- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Thu, 10 Apr 2014 12:54:34 +0200
- To: "'Michael Petychakis'" <mpetyx@epu.ntua.gr>, <public-hydra@w3.org>
Hi Michael, On Wednesday, April 09, 2014 12:09 AM, Michael Petychakis wrote: > I am trying to create a python parser for Hydra and even though it is > straightforward enough with pyld or similar parsers for json-ld. My > main difficulty is to describe my already up and running APIs with the > Hydra vocabulary. The problem probably comes from the fact that Hydra currently assumes that all messages are JSON-LD (or any other RDF serialization format), right? > For that reason, I took the liberty for starting to > gathering some of the examples in the http://www.markus- > lanthaler.com/hydra/spec/latest/core/. Going a step further, (and also > working a bit with RAML) I tried to create an example from the twitter > documentation as they did here http://api- > portal.anypoint.mulesoft.com/twitter/api/twitter-rest-api/twitter- > rest-api.raml . > > This is probably full of errors and misconceptions, but I think I miss > some stuff from Hydra. Example responses, Authentication, > Authorisation, and some other stuff. My effort can be found here, Yeah, you are completely right. All that is still missing. And will be future work items as soon as we are done with the core vocabulary. If someone takes the time to write up a proposal, we can of course also start to work on these things in parallel as they are quite orthogonal. > https://github.com/deepgraphs/python- > hydra/blob/master/samples/twitter/mentions_timeline.json . > > Feel free to comment and please let me know if I missed something > regarding Hydra, because I truly think it will be the major next step > after json-ld. Thanks for the nice words :-) I had a look at that description. There are a couple of issues. First of all, you describe a class whose name (URL) is a URL template: "@id": "/statuses /mentions_timeline{mediaTypeExtension}", "@type": "Class", The @id property should probably be set to something like twitter:MentionsTimeline where twitter is the vocabulary you define to describe Twitter's datamodel. The other thing is that your properties are kind of ill-named as well. You use relative URLs "property": "mediaTypeExtension", "description": "Use .json to specify application/json media type.", Expands to https://github.com/deepgraphs/python-hydra/blob/master/samples/twitter/media TypeExtension. That's probably not what you want. Again, it be something like twitter:mediaTypeExtension instead. And finally, you type your operation as "CreateResourceOperation" when it "Returns the 20 most recent mentions" and set both "expects" and "returns" to "Success!". Just change the type to just "Operation" (there doesn't exist a RetrieveResourceOperation because it's not necessary). Then remove "expects", the GET doesn't have a payload and set "returns" to "twitter:MentionsTimeline". The operation returns an instance of the MentionsTimeline class. That's what's being described here. Hope this clarifies Hydra a bit. Please keep us posted on your progress with the Python library you are implementing. Thanks, Markus -- Markus Lanthaler @markuslanthaler
Received on Thursday, 10 April 2014 10:55:17 UTC