It's all about the answers!

Ask a question

DNG OSLC API: How to update multiple artifacts simultaneously?


Nhan Pham (111) | asked Nov 23 '23, 12:24 a.m.
edited Nov 23 '23, 12:25 a.m.

 Hello all,
I have project where I need to translate contents of requirement artifacts in a module to a language, and show them in a custom attribute "Translate". What my code does is to fetch the artifacts, translate and update the attribute "Translate" on each artifact. For a module with about 1000 artifacts, that's fine. But on a larger scale module, let's say 3000 artifacts, the process starts to get significantly slow. 
I do use Promise.all() to translate and update 10 artifacts at the same, but not much help there. Is there any OSLC api that I can use to edit attributes and update all / selected artifacts in a module at on fewer fetches?

My current steps to translate and update each artifact are below:

1. Get artifact xml and etag for update.

method: "GET"
response:

<rdf:RDF
    xmlns:acp="http://jazz.net/ns/acp#"
    xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/"
    xmlns:jazz_rm="http://jazz.net/ns/rm#"
    xmlns:process="http://jazz.net/ns/process#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc_config="http://open-services.net/ns/config#"
    xmlns:oslc_rm="http://open-services.net/ns/rm#"
    xmlns:dng_task="http://jazz.net/ns/rm/dng/task#"
    xmlns:rm_property="https://almt.hella.com/rmT1/types/"
    xmlns:oslc_auto="http://open-services.net/ns/auto#" >
    <rdf:Description rdf:about="some resource URI here">
        <acp:accessControl rdf:resource="https://almt.hella.com/rmT1/accessControl/_4JyREGAKEe2sD5K_ycfyvw"/>
        <rm_property:AD_r1kfvXe6Ee6snvakaYJXeQ rdf:resource="https://almt.hella.com/rmT1/types/AT_r1CT7ne6Ee6snvakaYJXeQ#_r1C69ne6Ee6snvakaYJXeQ"/>
        <j.0:H_Toxic rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Issue: The requirement lacks constraints related to the specific actions to be taken when the light intensity is greater than 500 lumens for at least 3 seconds. Without additional details, this requirement may lead to major late changes in the design and implementation of the automatic mode system.</j.0:H_Toxic>
        <j.0:H_Quality rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Based on the INCOSE standard, the requirement is of high quality as it is specific, measurable, achievable, relevant, and time-bound.</j.0:H_Quality>
        <rm_property:AD_r1kftne6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rm_property:AD_r1kftne6Ee6snvakaYJXeQ>
        <dcterms:contributor rdf:resource="https://almt.hella.com/jts/users/phamth7"/>
        <rm_property:AD_r1kfwne6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rm_property:AD_r1kfwne6Ee6snvakaYJXeQ>
        <rm_property:AD_r1kfvHe6Ee6snvakaYJXeQ rdf:resource="https://almt.hella.com/rmT1/types/AT_r1EJE3e6Ee6snvakaYJXeQ#_r1EwIHe6Ee6snvakaYJXeQ"/>
        <rm_property:AD_r1kfrXe6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#string">None</rm_property:AD_r1kfrXe6Ee6snvakaYJXeQ>
        <rdf:type rdf:resource="http://jazz.net/ns/rm#Text"/>
        <oslc_config:component rdf:resource="https://almt.hella.com/rmT1/cm/component/_qMWe0He6Ee6snvakaYJXeQ"/>
        <oslc:instanceShape rdf:resource="https://almt.hella.com/rmT1/types/OT_r1lGgne6Ee6snvakaYJXeQ"/>
        <jazz_rm:primaryText rdf:parseType="Literal">
            <div xmlns="http://www.w3.org/1999/xhtml">
                <p dir="ltr" id="_1699760829964">In Automatic mode the light should go OFF, if the light intensity is greater than 500 lumens for at least 3 seconds.</p>
            </div>
        </jazz_rm:primaryText>
        <rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/>
        <dcterms:description rdf:parseType="Literal"></dcterms:description>
        <dcterms:title rdf:parseType="Literal">In Automatic mode the light should go OFF, if the light intensity is greater than 500 lumens for at least 3 seconds.</dcterms:title>
        <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">320436</dcterms:identifier>
        <dcterms:creator rdf:resource="https://almt.hella.com/jts/users/phamth7"/>
        <oslc:serviceProvider rdf:resource="https://almt.hella.com/rmT1/oslc_rm/_4JyREGAKEe2sD5K_ycfyvw/services.xml"/>
    </rdf:Description>
</rdf:RDF>

