- From: Dietrich Schulten <ds@escalon.de>
- Date: Wed, 31 Dec 2014 10:55:09 +0100
- To: "public-hydra@w3.org" <public-hydra@w3.org>
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, The upcoming release 0.2.0 of hydra-java[1] is in the Sonatype Snapshot Repo. If you want to play with it, add this to your Maven configuration: <repositories> <repository> <id>oss-sonatype</id> <name>oss-sonatype</name> <url>https://oss.sonatype.org/content/repositories/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <dependency> <groupId>de.escalon.hypermedia</groupId> <artifactId>hydra-spring</artifactId> <version>0.2.0-SNAPSHOT</version> </dependency> I could use some feedback for the current rendering of expected requests. The example below shows what it looks like in the current snapshot version. If nobody raises objections, I would release 0.2.0 during the next days. I'll also publish a sample service to the cloud, together with 0.2.0. The example describes how to post new events, how to post a review for an existing event and how to update or delete an existing event. To prescribe the review post with a nested property reviewRating.ratingValue, I used an interim solution based on existing vocabularies (from Issue-26 [2]) which is hopefully OK to get things going. Once #26 and #37 is solved, this interim solution would have to change. I mixed in schema.org's PropertyValueSpecification for value constraints. The code is prepared to render a choice of possible values, too, but we have no such facility yet. Note that the PUT and DELETE :operation property on the two Event members might seem duplicated, but it isn't. Rather, it allows to say that the current user is able to update/delete one event, but not the other. Implementers could also choose to link to single events from the members list and make the PUT and DELETE affordances available only on single events. So please take this lengthy response as example for what is possible. { "@context": { "@vocab": "http://schema.org/", "hydra": "http://www.w3.org/ns/hydra/core#" }, "@type": "hydra:Collection", "@id": "http://localhost:8180/webapp/hypermedia-api/events", "hydra:operation": [ { "hydra:method": "POST", "hydra:expects": { "@type": "hydra:Class", "hydra:subClassOf": "Event", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "eventStatus" }] } }], "hydra:member": [ { "@context": { "eventStatus": { "@type": "@vocab" }, "EVENT_SCHEDULED": "EventScheduled" }, "@type": "Event", "performer": "Walk off the Earth", "location": "Wiesbaden", "eventStatus": "EVENT_SCHEDULED", "workPerformed": { "@type": "CreativeWork", "name": "Gang of Rhythm Tour", "review": { "@id": "http://localhost:8180/webapp/hypermedia-api/reviews/events/1", "hydra:operation": [ { "@type": "ReviewAction", "hydra:method": "POST", "hydra:expects": { "@type": "hydra:Class", "hydra:subClassOf": "Review", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "reviewBody" }, { "hydra:property": "reviewRating", "http://schema.org/rangeIncludes": { "hydra:subClassOf": "Rating", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "ratingValue", "maxValue": 5, "minValue": 1, "stepValue": 1 }] } }] } }] } }, "@id": "http://localhost:8180/webapp/hypermedia-api/events/1", "hydra:operation": [ { "hydra:method": "PUT", "hydra:expects": { "@type": "hydra:Class", "hydra:subClassOf": "Event", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "eventStatus" }] } }, { "hydra:method": "DELETE" }] }, { "@context": { "eventStatus": { "@type": "@vocab" }, "EVENT_SCHEDULED": "EventScheduled" }, "@type": "Event", "performer": "Cornelia Bielefeldt", "location": "Heilbronn", "eventStatus": "EVENT_SCHEDULED", "workPerformed": { "@type": "CreativeWork", "name": "Mein letzter Film", "review": { "@id": "http://localhost:8180/webapp/hypermedia-api/reviews/events/2", "hydra:operation": [ { "@type": "ReviewAction", "hydra:method": "POST", "hydra:expects": { "@type": "hydra:Class", "hydra:subClassOf": "Review", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "reviewBody" }, { "hydra:property": "reviewRating", "http://schema.org/rangeIncludes": { "hydra:subClassOf": "Rating", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "ratingValue", "maxValue": 5, "minValue": 1, "stepValue": 1 }] } }] } }] } }, "@id": "http://localhost:8180/webapp/hypermedia-api/events/2", "hydra:operation": [ { "hydra:method": "PUT", "hydra:expects": { "@type": "hydra:Class", "hydra:subClassOf": "Event", "hydra:supportedProperty": [ { "@type": ["hydra:SupportedProperty", "http://schema.org/PropertyValueSpecification"], "hydra:property": "eventStatus" }] } }, { "hydra:method": "DELETE" }] }] } Best regards, Dietrich [1] https://github.com/dschulten/hydra-java [2] https://github.com/HydraCG/Specifications/issues/26 - -- Dietrich Schulten Escalon System-Entwicklung Bubenhalde 10 74199 Untergruppenbach -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iEYEARECAAYFAlSjx/0ACgkQuKLNitGfiZMDxgCePrefZRO1yUQY261hZN3hnW54 YqIAoNdsE2JAM6SMtJFHIS40kaz65zKJ =BaWN -----END PGP SIGNATURE-----
Received on Wednesday, 31 December 2014 09:55:41 UTC