- From: Kévin Dunglas <dunglas@gmail.com>
- Date: Mon, 5 Jan 2015 09:08:40 +0100
- To: Markus Lanthaler <markus.lanthaler@gmx.net>
- Cc: public-hydra@w3.org
- Message-ID: <CAOv1iQZW2VBfNTUQM8hEnQsCvh77W=0pAqtbc0yZGvsjZ1_vHQ@mail.gmail.com>
Hello, Is there a way to describe allowed values with Hydra? For instance if I my API supports: - gr:ConstructionInstallation - gr:Dispose But not: - gr:Sell 2014-09-07 23:25 GMT+02:00 Markus Lanthaler <markus.lanthaler@gmx.net>: > On 7 Sep 2014 at 13:50, Dietrich Schulten wrote: > > Am 06.09.2014 15:21, schrieb Gregg Kellogg: > >> On Sep 6, 2014, at 12:04 PM, Dietrich Schulten wrote: > >>> { name: "Pirates of the Caribbean", acquire: "RENT", delivery: > >>> "IN_SHOP" } > >>> > >>> Can I write a context which says that "RENT" means > >>> http://purl.org/goodrelations/v1#LeaseOut and "IN_SHOP" means > >>> "http://schema.org/OnSitePickup"? The json-ld spec seems not to > >>> mention such a usage. > >>> > >>> It seems that terms cannot appear as attribute values unless the > >>> attribute is @type. Also, jsonld-java doesn't understand what I > >>> might mean by: > >> > >> Actually, you want @type: @vocab, which will allow term values > >> without needing a compact URI form. > > > > After some discussion with Gregg who pointed me to > > http://www.w3.org/TR/json-ld-api/#value-expansion, this is the outcome. > > > > The @vocab keyword has a second meaning which is not mentioned in the > > json-ld spec, only in the api. If used as a value of @type in the > > context, it says that the corresponding attribute value must be > > expanded to an IRI. > > Actually, it's also described in the syntax spec (but there's no example): > > http://www.w3.org/TR/json-ld/#type-coercion > > > > > Example: > > Define @vocab to be schema.org, let "gr" be goodrelations, let > > "delivery" be @type:@vocab, then the value of the "delivery" attribute > > in the JSON will be expanded as an IRI. > > > > The effect on the value of "delivery" is this: - A compact IRI > > gr:LeaseOut expands to http://purl.org/goodrelations/v1#LeaseOut. - > > Without gr: the @vocab value of schema.org is prepended. Useful if the > > enumerated value is in schema.org - And now the surprise: If I > > additionally define RENT to be gr:LeaseOut, that will be resolved, too: > > > > { > > "@context": { > > "@vocab" : "http://schema.org/", > > "gr": "http://purl.org/goodrelations/v1#", > > "delivery" : { > > "@id" : "availableDeliveryMethod", > > "@type" : "@vocab" > > }, > > "RENT": "gr:LeaseOut" > > }, > > "@type": "Movie", > > "name": "Pirates of the Carribean", > > "offer": { > > "delivery": "RENT" > > } > > } > > > > expands to the following in the http://json-ld.org/playground/ > > > > { > > "@type": "http://schema.org/Movie", > > "http://schema.org/name": "Pirates of the Carribean", > > "http://schema.org/offer": { > > "http://schema.org/availableDeliveryMethod": { > > "@id": "http://purl.org/goodrelations/v1#LeaseOut" > > } > > } > > } > > > > Thanks a lot! > > Yep, this is a very powerful feature. > > > -- > Markus Lanthaler > @markuslanthaler > > > -- Kévin Dunglas Consultant et développeur freelance http://dunglas.fr Tél. : 06 60 91 20 20
Received on Monday, 5 January 2015 08:09:28 UTC