ahh the typecast!

_______________________________________________________

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     + <http://++61+466+491+056/>61 419 202 973
Email      [email protected]
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.



On Wed, 11 May 2022 at 16:27, Holger Knublauch <[email protected]>
wrote:

> Works for me, for any instance of owl_Ontology - not the class itself:
>
> Holger
>
>
> On 2022-05-11 11:39 am, Rob Atkinson wrote:
>
> yes
>
> but this fails when I throw it into the script editor (i'm in a data graph
> - i dont have an ontology asset collection for the OWL ontology )
>
> class extends owl_Ontology {
>     createDeltas() {
>         return ('worked')
>     }
> }
>
> owl_Ontology.createDeltas() ;
>
> =>
>
> "Cannot evaluate Script: org.graalvm.polyglot.PolyglotException:
> SyntaxError: ADSGenerated-3f177094-235f-4d67-9ac8-fef60e3b2cc9.js:3605:0
> Expected { but found } } ^"
>
>
> On Wednesday, May 11, 2022 at 11:31:22 AM UTC+10 Holger Knublauch wrote:
>
>> Did you see this
>>
>>
>> https://www.topquadrant.com/doc/7.2/scripting/introduction.html#shape-scripts
>>
>> Holger
>>
>>
>> On 2022-05-11 11:09 am, Rob Atkinson wrote:
>>
>> ahh - its dash:shapeScript - but requires a different syntax - maybe
>> thats what it is hiding as an error when run as a resource script...
>>
>>
>> On Wednesday, May 11, 2022 at 11:05:35 AM UTC+10 Rob Atkinson wrote:
>>
>>> oops - obviously dash:ShapeScript is a type not a predicate - i've got
>>> myself mixed up here...  how do you attach to the nodeshape?  The predicate
>>> isnt in the docs AFAICT
>>>
>>> On Wednesday, May 11, 2022 at 10:39:53 AM UTC+10 Rob Atkinson wrote:
>>>
>>>>
>>>> Am not using the focus node - as its an action on the graph as a whole
>>>> (attached to ontology as per suggestion in documents)
>>>>
>>>> am using let thing =
>>>>
>>>> I can try another level of wrapping - I was only able to make functions
>>>> visible globally using *.api.ttl   -
>>>>
>>>>  if I declare the functions as dash:IncludedScript they fail to find
>>>> the global helper functions I declared in a *.api.ttl file.   Importing
>>>> this function set graph into the resource script graph didnt help:
>>>>
>>>> threw "ReferenceError: "dgf" is not defined"   (dgf. is defined and can
>>>> access its functions via SPARQL and script editor)
>>>>
>>>> The only reference to ShapeScript I could find searching the 7.2
>>>> documentation was
>>>>
>>>> "On saving, EDG will automatically create an instance of type dash:
>>>> ShapeScript which is attached to the selected node shape. This will
>>>> ensure that the next time the node shape is selected, the defined function
>>>> is shown in the shape script panel."
>>>>
>>>> So to attach it to the ontology to test that way I would declare
>>>>
>>>>    owl:Ontology dash:ShapeScript my:action
>>>>
>>>> instead of
>>>>     owl:Ontology  dash:resourceAction my:action
>>>>
>>>> ?
>>>>
>>>>
>>>>
>>>>
>>>> On Wednesday, May 11, 2022 at 10:17:37 AM UTC+10 Holger Knublauch wrote:
>>>>
>>>>>
>>>>> On 2022-05-11 9:56 am, Rob Atkinson wrote:
>>>>> > HI I have a script that behaves as expected in the script  editor
>>>>> but
>>>>> > when run as a resource action behaves differently.
>>>>> >
>>>>> > two things
>>>>> >
>>>>> >  - a script that extracts some data from an asset collection and
>>>>> then
>>>>> > inserts it into a different asset collection works from the script
>>>>> > editor, but when run as a resource action doesnt complain or  but
>>>>> the
>>>>> > data doesnt show up in the target graph. (The function is tagged as
>>>>> > dash:canWrite true BTW)
>>>>> One potential difference could be the type of the variable focusNode.
>>>>> Are you using that variable in your scripts?
>>>>> >
>>>>> > and  simpler case I noticed:
>>>>> >
>>>>> > script  assigns a string to a variable using
>>>>> >
>>>>> > thing = `string template`
>>>>> >
>>>>> > when I run console.log(thing) in the script editor it shows, as
>>>>> expected:
>>>>> > "string template"
>>>>> >
>>>>> > but when I run this same code in an ADS resource action it renders
>>>>> it as
>>>>> > "[Object object]"
>>>>> Hard to say without seeing the surrounding code. But just doing thing
>>>>> =
>>>>> ... may be a variable scope problem. Have you tried using *let* thing
>>>>> =
>>>>> ... instead, to make sure the variable is locally scoped?
>>>>> >
>>>>> >
>>>>> > And finally:
>>>>> >  - is there a way of invoking the resource action directly from the
>>>>> > script editor
>>>>>
>>>>> No but you could place the body of the resource action into a helper
>>>>> function with a globally unique name and put that into a
>>>>> dash:IncludedScript. For example
>>>>>
>>>>> function myResourceAction(resource) { ... }
>>>>>
>>>>> and then invoke myResourceAction(resource) from the Script Editor
>>>>> panel.
>>>>> Or attach it to a class as a ShapeScript if you prefer OO programming
>>>>> style.
>>>>>
>>>>> >  - is there any way of using the script debugger from a resource
>>>>> > action, commit or other trigger ?
>>>>>
>>>>> No, this would be nice but quite hard to implement and get right. You
>>>>> can imagine that running the debugger is already quite a low-level
>>>>> operation... But maybe the above trick will help you debug this from
>>>>> the
>>>>> Script Panel. All you may want to add are some guard clauses to verify
>>>>> that the argument (resource/focusNode) have indeed the right type.
>>>>>
>>>>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/topbraid-users/efb42514-2b48-40d2-8e06-4a6479eaaf65n%40googlegroups.com
>> <https://groups.google.com/d/msgid/topbraid-users/efb42514-2b48-40d2-8e06-4a6479eaaf65n%40googlegroups.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/9d7f25f9-ea87-4503-b4c2-33623e58141en%40googlegroups.com
> <https://groups.google.com/d/msgid/topbraid-users/9d7f25f9-ea87-4503-b4c2-33623e58141en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> 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/wgR411uTzUM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/topbraid-users/34358f3c-5311-d7a5-8d10-4986ad7c5480%40topquadrant.com
> <https://groups.google.com/d/msgid/topbraid-users/34358f3c-5311-d7a5-8d10-4986ad7c5480%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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/CAOBWeKtAbsLq4oavifOrceXvt%3DWg78_tXP6UZMLOxHLh8G8zhg%40mail.gmail.com.

Reply via email to