Monday, February 1, 2010

Using Selective Properties (aka Partial Fetch)

Often is an issue when working with retrieving resources and their properties is getting the desired information efficiently. By definition of the CM 1.0 specification, when requesting a change request resource without any parameters to refine the list of properties you should retrieve ALL properties that resource has. Take for example this simple request:

GET http://example.com/bugs/2314
Accept: application/x-oslc-cm-change-request+xml

This will result in the change request identified by the URL to be retrieved:

<oslc_cm:ChangeRequest
rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
dc="http://purl.org/dc/terms/"
oslc_cm="http://open-services.net/xmlns/cm/1.0/"
xmlns="http://myserver/xmlns"
about="http://example.com/bugs/2314">

<dc:title> Provide import </dc:title>
<dc:identifier> 2314 </dc:identifier>
<dc:type> http://myserver/mycmapp/types/Enhancement </dc:type>
<dc:description>
Implement the system's import capabilities.
</dc:description>
<dc:subject> import, blocker </dc:subject>
<dc:creator resource="http://example.com/users/aadams" />
<dc:modified> 2008-09-16T08:42:11.265Z </dc:modified>
<owner resource="http://example.com/users/john">
<priority>High</priority>
<severity>High</severity>
<status>Working</status>
</oslc_cm:ChangeRequest>

This is useful when a consumer doesn't know which properties to request but can provide more information than is needed (both that the provider needs to generate and the consumer needs to process). To limit the amount of properties returned, the concept of selective properties can be used. If the consumer is only interested in the owner and the status, the request could be formulated such as:

GET http://example.com/bugs/2314?oslc_cm.properties=owner,status
Accept: application/x-oslc-cm-change-request+xml

Resulting in:

<oslc_cm:ChangeRequest
dc="http://purl.org/dc/terms/"
oslc_cm="http://open-services.net/xmlns/cm/1.0/"
xmlns="http://myserver/xmlns"
about="http://example.com/bugs/2314">

<owner resource="http://example.com/users/john" />
<status>Working</status>
</oslc_cm:ChangeRequest>

Perhaps we are interested in the owner's name and email address, we can expand the owner entry and select only those properties to be returned such as:

GET http://example.com/bugs/2314?oslc_cm.properties=owner{fullname,email},status
Accept: application/x-oslc-cm-change-request+xml

Resulting in:

<oslc_cm:ChangeRequest
rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
dc="http://purl.org/dc/terms/"
oslc_cm="http://open-services.net/xmlns/cm/1.0/"
xmlns="http://myserver/xmlns"
about="http://example.com/bugs/2314">

<owner>
<User rdf:about="http://example.com/users/john">
<fullname>John Doe</fullname>
<email>jdoe@myco</email>
</User>
<status>Working</status>
</oslc_cm:ChangeRequest>

This technique is used in CM 1.0 not only for selective retrieval of properties on a change request resource, it is used for partial updates of resources as well as controlling the content on query responses.

1 comment:

  1. Tronng văn phòng công ty với mỗi phòng ban đều có những chức năng công việc khác nhau cho nên việc lựa chọn mua bàn làm việc văn phòng giá rẻ cũng hòa toàn khác nhau tùy vào mục đích sử dụng của văn phòng. Cho nên việc lựa chọn mua sản phẩm nội thất văn phòng như bàn, ghế, tủ… đều phải có sự thống nhất và dựa vào không gian văn phòng làm việc mà lựa chọn được mẫu sản phẩm cho phù hợp nhất. Hiện nay trên thị trường nội thất có rất nhiều sản phẩm bàn văn phòng tphcm khác nhau nhiều giá, mẫu mã và chức năng.
    Bàn làm việc văn phòng cho nhân viên thì phụ thuộc vào diện tích khá nhiều. Những chiếc bàn làm việc đơn có hộc sẽ được sử dụng cho những căn phòng rộng để giúp mỗi người có một khoảng làm việc riêng và cũng để văn phòng không bị trống trải. Tuy nhiên, ở những thiết kế nội thất văn phòng hiện đại đề cao tính gắn kết nên lại chọn những kiểu bàn làm việc văn phòng giá rẻlớn dạng đôi để tập trung từng nhóm nhân viên lại với nhau. Vách ngăn vẫn sẽ giúp mỗi người có những khoảng không gian riêng cho mình. Cho nên để có một văn phòng đẹp hiện đại các nhà quản lý cần phải chọn mua được sản phẩm nội thất văn phòng hồ chí minh sao cho hài hòa với văn phòng cũng như là không gian làm việc tốt nhất. Chính vì thế các nhà thầu thiết kế cũng nên cân nhắc về việc tư vấn cho khách hàng của mình chọn được mẫu sản phẩm nội thất sử dụng tốt nhất.

    ReplyDelete