urioslc

What is the difference between instanceShape and resourceShape?


What is the difference between instanceShape and resourceShape in terms of OSLC 2.0 Specification?

oslc:instanceShape - The URI of a Resource Shape that describes the possible properties, occurrence, value types, allowed values and labels. This shape information is useful in displaying the subject resource as well as guiding clients in performing modifications. Instance shapes may be specific to the authenticated user associated with the request that retrieved the resource, the current state of the resource and other factors and thus should not be cached.

Resource Shape - meet this need by providing a machine-readable definition of one or more OSLC resource types or instances. An OSLC Creation Factory MAY provide one or more Resource Shapes so that you know what properties are allowed and required to create resources.

So the my understanding is that resource describes the what the properties are,but isntanceShape is just the URL to the resource shape?


Solution

  • TL;DR: oslc:instanceShape links to a resource shape for the current resource, and oslc:resourceShape links to a resource shape for the resources that can be created or queried in that context.


    oslc:instanceShape

    oslc:instanceShape (an RDF property or "predicate") is used to link to a Resource Shape "that describes the possible properties, occurrence, value types, allowed values and labels" of the current resource. That is, if you have a link (aka 'triple') like this:

    <http://example.com/resources/1> oslc:instanceShape <http://example.com/shapes/A>
    

    then that is stating that the resource shape that can be retrived by requesting http://example.com/shapes/A describes the shape of the resource identified by the URI http://example.com/resources/1. (You would probably see this link in the response to a request on that resource's URI http://example.com/resources/1).

    oslc:instanceShape vs "Resource Shape"

    So if you are asking "what is the difference between oslc:instanceShape and the phrase 'Resource Shape'?", the answer is that oslc:instanceShape is the property/predicate that is used to link to a "Resource Shape".

    oslc:resourceShape

    However, there is also another property/predicate called oslc:resourceShape, which you mention. This is used to link from a "Creation Factory" or "Query Capability" resource to describe the 'shape' of the resources that the factory or capability deals with. That is, it links to a Resource Shape "that describes the possible properties, occurrence, value types, allowed values and labels" of the resources that can be created or queried in that context.

    oslc:instanceShape vs oslc:resourceShape

    In theory, it would be possible for a creation factory to have both of these links, e.g.:

    <http://example.com/types/1/factory> rdf:type oslc:CreationFactory.
    <http://example.com/types/1/factory> oslc:resourceShape <http://example.com/types/1/shape>.
    <http://example.com/types/1/factory> oslc:instanceShape <http://example.com/factoryShape>.
    

    Where requesting http://example.com/types/1/shape would return a resource shape that describes the 'shape' of resources that the creation factory http://example.com/types/1/factory can create, and requesting http://example.com/factoryShape would return a shape that describes the properties that can appear on the creation factory resource itself. (However, it is quite unlikely that a creation factory resource would have an instanceShape link, as its properties are well-defined by the OSLC specification and I can't think of any cases where the client would either need to display these to a user or modify them.)

    Conclusion: oslc:instanceShape links to a resource shape for the current resource, and oslc:resourceShape links to a resource shape for the resources that can be created or queried in that context.


    Aside: oslc:resourceShape vs oslc:ResourceShape

    Slight aside: oslc:resourceShape and oslc:ResourceShape are different: oslc:resourceShape is a property to link to a resource shape, and oslc:ResourceShape is a value to use for the rdf:type on Resource Shape resources themselves.

    Source

    The resource table for the CreationFactory type says, for the oslc:resourceShape property: "A Creation Factory MAY provide Resource Shapes that describe shapes of resources that may be created".

    The OSLC specs don't seem to include a clear description of how oslc:instanceShape is different, but the submission of OSLC Resource Shapes to the W3C says: "The oslc:instanceShape property is used to link any described resource with a shape resource that describes its contents".