Author Topic: Change the parent of a resource via PCS OSLC  (Read 6989 times)

phi55

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Change the parent of a resource via PCS OSLC
« on: June 23, 2023, 02:33:42 pm »
Trying to use OSLC to move an element or a package to a different place, but there’s no documentation for updating a resource’s parent (based on https://sparxsystems.com/enterprise_architect_user_guide/16.1/the_model_repository/oslc_upd_resources.html and the examples). The updating operation only deals with its listed features internally, so I cannot find a way to move it to a different place (e.g, move it one level up in the tree structure).
 
1. When creating a new resource, the `ss:parentresourceidentifier` is required. Is there an optional one where we can use to specify the parent location in updating operation?
2. `ss:parentresourceidentifier` is in the http://model/oslc/am/rs/cfresouce (resource shape for create) but not in http://model/oslc/am/resource (resource shape for update)
3. If not, is there workaround to get the same effect for moving a resource (preserving the relationships and all properties etc of the item being moved)?

If OSLC supports updating resource's parent, the workflow can be more automated and easily integrated.

Thank you!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12995
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change the parent of a resource via PCS OSLC
« Reply #1 on: June 23, 2023, 02:42:54 pm »
Have you tried updating the parentID?

That's how it works in the regular API anyway.

Geert

phi55

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Change the parent of a resource via PCS OSLC
« Reply #2 on: June 27, 2023, 03:28:46 pm »
I tried the following to post to `<protocol>://<server>/<model_name>/oslc/am/pu/resource/`

```xml
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:oslc_am="http://open-services.net/ns/am#"
                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                xmlns:dcterms="http://purl.org/dc/terms/"
                xmlns:foaf="http://xmlns.com/foaf/0.1/"
                xmlns:ss="http://www.sparxsystems.com.au/oslc_am#">

     <oslc_am:Resource>
          <!--Required Property-->
          <dcterms:identifier>el_{5FE6EEBA-20C4-4fae-804E-6076C72C7D32}</dcterms:identifier>
          <ss:useridentifier>{C3EE2FC5-D661-4886-BA90-E805B41C521C}</ss:useridentifier>
          <!--Updateable Properties-->
          <ss:parentresourceidentifier>pk_{9A699728-DB95-4126-A142-DE084597EE82}</ss:parentresourceidentifier>
     </oslc_am:Resource>

</rdf:RDF>
```

but got 400 response:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oslc="http://open-services.net/ns/core#">
    <oslc:Error>
        <oslc:statusCode>400</oslc:statusCode>
        <oslc:message>Invalid property 'ss:parentresourceidentifier'</oslc:message>
    </oslc:Error>
</rdf:RDF>
```

Other updateable properties such as `dcterms:title` can be updated as expected.

Is there a workaround for changing the parent?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12995
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change the parent of a resource via PCS OSLC
« Reply #3 on: June 27, 2023, 04:32:05 pm »
If I understand the documentation correctly, here it lists all updatable properties. https://sparxsystems.com/enterprise_architect_user_guide/16.1/the_model_repository/oslc_upd_resources.html

But ss:parentresourceidentifier doesn't seem to be listed there. So it seems to be you can't change the parent of an element through OSLC

Geert