RE: rdfs:subClassOf and hydra:subClassOf

Hi Josue,

First of all, sorry for the delay. I have first been traveling and had then
to defend my PhD. Still catching up with all the mails...


On Monday, March 31, 2014 10:11 PM, Josue Alexander Baquiax Batén wrote:
> I'm working with Hydra Core and I have a question.
> 
> In RDF:subClassOf the class A that inherit from B, inherit all
> properties of B. It work of the same way with hydra:subClass?

That's not true. In RDF properties are only loosely bound to classes.
Generally, you can use any property with any class. If a property has a
specific domain set, that means that the resource will also become an
instance of that class. So if you have (pseudo-code)

  propertyA domain ClassA
  propertyB domain ClassB

  ClassB subClassOf ClassA

  propertyC domain ClassC

and you have a resource

  /something @type ClassB

it means neither that /something has propertyB nor propertyC. On the other
hand,

  /something propertyB "Value of propertyB"

means (infers) that /something is an instance of both ClassA and ClassB. I
know, this is quite confusing if you come from an object-oriented
programming world. So, if the explanation above is unclear, please don't
hesitate to ask more questions. I'm more than happy to explain this in more
detail.


> I trying do some same as:
> {
> 	  ...
>      {
>          "@id":"mm:User",
>          "@type":"hydra:Class",
>          "comment":"User representation",
>          "label":"user",
>          "status":"testing"
>       },
>       {
>          "@id":"mm:userId",
>          "@type":"rdf:Property",
>          "label":"user-id",
>          "comment":"User identifier",
>          "domain":{
>             "@id":"mmUser"
>          },
>          "range":{
>             "@id":"xsd:integer"
>          }
>       },
>       {
>          "@id":"mm:userEmail",
>          "@type":"rdf:Property",
>          "label":"user-email",
>          "comment":"User email",
>          "domain":{
>             "@id":"mm:User"
>          },
>          "range":{
>             "@id":"xsd:string"
> 
>          }
>       },
>       ...
>     }
> ...
>   {
>          "@id":"vocab:User",
>          "@type":"hydra:Class",
>          "rdfs:subClassOf":{
>             "@id":"mm:User"
>          },
>          "label":"User",
>          "description":"A Mindmeister user.",
>          "supportedOperations":[
>             {
>                "@id":"_:retrievesUser",
>                "method":"GET",
>                "label":"Retrieve a User entity",
>                "description":"",
>                "expects":null,
>                "returns":"vocab:User",
>                "statusCodes":[
>                   {
>                      "code":404,
>                      "description":"The user not exists."
>                   }
>                ]
>             }
>          ],
>         ...
> 
> Is posible do it?

Yes, that's completely valid, but ...


> Basically I need define a class with its properties, and make a
> subclass of this, that inherit its (first Class mentioned) properties;

It doesn't inherit properties because you haven't defined any (from a Hydra
perspectice). You just defined some whose domain happens to be mm:User...

> so that in this example "supportedProperties" will be emtpy.

... so you need to reference them from supportedProperties as follows:

  "@id":"vocab:User",
  "supportedProperty": [
    { "property": "mm:userId" }
    ...
  ]

You can of course describe each property further by adding things like
"required": true to the SupportedProperty definitions.

Please also note that a while ago we changed all plural property names to
singular to make the vocabulary more consistent (and we changed the
namespace from purl.org/... to http://www.w3.org/ns/hydra/core#). The latest
spec can be found at:

  http://www.hydra-cg.com/spec/latest/core/

 
> I'm not expert in this topic. therefore I need your comments.

I hope this helps. I know it is quite confusing at least initially as RDF
follows a quite different model than most object-oriented programming
languages. So, again, please don't hesitate to ask more questions if
something is unclear.


Cheers,
Markus


--
Markus Lanthaler
@markuslanthaler

Received on Tuesday, 8 April 2014 20:42:08 UTC