Main Content

getResourceProperty

Get local contents of resource property from OSLC resource object

    Description

    example

    rdfResource = getResourceProperty(resource,propertyName) returns the rdf:resource attribute of 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 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.

    Output Arguments

    collapse all

    OSLC resource property rdf:resource attribute, returned as a cell array.

    Tips

    Introduced in R2021a