The second fetch, I added the defined entry "H_Translate" with the translation and PUT it with the same resource URL.
body:
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:acp="http://jazz.net/ns/acp#" xmlns:j.0="http://jazz.hella.com/rm/attributes#" xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/" xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/" xmlns:jazz_rm="http://jazz.net/ns/rm#" xmlns:acc="http://open-services.net/ns/core/acc#" xmlns:process="http://jazz.net/ns/process#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oslc="http://open-services.net/ns/core#" xmlns:nav="http://jazz.net/ns/rm/navigation#" xmlns:oslc_config="http://open-services.net/ns/config#" xmlns:oslc_rm="http://open-services.net/ns/rm#" xmlns:dng_task="http://jazz.net/ns/rm/dng/task#" xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/" xmlns:rm_property="https://almt.hella.com/rmT1/types/" xmlns:oslc_auto="http://open-services.net/ns/auto#"> 
    <rm_property:AD_r1kfvXe6Ee6snvakaYJXeQ rdf:resource="https://almt.hella.com/rmT1/types/AT_r1CT7ne6Ee6snvakaYJXeQ#_r1C69ne6Ee6snvakaYJXeQ"/>
    <j.0:H_Toxic rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Issue: The requirement lacks constraints related to the specific actions to be taken when the light intensity is greater than 500 lumens for at least 3 seconds. Without additional details, this requirement may lead to major late changes in the design and implementation of the automatic mode system.</j.0:H_Toxic>
    <j.0:H_Quality rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Based on the INCOSE standard, the requirement is of high quality as it is specific, measurable, achievable, relevant, and time-bound.</j.0:H_Quality>
    <rm_property:AD_r1kftne6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rm_property:AD_r1kftne6Ee6snvakaYJXeQ>
    <dcterms:contributor rdf:resource="https://almt.hella.com/jts/users/phamth7"/>
    <rm_property:AD_r1kfwne6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rm_property:AD_r1kfwne6Ee6snvakaYJXeQ>
    <rm_property:AD_r1kfvHe6Ee6snvakaYJXeQ rdf:resource="https://almt.hella.com/rmT1/types/AT_r1EJE3e6Ee6snvakaYJXeQ#_r1EwIHe6Ee6snvakaYJXeQ"/>
    <rm_property:AD_r1kfrXe6Ee6snvakaYJXeQ rdf:datatype="http://www.w3.org/2001/XMLSchema#string">None</rm_property:AD_r1kfrXe6Ee6snvakaYJXeQ>
    <rdf:type rdf:resource="http://jazz.net/ns/rm#Text"/>
    <oslc_config:component rdf:resource="https://almt.hella.com/rmT1/cm/component/_qMWe0He6Ee6snvakaYJXeQ"/>
    <oslc:instanceShape rdf:resource="https://almt.hella.com/rmT1/types/OT_r1lGgne6Ee6snvakaYJXeQ"/>
    <jazz_rm:primaryText rdf:parseType="Literal"><div xmlns="http://www.w3.org/1999/xhtml">
<p dir="ltr" id="_1699760829964">In Automatic mode the light should go OFF, if the light intensity is greater than 500 lumens for at least 3 seconds.</p>
</div></jazz_rm:primaryText>
    <rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/>
    <j.0:H_Translate rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
স্বয়ংক্ৰিয় মোডত পোহৰ বন্ধ হ'ব লাগে, যদি পোহৰৰ তীব্ৰতা কমেও 3 ছেকেণ্ডৰ বাবে 500 লুমেনতকৈ অধিক হয়।
</j.0:H_Translate>
    <dcterms:description rdf:parseType="Literal"/>
    <dcterms:title rdf:parseType="Literal">In Automatic mode the light should go OFF, if the light intensity is greater than 500 lumens for at least 3 seconds.</dcterms:title>
    <dcterms:creator rdf:resource="https://almt.hella.com/jts/users/phamth7"/>
  </rdf:Description>
</rdf:RDF>

Thanks for your support! =)))


One answer



permanent link
Ralph Schoon (63.3k33646) | answered Nov 23 '23, 2:30 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Since you perform all operations on the resource URI, I am not aware of any way to update multiple resources in one request in OSLC.


Comments
Nhan Pham commented Nov 23 '23, 3:08 a.m. | edited Nov 23 '23, 3:09 a.m.

 Hi Ralph, is there any alternative to the "resourceURI" that I can update mutliple resources?


Ralph Schoon commented Nov 23 '23, 3:36 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

OSLC works as OSLC works, not for OSLC as I am aware. 


Here the APIs we support: https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding

There is a module API, but I don't think that is to update the requirements content. There is a Client Extension API, but I have no experience with it. 


Nhan Pham commented Nov 23 '23, 3:50 a.m.

OK, I will take a look at the module API and the Client Extension one. Hopefully there's a robust solution to this.

Thanks Raph for your support

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.