Example OSLC Query Capability discussion
Let's say for example that you wish to specify a query capability for a Blog Server that supports two types of resources:
blog:Entry
and
blog:Comments
. Each comment is associated with an entry. Each
blog:Comment
has a multi-valued property
blog:replyTo
that points to the entry that the comment is about. You want to be able to query for entries and comment by title.
Define resources
First, we define the blog entry and comment resources and a shape for each.
The blog entry shape will be here
http://example.com/blogs/entryshape
and will define this:
- Name:
Entry
- Namespace URI:
http://open-services.net/xmlns/bogus#Entry
- Properties:
-
dc:title
(XML Literal, exactly-one) title of Podcast
-
dc:date
(DateTime, exactly-one) - date/time that comment was created
-
dc:creator
(In-Line Resource of type foaf:Person
, exactly-one) - name of comment author
-
dc:content
(XML Literal, exactly-one) - content of the comment
The blog comment shape will be here
http://example.com/blogs/commentshape
and will define this:
- Name:
Comment
- Namespace URI:
http://open-services.net/xmlns/bogus#Comment
- Properties:
-
dc:date
(DateTime, exactly-one) - date/time that comment was created
-
dc:creator
(In-Line Resource of type foaf:Person
, exactly-one) - name of comment author
-
dc:content
(XML Literal, exactly-one) - content of the comment
-
blog:entry
(Resource, exactly-one of type blog:Entry
) - link to the Blog Entry
For the actual shape definition in XML/RDF, JSON, Atom and Turtle you can use your imagination.
Define shape required for query
Now that we have defined shapes for the resources, we also need to tie things together by defining a shape for the query resource. Below is a suitable query resource shape, represented in RDF/XML:
<oslc:Shape
rdf:about="http://example.com/blogs/contentquery"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/terms#"
xmlns:oslc="http://open-services.net/xmlns/oslc#">
<dc:title>Blog Content Query Shape</dc:title>
<rdf:type resource="http://open-services.net/xmlns/oslc#Shape" />
<oslc:property>
<oslc:Property>
<oslc:name>entry</oslc:name>
<oslc:namespace>http://open-services.net/xmlns/blog#</oslc:namespace>
<oslc:occurs>zero-or-many</oslc:occurs>
<oslc:shape rdf:resource="http://example.com/blogs/entryshape" />
<rdf:type resource="http://open-services.net/xmlns/blog#Entry" />
<oslc:isMemberProperty>true</oslc:isMemberProperty>
</oslc:Property>
</oslc:property>
<oslc:property>
<oslc:Property>
<oslc:name>comment</oslc:name>
<oslc:namespace>http://open-services.net/xmlns/blog#</oslc:namespace>
<oslc:occurs>zero-or-many</oslc:occurs>
<oslc:shape rdf:resource="http://example.com/blogs/commentshape" />
<rdf:type resource="http://open-services.net/xmlns/blog#Comment" />
<oslc:isMemberProperty>true</oslc:isMemberProperty>
</oslc:Property>
</oslc:property>
</oslc:Shape>
Define a query capability
Topic revision: r1 - 04 May 2010 - 16:32:52 -
DaveJohnson