> On 4 Apr 2021, at 3:05 am, Steve Ray <[email protected]> wrote:
> 
> Thanks for your always informative help. I did get this to work, only to 
> realize that I now have a web service that will update the graph living in 
> the EDG database, but not a web service that will update the Turtle file on 
> my local machine, which is ultimately my goal.

ADS scripts are designed to operate on the graph variable, which by default is 
the graph in the EDG database that the service is called for. While there is a 
way to temporarily switch to other graphs via graph.withDataGraph(), the focus 
of the design has been to operate on EDG graphs. For example, performing 
updates assumes that the changes go into the database without also having to 
save a file.

I don’t have enough background to give you sound advice here, but you may know 
that in 7.0 EDG is able to directly “open” files from your workspace, edit them 
and save them back. See the Files item in the main menu on the left hand side 
to get started. The workflow there is that “open” will create a local copy in 
the EDG database, and that graph is then under the usual control of EDG, with a 
urn:x-evn-master:XY URI. So if you have a bunch of files that you want to 
manage with EDG, you can now “open" them, execute scripts on them and then 
occasionally save them back to their original files. The ADS API doesn’t have a 
built-in convenience method to perform this save step, but it can be reliably 
called from ADS via graph.swp() and the SWP module teamwork:saveFileProject. I 
can provide details if needed.

Maybe you can explain the bigger picture though before we go down that route.

> 
> So, I have learned about dash:GraphService and dash:ResourceService, and now 
> am starting to learn about dash:ModifyAction as something I may need to use. 
> However, is ModifyAction designed more for creating ui actions in EDG?

The types dash:ModifyAction and dash:ExploreAction are used to define UI 
extensions, i.e. items that will appear in the Modify or Explore menus of EDG. 
Scripts may be both dash:ResourceServices and dash:XYActions, for cases where 
the same feature should be available manually and programmatically.

> Should I just be using dash:GraphService and use a call to 
> graph.uploadedFile? If so, after modifying the graph, is there some sort of 
> graph.saveFile (which I cannot find).

> Also, why is graph.uploadedFile crossed out in the script editor pull-down?
> <image.png>

That function has been marked deprecated in 7.0 because we have moved it into 
its own class: IO.uploadedFile()

> 
> I'm hoping these questions are of general interest. Basically I'm trying to 
> use web services to maintain local files, and I call these web services from 
> shell scripts. That's how we publish all our web pages.

Let’s see if this is the right technology for this particular job…

Holger


> 
> Steve
> 
> 
> 
> 
> On Thu, Apr 1, 2021 at 9:11 PM Holger Knublauch <[email protected] 
> <mailto:[email protected]>> wrote:
> Hi Steve,
> 
>> On 1 Apr 2021, at 10:26 am, Steve Ray <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> Hi, I have a question about accomplishing the above.
>> 
>> 1. How do I make my graph not a "read-only" graph?
>> <image.png>
> 
> The Script Editor panel has an unlock button/setting in the upper right 
> corner. This toggles between read-only and writable APIs. The writable APIs 
> have additional functions etc.
> 
>> I have set "Enable SPARQL updates" to true in Server Configuration.
>> The graph in question is the focus graph in my local EDG.
>> I have ensured Administrator is listed as both Manager and Editor for the 
>> graph in EDG Permissions Management.
>> I am using the default settings in Rights Management
>> 
>> Here's the code I'm trying to run in the Script Editor:
>> graph.update(`DELETE {
>>     ?qk qudt:applicableUnit ?unit .
>> }
>> INSERT {
>>     ?newqk qudt:applicableUnit ?newunit .
>> }
>> WHERE {
>> {
>>     ?qk a qudt:QuantityKind .
>>     ?qk qudt:applicableUnit ?unit .
>> }
>> UNION
>> {
>>     ?newqk a qudt:QuantityKind .
>>     ?newqk qudt:inferredApplicableUnit ?newunit .
>> } .
>> } `)
>> 
>> I get the same error when invoking the service from a web browser:
>> 
>> http://localhost:8083/tbl/service/qudt_quantitykind/qudt/refreshApplicableUnits
>>  
>> <http://localhost:8083/tbl/service/qudt_quantitykind/qudt/refreshApplicableUnits>
>> 
>> yields:
>> 
>> Cannot evaluate Script:org.topbraid.core.servlet.HttpErrorException: Failed 
>> service request /qudt_quantitykind/qudt/refreshApplicableUnits: Attempt to 
>> change a read-only graph rejected
>> 
>> Here's my service definition code:
>> qudt:refreshApplicableUnits
>>   rdf:type dash:GraphService ;
>>   dash:js """graph.update(`
>> DELETE {
>>     ?qk qudt:applicableUnit ?unit .
>> }
>> INSERT {
>>     ?newqk qudt:applicableUnit ?newunit .
>> }
>> WHERE {
>> {
>>     ?qk a qudt:QuantityKind .
>>     ?qk qudt:applicableUnit ?unit .
>> }
>> UNION
>> {
>>     ?newqk a qudt:QuantityKind .
>>     ?newqk qudt:inferredApplicableUnit ?newunit .
>> } .
>> } 
>> `)
>> """ ;
>>   dash:responseContentType "void" ;
>>   rdfs:label "Refresh the applicableUnits property" ;
>> .
> To enable updates, add dash:canWrite true.
> 
> Holger
> 
> 
>> 
>> There must be a setting I'm missing!
>> Thanks in advance for your help.
>> 
>> Steve
>> 
>> 
>> 
>> -- 
>> 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] 
>> <mailto:[email protected]>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/topbraid-users/CAGUep84svBqwK9G7545srJ5FziguTvK3JhUuUN8ztVgi5ZOkug%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/CAGUep84svBqwK9G7545srJ5FziguTvK3JhUuUN8ztVgi5ZOkug%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> 
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/DB84CB8F-AC83-4C31-8537-AD0E4C600B03%40topquadrant.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/DB84CB8F-AC83-4C31-8537-AD0E4C600B03%40topquadrant.com?utm_medium=email&utm_source=footer>.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/CAGUep84xVf6xq0ngAQgE%2B9PBNSkp-Xv4EUR8UD5_z6yAbO2Pbg%40mail.gmail.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/CAGUep84xVf6xq0ngAQgE%2B9PBNSkp-Xv4EUR8UD5_z6yAbO2Pbg%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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/FEEFF5EF-453E-41BC-8CD3-CEB67F02DC89%40topquadrant.com.

Reply via email to