Main Content

addResourceProperty

Add resource property to local OSLC resource object

Since R2021a

    Description

    addResourceProperty(resource,propertyName,resourceURL) adds a new element to the locally stored RDF/XML data for the Open Services for Lifecycle Collaboration (OSLC) resource specified by resource. The function sets the element name to propertyName and sets the rdf:resource attribute of the element to resourceURL. Use the commit function to apply the change to the service provider. For more information about RDF/XML elements, see An XML Syntax for RDF on the World Wide Web Consortium website.

    example

    Examples

    collapse all

    This example shows how to add, get, and remove properties from an existing OSLC requirement resource.

    Create and configure the OSLC client myClient as described in Create and Configure an OSLC Client for the Requirements Management Domain. Then query the service provider for requirements and assign an oslc.rm.Requirement object to the variable myReq as described in Submit a Query Request with Query Capability.

    Retrieve the full resource data from the service provider for the requirement resource myReq.

    status = fetch(myReq,myClient)
    status = 
    
      StatusCode enumeration
    
        OK

    The requirement myReq has a linked requirement with an implementedBy relationship. Get the rdf:resource value for the oslc_rm:implementedBy property for the requirement resource myReq.

    linkedReq = getResourceProperty(myReq,'oslc_rm:implementedBy')
    linkedReq =
    
      1×1 cell array
    
        {'https://localhost:9443/rm/resources/_72lxMWJREeup0...'}

    Change the relationship between the linked requirement and myReq from implementedBy to decomposedBy. Remove the oslc_rm:implementedBy property and add an oslc_rm:decomposedBy property.

    removeResourceProperty(myReq,'oslc_rm:implementedBy',linkedReq)
    addResourceProperty(myReq,'oslc_rm:decomposedBy',linkedReq)

    Get the text contents for the dcterms:title property.

    title = getProperty(myReq,'dcterms:title')
    title =
    
        'My New Requirement'

    Change the title to My New Requirement (Edited). Confirm the changes.

    setProperty(myReq,'dcterms:title','My New Requirement (Edited)')
    title = getProperty(myReq,'dcterms:title')
    title =
    
        'My New Requirement (Edited)'

    Add a new text property to the requirement with the tag dcterms:description. Confirm the changes.

    addTextProperty(myReq,'dcterms:description', ...
        'My new requirement edited using the MATLAB OSLC client.');
    desc = getProperty(myReq,'dcterms:description')
    desc =
    
        'My new requirement created using the MATLAB OSLC client.'

    Commit the changes to the service provider.

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

    View the resource that you edited in the system browser.

    show(myReq)

    Input Arguments

    collapse all

    OSLC resource property name, specified as a character vector.

    OSLC resource URL, specified as a character vector.

    Tips

    Version History

    Introduced in R2021a