I tried the provided example but it still populates the subClasses even 
after adding in the sh:node for the parameter. Any other thoughts on what I 
need to add to prevent the subClasses from populating in the widget?

ex:Concept-map
  a sh:Parameter ;
  sh:path ex:conceptMap ;
  sh:class ex:Concept ;
  sh:name "Concept Map" ;
  sh:node [
      sh:property [
          sh:path rdf:type ;
          sh:hasValue ex:Concept ;
        ] ;
    ] ;
.


On Monday, March 25, 2024 at 12:30:44 PM UTC-6 Holger Knublauch wrote:

>
> On 25 Mar 2024, at 5:23 PM, Marie Valadez <meval...@gmail.com> wrote:
>
> Thanks Holger! That worked for my use case. Appreciate the help. 
> Is there a way to use sh:class to only populate instances of the root 
> class instead of also populating ones that are a subclass? So for instance, 
> if I want to only retrieve instances of Concept but not instances of the 
> subClass say ex:ChildConcept. 
>
>
> Yes, to do that, you need to combine sh:class with a sh:node constraint as 
> follows:
>
> ex:MyClass-myProperty    # or myParameter
>     a sh:PropertyShape ;    # or sh:Parameter
>     sh:path ex:myProperty ;
>     sh:class skos:Concept ;
>     sh:node [
>         sh:property [
>             sh:path rdf:type ;
>             sh:hasValue skos:Concept ;
>         ] ;
>     ] .
>
> This works because our auto-complete widget checks if there is a sh:node 
> constraint on the property. If so, then it will filter all auto-completed 
> value and drop those that do not conform to the given sh:node shape. In 
> this case here, the constraint ensures that all values have skos:Concept as 
> one of its values for rdf:type. This does not apply to subclasses.
>
> Holger
>
>
>
> On Saturday, March 23, 2024 at 4:27:20 AM UTC-6 Holger Knublauch wrote:
>
>>
>> On 22 Mar 2024, at 8:14 PM, Marie Valadez <meval...@gmail.com> wrote:
>>
>> Hi Holger, 
>>
>> Thank you for the advice. I was able to use that workaround to get it to 
>> add the blank node with the class dropdowns for the parameters in the 
>> Ontology. It did take some time for it to register and recognize it. 
>>
>> I am now stuck on the dash:jsCondition. I am using your example from 
>> above. When I go to the Data Graph to apply the Batch Action on something 
>> that is not an instanceOf the class specified, it still allow me to. So for 
>> instance if I chose several Concept, Descriptions to apply the batch action 
>> to and have it where the condition is "focusNodes.every(node => 
>> node.instanceOf(ex.Concept))", I can still add it to description. I checked 
>> the log and says "Caught and gracefully handled exception during ADS script 
>> execution
>> org.topbraidlive.script.js.JSException: ReferenceError: ex is not 
>> defined". Is there something I am missing to get the Data Graph to 
>> ackowledge the prefix for Concept? I tried adding the 
>> dash:generatePrefixClasses there as well just in case, but that did not 
>> work either.
>>
>>
>> To be on the safe side w.r.t. these prefix constants, try replacing it 
>> with the full URI, e.g. 
>>
>> node.instanceOf(graph.namedNode('http://example.org/Concept'))
>>
>> Holger
>>
>>
>> On Friday, March 22, 2024 at 3:46:46 AM UTC-6 Holger Knublauch wrote:
>>
>>> Hi Marie,
>>>
>>> thanks for those details. I believe I was able to reproduce the same 
>>> scenario. It happens when the sh:class of a parameter points at a class 
>>> that isn't covered by the ADS code generation. I have just made this code 
>>> more resilient for 8.0 but in the meantime I think the following 
>>> work-around should allow you to proceed:
>>>
>>> 1) On the Script API tab of the Home asset of the collection/file that 
>>> defines the batch action, add "ex" to "generate prefix classes". In my 
>>> example this produces a triple such as dash:generatePrefixClasses "ex" ;
>>>
>>> 2) On the Script Editor make sure to press Refresh so that the API gets 
>>> rebuilt. This should produce a JS class such as ex_Category.
>>>
>>> 3) Reload the browser where this action is used and it should hopefully 
>>> work.
>>>
>>> Please let me know if this doesn't work.
>>>
>>> Thanks,
>>> Holger
>>>
>>>
>>> On 21 Mar 2024, at 10:13 PM, Marie Valadez <meval...@gmail.com> wrote:
>>>
>>> I am trying to take in a parameter from the user that can be used as the 
>>> object. In this example it would be for the category. I added the parameter 
>>> like below, but I keep getting the error "Not a JSON string". I want to be 
>>> able to get a drop down where the user selects the category and then it is 
>>> added as the triple. I am able to populate the drop down but it keeps 
>>> giving an error when selecting "Okay" to add the triple. My potential use 
>>> case is actually use this to bulk add a blank node but first trying to get 
>>> the parameter part working first and resolve the "Not a JSON string". 
>>>
>>> dashjs: """focusNodes.forEach(node => node.add(graph.node({qname: 
>>> "ex:category"}), graph.node(category)))""";
>>> sh:parameter ex:Concept-categoryParameter
>>>
>>> ex:Concept-categoryParameter
>>>  a sh:Parameter;
>>> sh:path ex:category ;
>>> sh:class ex:Category ;
>>> sh:name "category" ; 
>>> sh:nodeKind sh:IRI ;
>>> sh:description "Concept Category" ;
>>> .
>>>
>>>
>>>
>>>
>>> On Monday, March 18, 2024 at 4:04:46 PM UTC-6 Marie Valadez wrote:
>>>
>>>> Hello Holger,
>>>>
>>>> I am looking into BatchActions and only seemed to find a snippet in the 
>>>> documentation where it says it is the similar to 
>>>> dash:ModifyActions/dash:ExploreActions (
>>>> https://archive.topquadrant.com/doc/7.8/scripting/actions.html?highlight=batchaction).
>>>>  
>>>> I have a dash:ModifyActions instance that works, but tried to implement a 
>>>> similar case for dash:BatchAction to see if I can essentially take the 
>>>> action from dash:ModifyActions and apply it to multiple instances. 
>>>> However, 
>>>> I don't seem to even find it populating under the Batch Actions Menu. I am 
>>>> trying to test it out in EDG Studio version 7.8. Is there something I am 
>>>> missing with how to implement??
>>>>
>>>> Here is an example of the script:
>>>>
>>>> ex:Concept
>>>>   a owl:Class ;
>>>>   a sh:NodeShape ;
>>>>   dash:resourceAction exsh:CategoryBatchAction ;
>>>> ...
>>>>
>>>> exsh:CategoryBatchAction
>>>>   a dash:BatchAction ;
>>>>   dash:actionGroup exsh:CategoryActionGroup ;
>>>>   dash:actionIconClass "fas fa-plus" ;
>>>>   dash:canWrite true ;
>>>>   dash:js """
>>>>           focusNode.add(graph.node({qname: "ex:category"}), 
>>>> graph.node({qname: "ex_graph:_123"}))""" ;
>>>>   rdfs:comment "Add `example category to the concept" ;
>>>>   rdfs:label "Example Category Batch Action" ;
>>>>   sh:order 0 ;
>>>> ...
>>>>
>>>
>>> -- 
>>> 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 on the web visit 
>>> https://groups.google.com/d/msgid/topbraid-users/07d898d5-c816-4e61-9289-e0444833e3een%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/topbraid-users/07d898d5-c816-4e61-9289-e0444833e3een%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>>
>>>
>> -- 
>> 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 on the web visit 
>> https://groups.google.com/d/msgid/topbraid-users/be758f08-76ae-4837-b374-43389908518fn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/topbraid-users/be758f08-76ae-4837-b374-43389908518fn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
>>
> -- 
> 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 on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/ae29350e-887f-49a7-887d-29437b2998f8n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/ae29350e-887f-49a7-887d-29437b2998f8n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
The topics of this mailing list include TopBraid EDG and related technologies 
such as SHACL.
To post to this group, send email to topbraid-users@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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/7785892d-d4e1-4171-9980-f0eba9d1d2a0n%40googlegroups.com.

Reply via email to