Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for allowed literals and allowed individuals #82

Open
dschulten opened this issue Jan 5, 2015 · 5 comments
Open

Add support for allowed literals and allowed individuals #82

dschulten opened this issue Jan 5, 2015 · 5 comments

Comments

@dschulten
Copy link
Contributor

Currently there is no way in hydra to express a fixed number of possible values.

There seem to be no other established vocabularies which allow us to do so. At some point the RDF Shape WG shall provide a comprehensive way to express this and other constraints which then would supersede this proposal., But I think we need this earlier and I hope that hydra can provide valuable input to the Resource Shape WG by introducing such a facility which also integrates well with json-ld.

Proposal:
Have the following new properties and classes.

FIrst, hydra:allowedIndividual for enum values or other individuals with optional localized hydra:title to solve the value vs. caption problem.

* hydra:allowedIndividual :range hydra:AllowedIndividual - to hold the allowed individuals
  * hydra:AllowedIndividual - wrapper for allowed individuals with localized title
  * hydra:individual :domain hydra:AllowedIndividual - allowed URI values for a supported property

The :individual is for allowed values which are URIs, it should be used to apply @type:@vocab in the context.
Sample usage below. Client has requested Italian. The other language constructs of json-ld would work, too, see sample jsonld playgrounds below.

{
  "@context": {
      "@vocab": "http://schema.org/",
      "hydra": "http://www.w3.org/ns/hydra/core#",
      "hydra:individual": {
        "@type": "@vocab"
      }
  }
  ...
  "hydra:supportedProperty": [
      {
      "hydra:property": "eventStatus",
      "hydra:allowedIndividual": [
        {
          "hydra:individual": "EventCancelled",
          "hydra:title": "manifestazione annullata"
        },
        {
          "hydra:individual": "EventPostponed",
          "hydra:title": "manifestazione rinviata"
        } 
      ]
    }
  ]
}  

Second, hydra:allowedLiteral is for scalar values like strings or numbers.

* hydra:allowedLiteral - allowed literal values for a supported property

Finally, by dereferencing hydra:allowedResource the client can get a Collection or PagedCollection of allowed individuals which may have a search property in turn. This would be useful in case the number of allowed individuals is too large for :allowedIndividual.

* hydra:allowedResource - Resource or IriTemplate to retrieve allowedIndividuals

Also see http://tinyurl.com/qz85ep6 for a real-life JSON-LD playground example of allowedIndividual vs. allowedLiteral.
On http://tinyurl.com/om7fsqc one can see a language map.
On http://tinyurl.com/px4aj75 one can see an illustration for allowedResource with IriTemplate.

@RubenVerborgh
Copy link
Contributor

Isn't that part of ontological modelling, and thus part of the property?

PS What is the Hydra mailing list thread for this?

@dschulten
Copy link
Contributor Author

Hi Ruben,

I do not think the ontological model of a property covers it. On the one hand, sometimes not all possible values are predefined, but they may be extensible by individuals from other vocabs, see the usage of goodrelations enums from schema.org. On the other hand, while a value might occur on a class in general, it might not be suitable in a particular context.
If you think rdfs:range, it is not about value constraints but inference, so it doesn't enumerate possible values at all (I've learned that much by now). Or do you have something else in mind?

I'll add the corresponding mailing list thread url later, it is there, albeit somewhat nested.

Cheers,
Dietrich

---- Ruben Verborgh schrieb ----

Isn't that part of ontological modelling, and thus part of the property?

PS What is the Hydra mailing list thread for this?


Reply to this email directly or view it on GitHub.

@RubenVerborgh
Copy link
Contributor

I replied on-list.

@alien-mcl
Copy link
Member

I think @RubenVerborgh is right and allowed individuals in most cases are topic for modelling. I can see at least two options here:

  • OWL - to heavy for me
  • SHACL - it's more to describing CWA structures in OWA way (and I personally prefer it over OWL)

In both cases, it doesn't have anything to do with hydra itself - it is enabled for structure and their properties description with supportedProperty predicate.

Yet, I can see one more situation - imagine a form i.e. for adding products to the shop. In a field for category, I'd like to to have a pointer (i.e. IRI templated link) that should pull categories for that very field (which would take into account current product details).
This is not a topic for modelling and I do not see a clear way of doing it with hydra yet. Any ideas for that one?

@alien-mcl
Copy link
Member

Another example would be an issue tracker and a form of a new issue with possibility of assigning users to it - I'd like to have an link given to a place that would pull a list of suitable users (i.e. in context of the current project a new issue is related to).
I do not see any quick resolution in hydra as it is now. Possibly new vocabulary element would be necessary to cover this scenario - any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants