Main Content


Add text property to local OSLC resource object

Since R2021a



    addTextProperty(resource,propertyName,textContents) 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 text contents of the element to textContents. 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.


    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

    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

    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.


    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

    View the resource that you edited in the system browser.


    Input Arguments

    collapse all

    OSLC resource property name, specified as a character vector.

    OSLC resource text content, specified as a character vector.


    Version History

    Introduced in R2021a