ADS insert to named graphs

55 views
Skip to first unread message

Rob Atkinson

unread,
May 9, 2022, 2:57:44 AM5/9/22
to TopBraid Suite Users
Hi

trying to find examples to understand options for inserting into a named graph..

I have a situation where I need to process a graph and send data to multiple related graphs

ADS offers me the "withDataGraph" that calls a function with no parameters...

seems like it might be relevant to use that and update...

not sure  how I invoke the function I want to call with the parameters I need to send however?  

I can force access to a sparql endpoint as in

might work if all my data is a simply query/insert - in a parameterless function,  but I would like to have the option of manipulating data in ADS and potentially introducing external lookup, validation after transformation and/or human review activities. 

I probably want to use transaction() eventually if I encounter some error. 

What is available -- or if not what approach fits into the EDG architecture best?


Holger Knublauch

unread,
May 9, 2022, 3:06:36 AM5/9/22
to topbrai...@googlegroups.com

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.

Rob Atkinson

unread,
May 9, 2022, 3:21:28 AM5/9/22
to topbrai...@googlegroups.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?


_______________________________________________________
 
kind regards
Rob Atkinson
Lead Ontologist, Knowledge Architect at SURROUND Australia Pty Ltd
Address   Level 9, Nishi Building, 2 Phillip Law Street; New Acton Canberra Australia 2601
Phone     +61 419 202 973
Email      rob.at...@surroundaustralia.comWebsite   https://www.surroundaustralia.com

Enhancing Intelligence Within Organisations

delivering evidence that connects decisions to outcomes

Copyrights:

SURROUND Australia Pty Ltd is the copyright owner of all 
original content and attachments.
All rights reserved. 
Confidentiality Notice:
The contents of this e-mail are confidential to the ordinary user 
of the e-mail address to which it is addressed, and may also be 
privileged. If you are not the addressee of this e-mail, you may 
not copy, forward, disclose, or otherwise use it or any part of it 
or its attachments in any form whatsoever. If you have received 
this e-mail in error, please e-mail the sender by replying to this 
message.



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.

Holger Knublauch

unread,
May 9, 2022, 3:28:10 AM5/9/22
to topbrai...@googlegroups.com


On 2022-05-09 5:21 pm, Rob Atkinson wrote:
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


Reply all
Reply to author
Forward
0 new messages