[oslc-core] Shapeless query result example

Arthur Ryman ryman at ca.ibm.com
Mon Aug 9 13:17:52 EDT 2010


Dave,

There are two cases to consider when no ResourceShape is given for a Query 
Capability:
1. The query capability has a type and a membership property. - In this 
case the result should use the type and membership property.
2. The query capability does not have a type or specific membership 
property. - In this case use the rdf:Description node element and the 
rdfs:member property.[1]

In general, the query result contains two top level subject nodes. The 
first is the ResponseInfo whose subject is the full query URI. The second 
is the query base URI which contains as members the set of resources that 
satisfy the query.

The example below omits the query base URI subject and and its membership 
properties. The idea is that the query base represents a collection of 
resources, and that the query lets you filter this collection for some 
subset of the resources. You specify the filter conditions in the 
oslc.where clause. The members of the collection are defined by one or 
more multi-valued membership properties whose subject is the query base 
URI, and whose objects are the members. A service may define some 
domain-specific membership properties, or it may use the generic 
membership property, rdfs:member. In either case, the query result should 
include the membership properties.

In your example below, it looks like you are using your Blog example, and 
you are filtering the collection for a set of comment resources. I assume 
the comment resources have rdf:type=oslc_blog:Comment However, if the 
members had no type, they too would use the rdf:Description node element. 

For example, suppose you want to get all the oslc_blog:Comment resources 
and their titles. Use the following query:

http://example.com/query?oslc.where=rdf:type=oslc_blog:Comment&oslc.select=dcterms:title

The result is:

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:dcterms="
http://purl.org/dc/terms/"
        xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_blog="
http://open-services.net/ns/bogus/blogs#">

        <oslc:ResponseInfo
                rdf:about="
http://example.com/query?oslc.where=rdf:type=oslc_blog:Comment&oslc.select=dcterms:title
">
                <dcterms:title>Blog Service Query Results</dcterms:title>
        </oslc:ResponseInfo>

        <rdf:Description rdf:about="http://example.com/query">

                <rdfs:member>
                        <oslc_blog:Comment rdf:about="
http://example.com/blogs/comment/5">
                                <!-- Comment property values, etc. -->
                                <dcterms:title>Comment #5</dcterms:title>
                        </oslc_blog:Comment>
                </rdfs:member>

                <rdfs:member>
                        <oslc_blog:Comment rdf:about="
http://example.com/blogs/comment/4">
                                <!-- Comment property values, etc. -->
                                <dcterms:title>Comment #4</dcterms:title>
                        </oslc_blog:Comment>
                </rdfs:member>

                <rdfs:member>
                        <oslc_blog:Comment rdf:about="
http://example.com/blogs/comment/2">
                                <!-- Comment property values, etc. -->
                                <dcterms:title>Comment #2</dcterms:title>
                        </oslc_blog:Comment>
                </rdfs:member>

                <rdfs:member>
                        <oslc_blog:Comment rdf:about="
http://example.com/blogs/comment/1">
                                <!-- Comment property values, etc. -->
                                <dcterms:title>Comment #1</dcterms:title>
                        </oslc_blog:Comment>
                </rdfs:member>

                <rdfs:member>
                        <oslc_blog:Comment rdf:about="
http://example.com/blogs/comment/3">
                                <!-- Comment property values, etc. -->
                                <dcterms:title>Comment #3</dcterms:title>
                        </oslc_blog:Comment>
                </rdfs:member>

                <!-- etc. etc. -->

        </rdf:Description>

</rdf:RDF>


[1] http://www.w3.org/TR/rdf-schema/#ch_member

Regards, 
___________________________________________________________________________ 

Arthur Ryman, PhD, DE


Chief Architect, Project and Portfolio Management

IBM Software, Rational

Markham, ON, Canada | Office: 905-413-3077, Cell: 416-939-5063
Twitter | Facebook | YouTube







From:
Dave <snoopdave at gmail.com>
To:
oslc-core <oslc-core at open-services.net>
Date:
08/09/2010 08:35 PM
Subject:
[oslc-core] Shapeless query result example
Sent by:
oslc-core-bounces at open-services.net



We talked about the need for an example that shows what a query
resource would look like if there were no Resource Shape provided by
the Query Capability. Arthur suggested that we do not need to define a
query result type or a member property, and could simply return
triples about the result URIs plus an oslc:ResponseInfo resource (if
needed).

Here's an example of that form, which fits in with the examples in
Appendix B and validates: http://tinyurl.com/26tetbv

1:
2: <rdf:RDF
3:    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4:    xmlns:dcterms="http://purl.org/dc/terms/"
5:    xmlns:oslc="http://open-services.net/ns/core#"
6:    xmlns:oslc_blog="http://open-services.net/ns/bogus/blogs#">
7:
8:     <oslc:ResponseInfo
rdf:about="http://example.com/query?oslc.from [...] entry/1>">
9:         <dcterms:title>Blog Service Query Results for term
[remote]</dcterms:title>
10:     </oslc:ResponseInfo>
11:
12:
13:     <rdf:Description rdf:about="http://example.com/blogs/comment/5">
14:         <!-- Comment propery values, etc. -->
15:         <dcterms:title>Comment #5</dcterms:title>
16:     </rdf:Description>
17:
18:     <rdf:Description rdf:about="http://example.com/blogs/comment/4">
19:         <!-- Comment propery values, etc. -->
20:         <dcterms:title>Comment #4</dcterms:title>
21:     </rdf:Description>
22:
23:     <rdf:Description rdf:about="http://example.com/blogs/comment/2">
24:               <!-- Comment propery values, etc. -->
25:         <dcterms:title>Comment #2</dcterms:title>
26:     </rdf:Description>
27:
28:     <rdf:Description rdf:about="http://example.com/blogs/comment/1">
29:               <!-- Comment propery values, etc. -->
30:         <dcterms:title>Comment #1</dcterms:title>
31:     </rdf:Description>
32:
33:     <rdf:Description rdf:about="http://example.com/blogs/comment/3">
34:         <!-- Comment propery values, etc. -->
35:         <dcterms:title>Comment #3</dcterms:title>
36:     </rdf:Description>
37:
38:        <!-- etc. etc. -->
39:
40: </rdf:RDF>


Look correct? Any objections to or concerns about adding this to Appendix 
B?

Thanks,
Dave

_______________________________________________
Oslc-Core mailing list
Oslc-Core at open-services.net
http://open-services.net/mailman/listinfo/oslc-core_open-services.net







More information about the Oslc-Core mailing list