Main Content

setResourceProperty

Set local contents of resource property from OSLC resource object

Since R2023b

    Description

    example

    setResourceProperty(resource,propertyName,propertyValue) sets the rdf:resource attribute to propertyValue for the RDF/XML element with name propertyName from the locally stored RDF/XML for the Open Services for Lifecycle Collaboration (OSLC) resource specified by resource. For more information about RDF/XML elements, see An XML Syntax for RDF on the World Wide Web Consortium website.

    Examples

    collapse all

    This example shows how to get and set OSLC resource properties.

    After you have created and configured the 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 myReq1 and the second requirement resource to the variable myReq2, then fetch the full resource properties for myReq1 and myReq2.

    myReq1 = reqs(1);
    myReq2 = reqs(2);
    status = fetch(myReq1,myClient);
    status = fetch(myReq2,myClient);

    Get the resource URL of the first requirement.

    URL = myReq1.ResourceUrl
    URL = 'https://localhost:9443/rm/resources/_aQ1gSQ8bEeuLWbFL3e4vrw'

    Set the oslc_rm:decomposes attribute of the second requirement to the resource URL of the first requirement.

    setResourceProperty(myReq2,'oslc_rm:decomposes',URL)

    Commit the changes to the service provider.

    status = commit(myReq2,myClient)
    status = 
    
      StatusCode enumeration
    
        OK

    View the resource that you edited in the system browser.

    show(myReq2)

    Input Arguments

    collapse all

    OSLC resource property name, specified as a character vector.

    OSLC resource property value, specified as a character vector.

    Version History

    Introduced in R2023b