Re: Schema.org properties having a collection as value and hydra:Collection

On 10/10/2014 09:52 AM, Dietrich Schulten wrote:
> Hi elf,
Hi Dietrich :)

> 
> comments inline.
> 
> Am 09.10.2014 09:33, schrieb ☮ elf Pavlik ☮:
>> On 10/09/2014 07:17 AM, Dietrich Schulten wrote:
>>> Properties like schema:review allow list or single values, but 
>>> normally that is represented by an item of the target type or an 
>>> array thereof. If I make the value of review a link, it seems 
>>> perfectly okay if the link dereferences a Review or a Review[]. 
>>> But can it point to a hydra:Collection?
>> have your read https://github.com/HydraCG/Specifications/issues/41 
>> ?
> 
> I did and from my understanding, the discussion seemed related to my
> question but there was no agreement about the solution yet. I am not
> well versed with turtle and rdf, too, so I must admit I struggle to
> follow the discussion there. At hydra-cg people with ReST and RDF
> background must learn to communicate somehow :)
I believe we can do it :)

Still IMO you may want to have decent understanding of RDF *especially*
if you want to participate in Hydra standardization work. I recommend
starting with http://www.w3.org/TR/2014/NOTE-rdf11-primer-20140624/

> 
> 
>>>
>>> Would it be feasible to let the link point to the hydra:member 
>>> attribute of a hydra:Collection using a fragment identifier? I 
>>> found the discussion below, but although it was resolved to 
>>> support fragment identifiers, the jsonld spec does not mention 
>>> that solution.
>>>
>>> https://github.com/json-ld/json-ld.org/issues/107
>>>
>>> How can I use a fragment identifier with json-ld? Would the 
>>> following link on the review attribute be correct with a context 
>>> having @vocab schema.org and a hydra: term? { "@type": "Product",
>>> "name": "Kenmore White 17\" Microwave", "review": { "@id":
>>> "http://api.example.com/reviews#hydra:member" ... }
> 
>> can you please provide us with excerpt of a document you would 
>> publish on http://api.example.com/reviews
> 
>> to my understanding it would need to include an object with "@id": 
>> "#hydra:member" somewhere
> 
> 
> 
> I see I need to correct the above to this:
> 
> {
>    "@type": "Product",
>    "@id": "http://api.example.com/products/1",
>    "name": "Kenmore White 17\" Microwave",
>    "review": {
>      "@id": "http://api.example.com/products/1/reviews#hydra:member"
>    }
>  ...
> }
> 
> 
> What I mean to say here is: "in the resource /products/1/reviews there
> is a fragment identified by the id hydra:member. That is where the
> "review" value can be retrieved". The # is not part of the identifier,
> but part of the URL syntax.
> A target document could be a hydra:Collection having a search property
> to motivate using the hydra:Collection here:
> 
> {
>   "@context": {
>     "@vocab": "http://schema.org",
>     "hydra": "http://www.w3.org/ns/hydra/core#",
>     "xsd": "http://www.w3.org/2001/XMLSchema#"
>   },
>   "@id": "http://api.example.com/products/1/reviews",
>   "@type": "hydra:Collection",
>   "hydra:member": [
>     {
>       "@id": "http://api.example.com/products/1/review/1",
>       "@type": "Review",
>       "reviewRating": 5,
>       "reviewBody": "This is the best 17\" microwave you can buy!"
>     },
>     {
>       "@id": "http://api.example.com/products/1/review/2",
>       "@type": "Review",
>       "reviewRating": 1,
>       "reviewBody": "Meh."
> 
>     }
>   ],
>   "hydra:search": {
>     "template": "http://api.example.com/products/1/review/{item}",
>     "mapping": [
>       {
>       "variable": "item",
>       "property": "xsd:integer", <-- is that OK?
>       "required": true
>       }
>     ]
>   }
> }
> 
> - From the way I am used to URL fragment identifiers, I thought this
> might allow me to use a hydra:Collection and point to its member
> property, so as to satisfy the expectation of schema:review to have
> one or many schema:Review items as value.
> 
> Would that be possible?
In RDF (not only schema.org vocab) when you have subject - predicate -
object by default you can make any number of of statements using
different objects for the same subject - predicate pair. So in JSON-LD
each property can accept either array or single object.

Now let's take your example to JSON-LD playground: http://bit.ly/1tgYc73

As you see according to specified context "hydra:member" extends to
"http://www.w3.org/ns/hydra/core#member" and to my understanding has
completely nothing to do with
"http://api.example.com/products/1/reviews#hydra:member"

Have you had chance to read http://www.w3.org/TR/webarch/ which explains
topics like URI Opacity?

I think that after finalizing hydra:IriTemplate design we will get back
on hydra:Collection + paging. Myself I also still work on finding my way
in RDF world but other people in this group have *very deep*
understanding of it (you can find Markus as one of RDF1.1 spec editors
and together with Gregg co-authored JSON-LD spec) + lots of hands on
experience (eg. https://github.com/gkellogg ,
https://github.com/RubenVerborgh etc.) While I also would like to use
hydra:Collection *ASAP*, we may need to stay patient and take little
more time to design it as good as we can!


> 
> Best regards,
> Dietrich
> 

HTH

Received on Friday, 10 October 2014 08:34:10 UTC