As part of a custom workflow, we want to create an entry script for the 
"Frozen for Review" status that queries the graph for any instances missing 
an rdfs:label, then adds a new rdfs:label triple for each of these 
instances with an auto-generated label. We want our SMEs to be able to 
review the auto-generated labels before committing to production.

I have created a Web Service that successfully does this with the following 
code (exact query removed as it is kind of long):

const rdfsLabel = graph.node({"qname": "rdfs:label"});
const currentGraph = teamwork.currentMasterGraph();

let noLabels = graph.select(`SELECT * WHERE { <QUERY BODY HERE> }`);
let results = noLabels.bindings;
let labels = {}
for (var i = 0; i < results.length; i++) {
let r = results[i];
let instance = r["s"]["uri"];

// some code to build a label goes here

let label = `<AUTO GENERATED LABEL HERE>`
labels[instance] = label;
graph.transaction(currentGraph, "Adding new label", () => {
graph.add(graph.node({"uri": instance}), rdfsLabel, graph.node(label));
});
}
labels;

I tried to tweak this to work for the dash:js of our 
WorkflowStatusEntryScript, but I can't figure out the "currentGraph" to 
query and use in the transaction. I know I can get the workflow tag, but 
that results in an error if I try to use it as the graph ID:

org.topbraidlive.script.js.JSException: Unknown named graph 
urn:x-tags:cir_workflow___rebecca_jackson_on_2024_jan_3_16_28_15 

.. and if I just query the master graph, it will not return results that 
have been added in the workflow. Thanks in advance for any help!

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to [email protected]
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/a9048189-dd2a-4369-839c-31723542df8an%40googlegroups.com.

Reply via email to