Maximo

Maximo

Come for answers, stay for best practices. All we're missing is you.

 View Only

OSLC.WHERE (Part 2) 

Wed March 18, 2020 11:54 AM

oslc.where (part 2)

The example below shows the use of the IN operator within an oslc.where

 

 Result:

 

 

 

Some additional oslc.where operators:

 

The syntax for using a ‘like’ in the oslc.where is as follows:

            oslc:shortTitle=”ABC%” – shortTitle (wonum) begins with ABC

            oslc:shortTitle=”%ABC” – shortTitle (wonum) ends with ABC

            oslc:shortTitle=”%ABC%” – shortTitle (wonum) contains ABC

 

The syntax for checking a property that has a value of null or not

            dcterms:title=”*” – title (description) is not null

            dcterms:title!=”*” – title (description) is  null

 

 

When a property of reference resource (another resource) there are a couple of options to use oslc.where .  In the examples above, the resource, oslcwodetail, is made up of the Maximo Work Order object and a number of additional child objects.  Within the Work Order object is a property for the Asset number.  This property is configured as a resource reference as the asset itself is a resource.  This is how the asset appears in the work order resource:

 

  "spi:asset":

   {

    "rdf:resource": "http://localhost/maximo/oslc/os/oslcasset/_NTIzMDAvQkVERk9SRA--"

   },

 

If you wanted to query for work orders that had a specific asset number you have a couple of choices:

  1. http://localhost/maximo/oslc/os/oslcwodetail?oslc.where=spi:asset=<http://localhost/maximo/oslc/os/oslcasset/_NTIzMDAvQkVERk9SRA-->

 

In this case the asset is identified by its resource URI enclosed in angle bracket <>

 

  1. http://localhost/maximo/oslc/os/oslcwodetail?oslc.where=spi:asset{oslc:shortTitle="12600" and spi:siteid="BEDFORD"}

 

In this case the asset is identified by its key fields, asset number (shortTitle) and site id.  

 

Depending upon your implementation you may find that your client program has either the URL or the field values (but not both).

Note that the formatting varies between the two options.

 

You can apply the same type where conditions on the inline child resources as shown in the examples above.  In the resource used in the examples above, the work order object has a child object of planned labor that is an inline resource.  Below is a sample of how the Planned Labor is represented in the WO resource:

 

  

You could execute the following GET request to find all work orders that have a Planned Labor code = CARSON.

 http://localhost/maximo/oslc/os/oslcwodetail?oslc.where=spi_wm:wplabor{spi_wm:laborcode="CARSON"}

 The result would be a collection of WO resource URIs for those work orders that match the condition.




#AssetandFacilitiesManagement
#Maximo
#MaximoIntegrationandScripting

Statistics
0 Favorited
6 Views
0 Files
0 Shares
0 Downloads