RE: Reconciling hydra rest semantics for collections with typical RDF entity relationships

On Tuesday, February 04, 2014 7:56 PM, Gregg Kellogg wrote:
> On Feb 4, 2014, at 10:26 AM, Markus Lanthaler wrote:
> > We could of course go ahead and define a
> > Collection's semantics so that
> >
> >  x p c .
> >  c hydra:members y .
> >
> > would entail
> >
> >  x p y .
> >
> > which is what you are looking for, right?
> 
> That would be a way to do it with semantics, but I don't think this is
> as useful for the target audience. Also, I presumed that hydra:members
> would be an ordered collection (e.g., @container: @list), but that
> might not necessarily be the case; my examples had the values of
> hydra:members in a list, but this would be incompatible with such an
> entailment rule (sadly).

If it's an ordered list, couldn't you simply use a URL for the list's head?

  </gregg> :follows </list> .

  </list> rdf:first </markus> ;
          rdf:rest _:i2 .
  _:i2 ...



> >> :ApiPerson a hydra:Class;
> >>  hydra:supportedProperties [hydra:property schema:name],
> >> [hydra:property :follows] .
> >>
> >> :follows a hydra:Link
> >>    rdfs:label "follows";
> >>    rdfs:comment "Collection of followed people";
> >>    rdfs:domain schema:Person;
> >>    rdfs:range schema:Person;
> >
> > This range isn't correct unless you want
> > <http://example/people/gregg/follows> to be of type schema:Person.
> 
> Yes, it should be hydra:Collection. I supposed it could also be a sub-
> class of hydra:Collection where the range of hydra:member could be
> restricted to be schema:Person.

Sure. OWL already has everything you would need to do so.


[...]

> >> I guess the question is, is this an expected usage pattern? Should the
> >> collection examples represent this, or should it be described as a
> >> recommended practice? Perhaps I've missed something.
> >
> > I think this is definitely one of the most common usage patterns in Web
> > APIs. The question whether there needs to be a direct link between the
> > resources or whether you can go "through" a Collection is another
question.
> > As long as the consumer of the data understands Collection/ItemList I
think
> > it's not a problem. If it doesn't, it is of course.
> 
> From an SEO perspective, it's not clear that schema.org partners would
> make this connection, even though a ItemList has been defined. For that
> to be the case, I would expect that they would allow any property to
> take an ItemList in addition to the specified property range and do the
> inference you suggested above.

I obviously don't know what they are doing internally but I as they clean up
so much other messy data I'm quite sure they make this connection or plan to
do so.


[...]

> Thanks for the response, at least I know that my understanding of the
> issues doesn't seem to be that far off.

I think this is something we should definitely keep in mind. I've raised
ISSUE-33 [1]. Please let us know how you decided to solve this issue in the
API you are building.


[1] https://github.com/HydraCG/Specifications/issues/33


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 4 February 2014 19:34:44 UTC