Hi Rob,
you'll need 7.2 for this, using graph.transaction. Example:
let result =
graph.withDataGraph('http://uri.of.example.graph/toUpdate', 'Some
log message', () => {
owl.Thing.add(rdfs.comment, 'Added this comment');
return 'whatever';
});
This will switch to the first argument as the active graph for the transaction. The second argument can be a log message for the change history. The 3rd argument is the callback function which is the body of the transaction. Here you have the new active graph and can add or delete triples etc. You could also check constraints and decide not to proceed by throwing an exception, i.e. not committing the transaction.
Prior to 7.1 graph.withDataGraph *probably* worked somehow, but
that would be a hack and wouldn't properly support transactions
etc.
Holger
--
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 on the web visit https://groups.google.com/d/msgid/topbraid-users/3868b242-d714-4a4c-a837-03a6ad7061d4n%40googlegroups.com.
_______________________________________________________
|
You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/YvSvV4uR5gk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/73f52167-ede7-4a7c-0344-64f9653e9982%40topquadrant.com.
OK - am on 7.2
I see how that works - for a static function.
If I have a complex function I want to send parameters to, do I wrap that target function in an anonymous function that passes the parameters I want?
In JavaScript, inner functions can see the variables declared outside, e.g.
let x= 42;
graph.transaction('...', '...', () => {
owl.Thing.add(rdfs.seeAlso, x); // x is in scope
})
should work.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAOBWeKtWnEHJwG-cRhgnJ8aB2R20dSwPOwfVhVAAsB435oEySw%40mail.gmail.com.