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!