HydraCG / Specifications

Specifications created by the Hydra W3C Community Group
Other
139 stars 25 forks source link

Plural properties should become singular #25

Closed lanthaler closed 10 years ago

lanthaler commented 10 years ago

_Raised by Ruben Verborgh:_

Dear all,

TL;DR: Since the range of the following properties is not a list, I think they should be singular:

In the RDF data model, a property creates a relation between a subject and an object. For instance, :subject :hasP :object means that “subject has object as P". We see examples of that in all popular vocabularies. Examples: RDF – :me rdf:type foaf:Person, foaf:Agent. FOAF – :me foaf:interest, :Web, :Hypermedia. Dublin Core – ;document dc:hasPart :part1, :part2.

As you can see, it doesn't matter whether one or multiple properties are expected: multiple objects can be attached to the same subject; but all are different relations. The property is singular because it describes a relation between two (singular) things. The only time we would encounter a plural, is if the object is a list/collection.

If we look at Hydra, this is not defined as one would expect:

{
  "@id": "hydra:mappings",
  "@type": "rdf:Property",
  "comment": "The variable-to-property mappings of the IRI template.",
  "domain": "hydra:IriTemplate",
  "label": "mappings",
  "range": "hydra:IriTemplateMapping",
  "status": "testing"
},

This can lead to situations such as

:Template hydra:template "/issues{?q}" ;
    hydra:mappings :q.
:q a hydra:IriTemplateMapping;
    hydra:property hydra:freetextQuery;
    hydra:required true;
    hydra:variable "q" .

So the “mappings” of /issues{?q} is actually a single mapping. Or in other words: /issues{?q} has "mappings” :q, but :q is only a single mapping, not a collection of mappings. Let me trim down the example to show this contradiction better:

:Template hydra:mappings :q.
:q a hydra:IriTemplateMapping.

Either :q should be hydra:IriTemplateMappings, or the property should be singular: "hydra:mapping".

The case of “statusCodes” shows to how much confusion this leads: we have both a “statusCode” and a ”statusCodes” property. The situation would be that a resource can lead to “statusCodes" X, Y, Z, each of which have a “statusCode” 200, 400, 500, respectively. I think the correct way is that “statusCodes” becomes “status”, and that the current statusCode remains the way it is.

I would strongly suggest that all of the aforementioned properties are turned into singular; that would align Hydra with the best practices of all other vocabularies. I know that changing this can be a pain, but I think it's important we do this.

lanthaler commented 10 years ago

Gregg Kellogg: +1 Elf Pavlik: +1 Kingsley Idehen: +1 Markus Lanthaler: +1

RubenVerborgh commented 10 years ago

I can create a pull request for this if you'd like me to.

damnhandy commented 10 years ago

+1

lanthaler commented 10 years ago

I can create a pull request for this if you'd like me to.

Pull requests are always welcome :-)

RubenVerborgh commented 10 years ago

Great, I'm on it. Give me a couple of days.

RubenVerborgh commented 10 years ago

Progress (can be tracked in my personal singular branch):

RubenVerborgh commented 10 years ago

Is there any way we can move on this issue (pull request #34)? The singularization is OK except for hydra:statusCodes, which is a separate issue (#27).

The faster we do this, the less chance that the old pluralized properties are actually being used. What happens to hydra:statusCodes is a different story anyway.

gkellogg commented 10 years ago

+1

lanthaler commented 10 years ago

On Friday, February 14, 2014 11:42 AM, Ruben Verborgh wrote:

Thanks a lot for taking a stab at this Ruben. Much appreciated. It LGTM but as you say

[...] the statusCodes issue needs fixing before it can be singularized: https://github.com/HydraCG/Specifications/issues/27

Is there any way we can move on issue 25 (pull request 34)? The singularization is OK except for hydra:statusCodes, which is a separate issue anyway (27).

Does anyone object to merge PR #34 [1]?

If we do so now, we end up with a slightly inconsistent vocabulary as hydra:statusCodes is the only property in plural. We also end up having a couple properties that differ from types only in their capitalization (ISSUE-28 [2]).

I'll wait a couple of days to give everyone a fair chance to object. If there aren't any any objections, I'll go ahead and merge it (likely on Friday).

[1] https://github.com/HydraCG/Specifications/pull/34 [2] https://github.com/HydraCG/Specifications/issues/28

Markus Lanthaler @markuslanthaler