- From: Markus Lanthaler <markus.lanthaler@gmx.net>
- Date: Fri, 18 Oct 2013 09:35:14 +0200
- To: 'Sam Goto' <goto@google.com>, public-hydra@w3.org, 'W3C Web Schemas Task Force' <public-vocabs@w3.org>
One more thing I realized after sending this message last night. Inline
below
On 10/17/2013 09:20 PM, Markus Lanthaler wrote:
> On Thursday, October 17, 2013 8:39 PM, Sam Goto wrote:
>> For example, netflix can stream (http://schema.org/WatchAction) movies
>> (http://schema.org/Movie), but not *any* movie: it can stream a specific
>> set of movies that are in their *inventory* of streamable movies (e.g.
>> movies that in theatres right now are *not* in their inventory, movies
>> that can only be rented via DVDs either, etc).
>
> If there's a large number of instances which all support the same
> operations, it makes sense to create a separate class to communicate that
> information to the client. In the example above, that class could, e.g., be
> called StreamableMovie. The WatchAction can then simply be attached to that
> class. When talking to programmers without Semantic Web background I
> typically explain that in terms of interfaces an instance implements or
> inheritance similar to what they know from their object oriented programming
> languages.
Another option, and probably the one I would choose for such a use case,
is to create a specific property which only appears in the data if the
movie is streamable. The value of that property would be a URL that can
be used to watch the movie:
{
"@context": "http://purl.org/hydra/core/context.jsonld",
"@id": "/a-movie",
"title": "A streamable movie",
"stream": "/streams/a-movie"
}
Just as with classes, you can also associate operations to properties:
{
"@context": "http://purl.org/hydra/core/context.jsonld",
"@id": "stream",
"@type": "Link",
"supportedOperations": [
{
"@type": "http://schema.org/WatchAction",
"method": ...
...
}
]
}
Cheers,
Markus
--
Markus Lanthaler
@markuslanthaler
Received on Friday, 18 October 2013 07:35:54 UTC