Accessing and mutating data in a workflow via ADS

42 views
Skip to first unread message

Bernd Johannes

unread,
Feb 4, 2025, 3:12:26 AMFeb 4
to TopBraid Suite Users
Hello everybody,
I struggle to find the right sequence of actions to select a workflow and mutate data within via ADS.

I would appreciate a solution template, that documents the relevant steps.

The situation:
in ontology M there is a modify action bound to owl:Ontology that should:

- select ontology A 
- select a specific workflow T in that ontology A.
- then add and remove some triples in that workflow (so that it gets part of the workflow changes - no direct write to the underlying ontology A)

I am aware about the data structure in the teamgraph and have no problems to solve the problem in SPARQL - however SPARQL does not allow me to write into the workflow - only to the underlying ontology A directly.

I read, that I also should not use graph.transaction(<target>, ...) where I could provide A->T as <target> resource, as this bypasses the workflows.

Is there a solution pattern?

Thanks for your suggestions.
Greetings
Bernd



Holger Knublauch

unread,
Feb 4, 2025, 3:38:53 AMFeb 4
to 'Luis Enrique Ramos García' via TopBraid Suite Users
Hi Bernd,

to add or remove triples, don't go directly through the TCH graph. That's too error prone and it's much simpler to do this

let workflowGraph = tbs.queryGraph('workflow_1');
graph.transaction(workflowGraph, 'Adding a triple', () => {
owl.Thing.add(rdfs.seeAlso, owl.Nothing);
});

Which will create the added triple in the given workflow and record it properly in the change history.

Does this give you enough clues to proceed?

Holger


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.com
---
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 topbraid-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/topbraid-users/f200a66f-46f1-436c-9eae-cda108c45f63n%40googlegroups.com.

Bernd Johannes

unread,
Feb 4, 2025, 5:29:03 AMFeb 4
to TopBraid Suite Users
Hi Holger,
many thanks for the quick reply - I assume 'workflow_1' is the ID / Tag of the workflow?

Anyway - I have now the required pointer which I was missing: tbs.queryGraph() shall provide me with the right graph to send transactions to via graph.transaction().

Splendid!
Greetings
Bernd

Bernd Johannes

unread,
Feb 13, 2025, 8:22:54 AMFeb 13
to TopBraid Suite Users
Hello Holger,
I still got a problem in implementing that. The gist of the code is:

data = graph.select(somequery); // returns s p o resultset
target = tbs.queryGraph(WorkflowID);
graph.transaction(target, "transfer", ()=>{
data.bindings.forEach(t => {
     graph.add(t.s, t.p, t.o);
  })
})

The problem: nothing gets added to the workflow (neither in the history, nor in the actual graph).
There are no errors returned nor log entries in EDG log that would point to any problems.
I also made sure, that the user executing the code has appropriate roles assigned as needed for the workflow.

When I exchange the target above against the underlying mastergraph of the workflow, the code runs as expected and transfers the triples into the mastergraph (without change history entry).

Do I miss something obvious here?

Thanks for suggestions
Greetings
Bernd

Holger Knublauch

unread,
Feb 13, 2025, 10:11:46 AMFeb 13
to topbrai...@googlegroups.com
I see nothing obviously wrong with this. To debug it, could you run the same query from the Script Editor panel, and also perhaps sprinkle in some console.log debug code to see whether it’s behaving as expected? (In newer versions you can set a breakpoint on such scripts and debug them with the Script Debugger from Studio).

Holger


Reply all
Reply to author
Forward
0 new messages