Main Content

oslc.core.QueryCapability

OSLC service provider query capability

    Description

    Use oslc.core.QueryCapability object functions to query resources in an Open Services for Lifecycle Collaboration (OSLC) service provider. After creating and configuring an oslc.Client, you can create a query capability object for the service provider specified in the Client object.

    Creation

    Create an oslc.core.QueryCapability object by using getQueryService.

    Properties

    expand all

    Additional query parameters defined in query capability object, specified as a character array.

    For more information, see Query Parameters in the OSLC Core Specification Version 2.0 Query Syntax.

    Example: '?oslc.select=oslc_qm:testResult'

    OSLC client associated with the query capability, specified as an oslc.Client object.

    Query capability resource URI, specified as a character vector.

    Resource URI for the RDF representation of the expected contents of the specified resource type, specified as a cell array.

    Example: {'https://localhost:9443/rm/types/_4zFVsRL5EeuLWbFL3e4vrw'}

    Query capability object title, specified as a character array.

    Resource type to query the OSLC client for, specified as a cell array.

    Object Functions

    queryChangeRequestsQuery OSLC service provider for change requests
    queryRequirementCollectionsQuery OSLC service provider for requirement collections
    queryRequirementsQuery OSLC service provider for requirements
    queryTestCasesQuery OSLC service provider for test cases
    queryTestExecutionRecordsQuery OSLC service provider for test execution records
    queryTestPlansQuery OSLC service provider for test plans
    queryTestResultsQuery OSLC service provider for test results
    queryTestScriptsQuery OSLC service provider for test scripts
    setQueryParameterSet query parameter for OSLC query service

    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'
    

    Tips

    Introduced in R2021a