Main Content

getQueryService

Get OSLC query service object

Since R2021a

    Description

    myQueryCapability = getQueryService(myClient) returns all available query capabilities for the OSLC client myClient.

    Tip

    Use this syntax to create query services with resource types that are not defined in the OSLC standard.

    example

    myQueryCapability = getQueryService(myClient,resourceType) returns a query capability for the resource type specified by resourceType for the OSLC client myClient.

    example

    Examples

    collapse all

    This example shows how to create all available query capabilities for a configured OSLC client.

    After you have created and configured an OSLC client as described in Create and Configure an OSLC Client for the Requirements Management Domain, create all available query capabilities for the client myClient.

    myQueryCapability = getQueryService(myClient)
    myQueryCapability = 
    
      1×4 QueryCapability array with properties:
    
        queryParameter
        client
        queryBase
        resourceShape
        title
        resourceType

    Examine the query capability resourceType to determine which query capability you want to use.

    myQueryCapability(3).resourceType(2)
    ans =
    
      1×1 cell array
    
        {'http://open-services.net/ns/rm#Requirement'}

    This example shows how to submit a query request with a configured OSLC client.

    After you have created and configured an OSLC client myClient as described in Create and Configure an OSLC Client for the Requirements Management Domain, create a query capability for the requirement resource type.

    myQueryCapability = getQueryService(myClient,'Requirement')
    myQueryCapability = 
    
      QueryCapability with properties:
    
        queryParameter: ''
                client: [1×1 oslc.Client]
             queryBase: 'https://localhost:9443/rm/views?oslc.query=true&projectURL=http...'
         resourceShape: {0×1 cell}
                 title: 'Query Capability'
          resourceType: {1×2 cell}

    Submit a query request to the service provider for the available requirement resources.

    reqs = queryRequirements(myQueryCapability)
    reqs = 
    
      1×30 Requirement array with properties:
    
        ResourceUrl
        Dirty
        IsFetched
        Title
        Identifier

    Assign the first returned requirement resource to the variable myReq, then fetch the full resource properties for myReq. Examine the Title property.

    myReq = reqs(1);
    status = fetch(myReq,myClient)
    status = 
    
      StatusCode enumeration
    
        OK
    title = myReq.Title
    title =
    
        'Requirement 1'
    

    Input Arguments

    collapse all

    OSLC client, specified as an oslc.Client object.

    OSLC resource type, specified as character array with one of these values:

    • 'ChangeRequest'

    • 'TestCase'

    • 'TestExecutionRecord'

    • 'TestPlan'

    • 'TestResult'

    • 'TestScript'

    • 'Requirement'

    • 'RequirementCollection'

    The specified resource type must match the domain for the configured oslc.Client object.

    Output Arguments

    collapse all

    OSLC resource query capability, specified as an oslc.core.QueryCapability object.

    Version History

    Introduced in R2021a