Re: [topbraid-users] enum creation

2024-04-18 Thread Holger Knublauch
So what do you see in edit mode? Can you share a screenshot?

Holger


> On 18 Apr 2024, at 3:56 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> When I edit TrafficColor I do not see anything new,
> 
> Luis
> 
> El jue, 18 abr 2024 a las 15:46, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 18 Apr 2024, at 3:41 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> Holger,
>>> 
>>> I think I did the recommended change:
>>> 
>>> tesontologyramosenum:TrafficLight
>>>   a owl:Class ;
>>>   a sh:NodeShape ;
>>>   rdfs:label "TrafficLight" ;
>>>   rdfs:subClassOf owl:Thing ;
>>>   sh:property tesontologyramosenum:TrafficLight-color ;
>>> .
>>> tesontologyramosenum:TrafficLight-color
>>>   a sh:PropertyShape ;
>>>   sh:path tesontologyramosenum:color ;
>>>   sh:class tesontologyramosenum:Color ;
>>>   sh:name "color" ;
>>>   sh:nodeKind sh:IRI ;
>>> 
>>> 
>>> But, when I create a trafficlight1 instance, I still have the same view, 
>>> the color property is present, however it is blank, no colors:
>> 
>> New instances will not have a default value for it, but what happens when 
>> you switch to edit mode? Don't you see a drop down for colors when you add a 
>> new value/row?
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> So, I am still not able to find out where the problem is..
>>> 
>>> 
>>> Luis Ramos
>>> 
>>> 
>>> El jue, 18 abr 2024 a las 8:22, Holger Knublauch (>> >) escribió:
 
 
> On 18 Apr 2024, at 7:52 AM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> Hi Holger,
> 
> good morning,
> 
> Unfortunately it is not the case, and I can not see the options in the 
> editor.
> 
> The code of the traffic light class and color property are:
> 
> tesontologyramosenum:TrafficLight
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "TrafficLight" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:property tesontologyramosenum:TrafficLight-color ;
> .
> tesontologyramosenum:TrafficLight-color
>   a sh:PropertyShape ;
>   sh:path tesontologyramosenum:color ;
>   sh:name "color" ;
>   sh:node tesontologyramosenum:Color ;
>   sh:nodeKind sh:IRI ;
 
 Replace the sh:node with:
 
sh:class tesontologyramosenum:Color ;
 
 as sh:node is not enough to tell the system which values can be selected.
 
 Holger
 
 
 
> .
> and when I create an instance of traffic light, this is what I see:
> 
> 
> Thus, I wonder what I am doing wrong?.
> 
> 
> best regards
> 
> 
> Luis Ramos
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 16:46, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 3:55 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> it works now in this ontology,
>>> 
>>> now, if I want to add a color in any instance (for testing purpose),
>>> it is only by modifying the code?, like this?:
>> 
>> If you have properly declared the color property then you should be able 
>> to select values from the form, not just source code.
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> That is moreless the expected result on my end.
>>> 
>>> 
>>> Thanks,
>>> 
>>> 
>>> Luis
>>> 
>>> El mié, 17 abr 2024 a las 15:37, Holger Knublauch 
>>> (mailto:hol...@topquadrant.com>>) escribió:
 Yes that looks right. To use it in traffic lights, just declare a 
 color property there which has sh:class :Color.
 
 Holger
 
 
> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> sure,
> 
> I created a similar ontology for testing with same results, here is 
> the code:
> 
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
> 
> the screen shot is this:
> 
> 
> 
> 
> with similar results, a datatype property without labeling, and a 
> group of undeclared properties.
> 
> Is this the expected result?
> 
> How do I use this in traffic light 

Re: [topbraid-users] enum creation

2024-04-18 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
When I edit TrafficColor I do not see anything new,

Luis

El jue, 18 abr 2024 a las 15:46, Holger Knublauch ()
escribió:

>
>
> On 18 Apr 2024, at 3:41 PM, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> Holger,
>
> I think I did the recommended change:
>
> tesontologyramosenum:TrafficLight
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "TrafficLight" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:property tesontologyramosenum:TrafficLight-color ;
> .
> tesontologyramosenum:TrafficLight-color
>   a sh:PropertyShape ;
>   sh:path tesontologyramosenum:color ;
>   sh:class tesontologyramosenum:Color ;
>   sh:name "color" ;
>   sh:nodeKind sh:IRI ;
>
>
> But, when I create a trafficlight1 instance, I still have the same view,
> the color property is present, however it is blank, no colors:
>
>
> New instances will not have a default value for it, but what happens when
> you switch to edit mode? Don't you see a drop down for colors when you add
> a new value/row?
>
> Holger
>
>
>
> 
> So, I am still not able to find out where the problem is..
>
>
> Luis Ramos
>
>
> El jue, 18 abr 2024 a las 8:22, Holger Knublauch ()
> escribió:
>
>>
>>
>> On 18 Apr 2024, at 7:52 AM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> Hi Holger,
>>
>> good morning,
>>
>> Unfortunately it is not the case, and I can not see the options in the
>> editor.
>>
>> The code of the traffic light class and color property are:
>>
>> tesontologyramosenum:TrafficLight
>>   a owl:Class ;
>>   a sh:NodeShape ;
>>   rdfs:label "TrafficLight" ;
>>   rdfs:subClassOf owl:Thing ;
>>   sh:property tesontologyramosenum:TrafficLight-color ;
>> .
>> tesontologyramosenum:TrafficLight-color
>>   a sh:PropertyShape ;
>>   sh:path tesontologyramosenum:color ;
>>   sh:name "color" ;
>>   sh:node tesontologyramosenum:Color ;
>>   sh:nodeKind sh:IRI ;
>>
>>
>> Replace the sh:node with:
>>
>>sh:class tesontologyramosenum:Color ;
>>
>> as sh:node is not enough to tell the system which values can be selected.
>>
>> Holger
>>
>>
>>
>> .
>> and when I create an instance of traffic light, this is what I see:
>>
>> 
>> Thus, I wonder what I am doing wrong?.
>>
>>
>> best regards
>>
>>
>> Luis Ramos
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> El mié, 17 abr 2024 a las 16:46, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>>
>>>
>>> On 17 Apr 2024, at 3:55 PM, 'Luis Enrique Ramos García' via TopBraid
>>> Suite Users  wrote:
>>>
>>> it works now in this ontology,
>>>
>>> now, if I want to add a color in any instance (for testing purpose),
>>> it is only by modifying the code?, like this?:
>>>
>>>
>>> If you have properly declared the color property then you should be able
>>> to select values from the form, not just source code.
>>>
>>> Holger
>>>
>>>
>>>
>>> 
>>> That is moreless the expected result on my end.
>>>
>>>
>>> Thanks,
>>>
>>>
>>> Luis
>>>
>>> El mié, 17 abr 2024 a las 15:37, Holger Knublauch (<
>>> hol...@topquadrant.com>) escribió:
>>>
 Yes that looks right. To use it in traffic lights, just declare a color
 property there which has sh:class :Color.

 Holger


 On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid
 Suite Users  wrote:

 sure,

 I created a similar ontology for testing with same results, here is the
 code:

 tesontologyramosenum:Color
   a owl:Class ;
   a sh:NodeShape ;
   rdfs:label "Color" ;
   rdfs:subClassOf owl:Thing ;
   sh:in (
   tesontologyramosenum:Green
   tesontologyramosenum:Yellow
   tesontologyramosenum:Red
 ) ;
   sh:property tesontologyramosenum:Color-label ;
 .

 the screen shot is this:

 
 

 with similar results, a datatype property without labeling, and a group
 of undeclared properties.

 Is this the expected result?

 How do I use this in traffic light instances, if that were the case?


 Luis

















 El mié, 17 abr 2024 a las 14:41, Holger Knublauch (<
 hol...@topquadrant.com>) escribió:

> Can you paste us the complete content of the source code panel, e.g.
> as a screenshot? It's hard to see otherwise and there are syntax errors
> below.
>
> Holger
>
>
> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid
> Suite Users  wrote:
>
> I need only 3 elements in the enum,
>
> But, I tried at the first the source code edition, and told you the
> result I got:
>
>
> **
>
> 1. I tried to add the code by myself, but it seems there is something
> wrong with the code:
> sh:in (
>   myontology:value1
>myontology _:value2
>   myontology :value3
> ) ;
> 

Re: [topbraid-users] enum creation

2024-04-18 Thread Holger Knublauch


> On 18 Apr 2024, at 3:41 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> Holger,
> 
> I think I did the recommended change:
> 
> tesontologyramosenum:TrafficLight
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "TrafficLight" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:property tesontologyramosenum:TrafficLight-color ;
> .
> tesontologyramosenum:TrafficLight-color
>   a sh:PropertyShape ;
>   sh:path tesontologyramosenum:color ;
>   sh:class tesontologyramosenum:Color ;
>   sh:name "color" ;
>   sh:nodeKind sh:IRI ;
> 
> 
> But, when I create a trafficlight1 instance, I still have the same view, the 
> color property is present, however it is blank, no colors:

New instances will not have a default value for it, but what happens when you 
switch to edit mode? Don't you see a drop down for colors when you add a new 
value/row?

Holger


> 
> 
> So, I am still not able to find out where the problem is..
> 
> 
> Luis Ramos
> 
> 
> El jue, 18 abr 2024 a las 8:22, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 18 Apr 2024, at 7:52 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> Hi Holger,
>>> 
>>> good morning,
>>> 
>>> Unfortunately it is not the case, and I can not see the options in the 
>>> editor.
>>> 
>>> The code of the traffic light class and color property are:
>>> 
>>> tesontologyramosenum:TrafficLight
>>>   a owl:Class ;
>>>   a sh:NodeShape ;
>>>   rdfs:label "TrafficLight" ;
>>>   rdfs:subClassOf owl:Thing ;
>>>   sh:property tesontologyramosenum:TrafficLight-color ;
>>> .
>>> tesontologyramosenum:TrafficLight-color
>>>   a sh:PropertyShape ;
>>>   sh:path tesontologyramosenum:color ;
>>>   sh:name "color" ;
>>>   sh:node tesontologyramosenum:Color ;
>>>   sh:nodeKind sh:IRI ;
>> 
>> Replace the sh:node with:
>> 
>>sh:class tesontologyramosenum:Color ;
>> 
>> as sh:node is not enough to tell the system which values can be selected.
>> 
>> Holger
>> 
>> 
>> 
>>> .
>>> and when I create an instance of traffic light, this is what I see:
>>> 
>>> 
>>> Thus, I wonder what I am doing wrong?.
>>> 
>>> 
>>> best regards
>>> 
>>> 
>>> Luis Ramos
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 16:46, Holger Knublauch (>> >) escribió:
 
 
> On 17 Apr 2024, at 3:55 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> it works now in this ontology,
> 
> now, if I want to add a color in any instance (for testing purpose),
> it is only by modifying the code?, like this?:
 
 If you have properly declared the color property then you should be able 
 to select values from the form, not just source code.
 
 Holger
 
 
> 
> 
> That is moreless the expected result on my end.
> 
> 
> Thanks,
> 
> 
> Luis
> 
> El mié, 17 abr 2024 a las 15:37, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> Yes that looks right. To use it in traffic lights, just declare a color 
>> property there which has sh:class :Color.
>> 
>> Holger
>> 
>> 
>>> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> sure,
>>> 
>>> I created a similar ontology for testing with same results, here is the 
>>> code:
>>> 
>>> tesontologyramosenum:Color
>>>   a owl:Class ;
>>>   a sh:NodeShape ;
>>>   rdfs:label "Color" ;
>>>   rdfs:subClassOf owl:Thing ;
>>>   sh:in (
>>>   tesontologyramosenum:Green
>>>   tesontologyramosenum:Yellow
>>>   tesontologyramosenum:Red
>>> ) ;
>>>   sh:property tesontologyramosenum:Color-label ;
>>> .
>>> 
>>> the screen shot is this:
>>> 
>>> 
>>> 
>>> 
>>> with similar results, a datatype property without labeling, and a group 
>>> of undeclared properties.
>>> 
>>> Is this the expected result?
>>> 
>>> How do I use this in traffic light instances, if that were the case?
>>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 14:41, Holger Knublauch 
>>> (mailto:hol...@topquadrant.com>>) escribió:
 Can you paste us the complete content of the source code panel, e.g. 
 as a screenshot? It's hard to see otherwise and there are syntax 
 errors below.
 
 Holger
 
 
> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> I need 

Re: [topbraid-users] enum creation

2024-04-18 Thread Holger Knublauch


> On 18 Apr 2024, at 7:52 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> Hi Holger,
> 
> good morning,
> 
> Unfortunately it is not the case, and I can not see the options in the editor.
> 
> The code of the traffic light class and color property are:
> 
> tesontologyramosenum:TrafficLight
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "TrafficLight" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:property tesontologyramosenum:TrafficLight-color ;
> .
> tesontologyramosenum:TrafficLight-color
>   a sh:PropertyShape ;
>   sh:path tesontologyramosenum:color ;
>   sh:name "color" ;
>   sh:node tesontologyramosenum:Color ;
>   sh:nodeKind sh:IRI ;

Replace the sh:node with:

   sh:class tesontologyramosenum:Color ;

as sh:node is not enough to tell the system which values can be selected.

Holger



> .
> and when I create an instance of traffic light, this is what I see:
> 
> 
> Thus, I wonder what I am doing wrong?.
> 
> 
> best regards
> 
> 
> Luis Ramos
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 16:46, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 3:55 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> it works now in this ontology,
>>> 
>>> now, if I want to add a color in any instance (for testing purpose),
>>> it is only by modifying the code?, like this?:
>> 
>> If you have properly declared the color property then you should be able to 
>> select values from the form, not just source code.
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> That is moreless the expected result on my end.
>>> 
>>> 
>>> Thanks,
>>> 
>>> 
>>> Luis
>>> 
>>> El mié, 17 abr 2024 a las 15:37, Holger Knublauch (>> >) escribió:
 Yes that looks right. To use it in traffic lights, just declare a color 
 property there which has sh:class :Color.
 
 Holger
 
 
> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> sure,
> 
> I created a similar ontology for testing with same results, here is the 
> code:
> 
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
> 
> the screen shot is this:
> 
> 
> 
> 
> with similar results, a datatype property without labeling, and a group 
> of undeclared properties.
> 
> Is this the expected result?
> 
> How do I use this in traffic light instances, if that were the case?
> 
> 
> Luis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> Can you paste us the complete content of the source code panel, e.g. as 
>> a screenshot? It's hard to see otherwise and there are syntax errors 
>> below.
>> 
>> Holger
>> 
>> 
>>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> I need only 3 elements in the enum,
>>> 
>>> But, I tried at the first the source code edition, and told you the 
>>> result I got:
>>> 
>>> **
>>> 
>>> 1. I tried to add the code by myself, but it seems there is something 
>>> wrong with the code:
>>> sh:in (
>>>   myontology:value1
>>>myontology _:value2
>>>   myontology :value3
>>> ) ;
>>> myontology:property1;
>>> myontology:property2;
>>> myontology:enumproperty;
>>> 
>>> Please, take in account that I edited the enum property just after the 
>>> sh:in, but the editor put it at the end
>>> of the list of properties.
>>> 
>>> Part of the result was this black datatype property in properties list
>>> 
>>> 
>>> 
>>> and in the undeclared property there is a list with these values:
>>> 
>>> in  [myontology:property1;
>>>   myontology:property1;
>>>   myontology:enumproperty;]
>>> 
>>> is thát the expected result?
>>> 
>>> **
>>> 
>>> 
>>> Luis
>>> 
>>> El mié, 17 abr 2024 a las 14:33, 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch


> On 17 Apr 2024, at 3:55 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> it works now in this ontology,
> 
> now, if I want to add a color in any instance (for testing purpose),
> it is only by modifying the code?, like this?:

If you have properly declared the color property then you should be able to 
select values from the form, not just source code.

Holger


> 
> 
> That is moreless the expected result on my end.
> 
> 
> Thanks,
> 
> 
> Luis
> 
> El mié, 17 abr 2024 a las 15:37, Holger Knublauch ( >) escribió:
>> Yes that looks right. To use it in traffic lights, just declare a color 
>> property there which has sh:class :Color.
>> 
>> Holger
>> 
>> 
>>> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> sure,
>>> 
>>> I created a similar ontology for testing with same results, here is the 
>>> code:
>>> 
>>> tesontologyramosenum:Color
>>>   a owl:Class ;
>>>   a sh:NodeShape ;
>>>   rdfs:label "Color" ;
>>>   rdfs:subClassOf owl:Thing ;
>>>   sh:in (
>>>   tesontologyramosenum:Green
>>>   tesontologyramosenum:Yellow
>>>   tesontologyramosenum:Red
>>> ) ;
>>>   sh:property tesontologyramosenum:Color-label ;
>>> .
>>> 
>>> the screen shot is this:
>>> 
>>> 
>>> 
>>> 
>>> with similar results, a datatype property without labeling, and a group of 
>>> undeclared properties.
>>> 
>>> Is this the expected result?
>>> 
>>> How do I use this in traffic light instances, if that were the case?
>>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 14:41, Holger Knublauch (>> >) escribió:
 Can you paste us the complete content of the source code panel, e.g. as a 
 screenshot? It's hard to see otherwise and there are syntax errors below.
 
 Holger
 
 
> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> I need only 3 elements in the enum,
> 
> But, I tried at the first the source code edition, and told you the 
> result I got:
> 
> **
> 
> 1. I tried to add the code by myself, but it seems there is something 
> wrong with the code:
> sh:in (
>   myontology:value1
>myontology _:value2
>   myontology :value3
> ) ;
> myontology:property1;
> myontology:property2;
> myontology:enumproperty;
> 
> Please, take in account that I edited the enum property just after the 
> sh:in, but the editor put it at the end
> of the list of properties.
> 
> Part of the result was this black datatype property in properties list
> 
> 
> 
> and in the undeclared property there is a list with these values:
> 
> in  [myontology:property1;
>   myontology:property1;
>   myontology:enumproperty;]
> 
> is thát the expected result?
> 
> **
> 
> 
> Luis
> 
> El mié, 17 abr 2024 a las 14:33, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> Thanks for your quick answer,
>>> 
>>> But, dear, where should I add this code?.
>>> 
>>> Because I tried to add it in the source code panel, and it didn't work, 
>>> same with the script panel,
>>> where I expected it should work, but it did not.
>>> 
>>> So, I owner in which panel should I add this code?.
>>> 
>>> I do not have any idea how to use it.
>> 
>> Yes, it requires JS experience. There is no out-of-the-box solution for 
>> what you are trying to express.
>> 
>> How many enumerations do you need? If it's just a few, I would suggest 
>> going ahead with manual editing of sh:in lists in the Source Code.
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 13:45, Holger Knublauch 
>>> (mailto:hol...@topquadrant.com>>) escribió:
 
 
> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> I am working with version Version: 7.5.1 (20230316-1531).
 
 Ok then the script may not work, assuming the 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
it works now in this ontology,

now, if I want to add a color in any instance (for testing purpose),
it is only by modifying the code?, like this?:

[image: image.png]
That is moreless the expected result on my end.


Thanks,


Luis

El mié, 17 abr 2024 a las 15:37, Holger Knublauch ()
escribió:

> Yes that looks right. To use it in traffic lights, just declare a color
> property there which has sh:class :Color.
>
> Holger
>
>
> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> sure,
>
> I created a similar ontology for testing with same results, here is the
> code:
>
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
>
> the screen shot is this:
>
> 
> 
>
> with similar results, a datatype property without labeling, and a group of
> undeclared properties.
>
> Is this the expected result?
>
> How do I use this in traffic light instances, if that were the case?
>
>
> Luis
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch ()
> escribió:
>
>> Can you paste us the complete content of the source code panel, e.g. as a
>> screenshot? It's hard to see otherwise and there are syntax errors below.
>>
>> Holger
>>
>>
>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> I need only 3 elements in the enum,
>>
>> But, I tried at the first the source code edition, and told you the
>> result I got:
>>
>>
>> **
>>
>> 1. I tried to add the code by myself, but it seems there is something
>> wrong with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>>
>> Please, take in account that I edited the enum property just after the
>> sh:in, but the editor put it at the end
>> of the list of properties.
>>
>> Part of the result was this black datatype property in properties list
>>
>> 
>>
>> and in the undeclared property there is a list with these values:
>>
>> in  [myontology:property1;
>>   myontology:property1;
>>   myontology:enumproperty;]
>>
>> is thát the expected result?
>>
>>
>> **
>>
>>
>> Luis
>>
>> El mié, 17 abr 2024 a las 14:33, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>>
>>>
>>> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid
>>> Suite Users  wrote:
>>>
>>> Thanks for your quick answer,
>>>
>>> But, dear, where should I add this code?.
>>>
>>> Because I tried to add it in the source code panel, and it didn't work,
>>> same with the script panel,
>>> where I expected it should work, but it did not.
>>>
>>> So, I owner in which panel should I add this code?.
>>>
>>> I do not have any idea how to use it.
>>>
>>>
>>> Yes, it requires JS experience. There is no out-of-the-box solution for
>>> what you are trying to express.
>>>
>>> How many enumerations do you need? If it's just a few, I would suggest
>>> going ahead with manual editing of sh:in lists in the Source Code.
>>>
>>> Holger
>>>
>>>
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> El mié, 17 abr 2024 a las 13:45, Holger Knublauch (<
>>> hol...@topquadrant.com>) escribió:
>>>


 On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid
 Suite Users  wrote:

 I am working with version Version: 7.5.1 (20230316-1531).


 Ok then the script may not work, assuming the RDFNodeUtil object was
 introduced later.

 In that case source code editing may be your best solution, unless you
 know how to use this


 createList: (nodes) => {
 let nil = graph.namedNode(rdf.NS + 'nil');
 if(nodes.length == 0) {
 return nil;
 }
 let root = graph.blankNode();
 let current = root;
 nodes.forEach((node, index) => {
 current.add(rdf.first, node);
 let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
 current.add(rdf.rest, rest);
 current = rest;
 })
 return root;
 },



 I included an script panel, refreshed it, and I have this view:
 
 When I run the script I can see my class, the one for which I want to
 create the enum, is the result of focusNode.

 But, when I click in "Declare enumerations from instances" I get the
 same result again:

 
 I have a question:

 how does my script know from which class I do 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch
Yes that looks right. To use it in traffic lights, just declare a color 
property there which has sh:class :Color.

Holger


> On 17 Apr 2024, at 3:00 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> sure,
> 
> I created a similar ontology for testing with same results, here is the code:
> 
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
> 
> the screen shot is this:
> 
> 
> 
> 
> with similar results, a datatype property without labeling, and a group of 
> undeclared properties.
> 
> Is this the expected result?
> 
> How do I use this in traffic light instances, if that were the case?
> 
> 
> Luis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch ( >) escribió:
>> Can you paste us the complete content of the source code panel, e.g. as a 
>> screenshot? It's hard to see otherwise and there are syntax errors below.
>> 
>> Holger
>> 
>> 
>>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> I need only 3 elements in the enum,
>>> 
>>> But, I tried at the first the source code edition, and told you the result 
>>> I got:
>>> 
>>> **
>>> 
>>> 1. I tried to add the code by myself, but it seems there is something wrong 
>>> with the code:
>>> sh:in (
>>>   myontology:value1
>>>myontology _:value2
>>>   myontology :value3
>>> ) ;
>>> myontology:property1;
>>> myontology:property2;
>>> myontology:enumproperty;
>>> 
>>> Please, take in account that I edited the enum property just after the 
>>> sh:in, but the editor put it at the end
>>> of the list of properties.
>>> 
>>> Part of the result was this black datatype property in properties list
>>> 
>>> 
>>> 
>>> and in the undeclared property there is a list with these values:
>>> 
>>> in  [myontology:property1;
>>>   myontology:property1;
>>>   myontology:enumproperty;]
>>> 
>>> is thát the expected result?
>>> 
>>> **
>>> 
>>> 
>>> Luis
>>> 
>>> El mié, 17 abr 2024 a las 14:33, Holger Knublauch (>> >) escribió:
 
 
> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> Thanks for your quick answer,
> 
> But, dear, where should I add this code?.
> 
> Because I tried to add it in the source code panel, and it didn't work, 
> same with the script panel,
> where I expected it should work, but it did not.
> 
> So, I owner in which panel should I add this code?.
> 
> I do not have any idea how to use it.
 
 Yes, it requires JS experience. There is no out-of-the-box solution for 
 what you are trying to express.
 
 How many enumerations do you need? If it's just a few, I would suggest 
 going ahead with manual editing of sh:in lists in the Source Code.
 
 Holger
 
 
> 
> 
> Luis
> 
> 
> 
> El mié, 17 abr 2024 a las 13:45, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> I am working with version Version: 7.5.1 (20230316-1531).
>> 
>> Ok then the script may not work, assuming the RDFNodeUtil object was 
>> introduced later.
>> 
>> In that case source code editing may be your best solution, unless you 
>> know how to use this
>> 
>> 
>> createList: (nodes) => {
>> let nil = graph.namedNode(rdf.NS + 'nil');
>> if(nodes.length == 0) {
>> return nil;
>> }
>> let root = graph.blankNode();
>> let current = root;
>> nodes.forEach((node, index) => {
>> current.add(rdf.first, node);
>> let rest = index < nodes.length - 1 ? graph.blankNode() : 
>> nil;
>> current.add(rdf.rest, rest);
>> current = rest;
>> })
>> return root;
>> },
>> 
>> 
>>> 
>>> I included an script panel, refreshed it, and I have this view:
>>> 
>>> When I run the script I can see my class, the one for which I 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
David,

With your recommendation, now at least I can see the following in the
object property:

[image: image.png]
I created an instance of traffic light, and added the property Color-label
to traffic light as domain,

but when I create the instance of the class traffic light, what I expect is
to have the possibility of

viewing the three possible colors for my traffic light, however I can not
visualize it.

[image: image.png]
previous property name was "label"


Luis


El mié, 17 abr 2024 a las 15:04, David Price ()
escribió:

> Need the sh:in do be defined in PropertyShaps, not NodeShape.
>
> Example from eariler:
>
> example_schema:ThingWithStatus-hasStatus
>   a *sh:PropertyShape ;*
>   sh:path example_schema:hasStatus ;
>   sh:class example_schema:Status ;
>   sh:description "only Active or Retired allowed" ;
>   sh:in (
>   example_schema:Active
>   example_schema:Retired
> ) ;
>   sh:maxCount 1 ;
>   sh:name "has status" ;
> .
>
>
> Cheers,
> David
>
> On 17 Apr 2024, at 14:00, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> sure,
>
> I created a similar ontology for testing with same results, here is the
> code:
>
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
>
> the screen shot is this:
>
> 
> 
>
> with similar results, a datatype property without labeling, and a group of
> undeclared properties.
>
> Is this the expected result?
>
> How do I use this in traffic light instances, if that were the case?
>
>
> Luis
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch ()
> escribió:
>
>> Can you paste us the complete content of the source code panel, e.g. as a
>> screenshot? It's hard to see otherwise and there are syntax errors below.
>>
>> Holger
>>
>>
>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> I need only 3 elements in the enum,
>>
>> But, I tried at the first the source code edition, and told you the
>> result I got:
>>
>>
>> **
>>
>> 1. I tried to add the code by myself, but it seems there is something
>> wrong with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>>
>> Please, take in account that I edited the enum property just after the
>> sh:in, but the editor put it at the end
>> of the list of properties.
>>
>> Part of the result was this black datatype property in properties list
>>
>> 
>>
>> and in the undeclared property there is a list with these values:
>>
>> in  [myontology:property1;
>>   myontology:property1;
>>   myontology:enumproperty;]
>>
>> is thát the expected result?
>>
>>
>> **
>>
>>
>> Luis
>>
>> El mié, 17 abr 2024 a las 14:33, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>>
>>>
>>> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid
>>> Suite Users  wrote:
>>>
>>> Thanks for your quick answer,
>>>
>>> But, dear, where should I add this code?.
>>>
>>> Because I tried to add it in the source code panel, and it didn't work,
>>> same with the script panel,
>>> where I expected it should work, but it did not.
>>>
>>> So, I owner in which panel should I add this code?.
>>>
>>> I do not have any idea how to use it.
>>>
>>>
>>> Yes, it requires JS experience. There is no out-of-the-box solution for
>>> what you are trying to express.
>>>
>>> How many enumerations do you need? If it's just a few, I would suggest
>>> going ahead with manual editing of sh:in lists in the Source Code.
>>>
>>> Holger
>>>
>>>
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> El mié, 17 abr 2024 a las 13:45, Holger Knublauch (<
>>> hol...@topquadrant.com>) escribió:
>>>


 On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid
 Suite Users  wrote:

 I am working with version Version: 7.5.1 (20230316-1531).


 Ok then the script may not work, assuming the RDFNodeUtil object was
 introduced later.

 In that case source code editing may be your best solution, unless you
 know how to use this


 createList: (nodes) => {
 let nil = graph.namedNode(rdf.NS + 'nil');
 if(nodes.length == 0) {
 return nil;
 }
 let root = graph.blankNode();
 let current = root;
 nodes.forEach((node, index) => {
 current.add(rdf.first, node);
 let rest = 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
Thanks or your answer David,

I did the following, but I do not see any change:

tesontologyramosenum:Color
  a owl:Class ;
  a sh:NodeShape ;
  rdfs:label "Color" ;
  rdfs:subClassOf owl:Thing ;
  sh:property tesontologyramosenum:Color-label ;
.
tesontologyramosenum:Color-label
  a sh:PropertyShape ;
  sh:path tesontologyramosenum:label ;
  sh:class tesontologyramosenum:Color ;
  sh:in (
  tesontologyramosenum:Green
  tesontologyramosenum:Yellow
  tesontologyramosenum:Red
) ;
  sh:name "label" ;
.

What should I be missing?


Luis






El mié, 17 abr 2024 a las 15:04, David Price ()
escribió:

> Need the sh:in do be defined in PropertyShaps, not NodeShape.
>
> Example from eariler:
>
> example_schema:ThingWithStatus-hasStatus
>   a *sh:PropertyShape ;*
>   sh:path example_schema:hasStatus ;
>   sh:class example_schema:Status ;
>   sh:description "only Active or Retired allowed" ;
>   sh:in (
>   example_schema:Active
>   example_schema:Retired
> ) ;
>   sh:maxCount 1 ;
>   sh:name "has status" ;
> .
>
>
> Cheers,
> David
>
> On 17 Apr 2024, at 14:00, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> sure,
>
> I created a similar ontology for testing with same results, here is the
> code:
>
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
>
> the screen shot is this:
>
> 
> 
>
> with similar results, a datatype property without labeling, and a group of
> undeclared properties.
>
> Is this the expected result?
>
> How do I use this in traffic light instances, if that were the case?
>
>
> Luis
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch ()
> escribió:
>
>> Can you paste us the complete content of the source code panel, e.g. as a
>> screenshot? It's hard to see otherwise and there are syntax errors below.
>>
>> Holger
>>
>>
>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> I need only 3 elements in the enum,
>>
>> But, I tried at the first the source code edition, and told you the
>> result I got:
>>
>>
>> **
>>
>> 1. I tried to add the code by myself, but it seems there is something
>> wrong with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>>
>> Please, take in account that I edited the enum property just after the
>> sh:in, but the editor put it at the end
>> of the list of properties.
>>
>> Part of the result was this black datatype property in properties list
>>
>> 
>>
>> and in the undeclared property there is a list with these values:
>>
>> in  [myontology:property1;
>>   myontology:property1;
>>   myontology:enumproperty;]
>>
>> is thát the expected result?
>>
>>
>> **
>>
>>
>> Luis
>>
>> El mié, 17 abr 2024 a las 14:33, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>>
>>>
>>> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid
>>> Suite Users  wrote:
>>>
>>> Thanks for your quick answer,
>>>
>>> But, dear, where should I add this code?.
>>>
>>> Because I tried to add it in the source code panel, and it didn't work,
>>> same with the script panel,
>>> where I expected it should work, but it did not.
>>>
>>> So, I owner in which panel should I add this code?.
>>>
>>> I do not have any idea how to use it.
>>>
>>>
>>> Yes, it requires JS experience. There is no out-of-the-box solution for
>>> what you are trying to express.
>>>
>>> How many enumerations do you need? If it's just a few, I would suggest
>>> going ahead with manual editing of sh:in lists in the Source Code.
>>>
>>> Holger
>>>
>>>
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> El mié, 17 abr 2024 a las 13:45, Holger Knublauch (<
>>> hol...@topquadrant.com>) escribió:
>>>


 On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid
 Suite Users  wrote:

 I am working with version Version: 7.5.1 (20230316-1531).


 Ok then the script may not work, assuming the RDFNodeUtil object was
 introduced later.

 In that case source code editing may be your best solution, unless you
 know how to use this


 createList: (nodes) => {
 let nil = graph.namedNode(rdf.NS + 'nil');
 if(nodes.length == 0) {
 return nil;
 }
 let root = graph.blankNode();
 let current = root;
 

Re: [topbraid-users] enum creation

2024-04-17 Thread David Price
Need the sh:in do be defined in PropertyShaps, not NodeShape.

Example from eariler:

example_schema:ThingWithStatus-hasStatus
  a sh:PropertyShape ;
  sh:path example_schema:hasStatus ;
  sh:class example_schema:Status ;
  sh:description "only Active or Retired allowed" ;
  sh:in (
  example_schema:Active
  example_schema:Retired
) ;
  sh:maxCount 1 ;
  sh:name "has status" ;
.

Cheers,
David

> On 17 Apr 2024, at 14:00, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> sure, 
> 
> I created a similar ontology for testing with same results, here is the code:
> 
> tesontologyramosenum:Color
>   a owl:Class ;
>   a sh:NodeShape ;
>   rdfs:label "Color" ;
>   rdfs:subClassOf owl:Thing ;
>   sh:in (
>   tesontologyramosenum:Green
>   tesontologyramosenum:Yellow
>   tesontologyramosenum:Red
> ) ;
>   sh:property tesontologyramosenum:Color-label ;
> .
> 
> the screen shot is this:
> 
> 
> 
> 
> with similar results, a datatype property without labeling, and a group of 
> undeclared properties.
> 
> Is this the expected result?
> 
> How do I use this in traffic light instances, if that were the case?
> 
> 
> Luis 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 14:41, Holger Knublauch ( >) escribió:
>> Can you paste us the complete content of the source code panel, e.g. as a 
>> screenshot? It's hard to see otherwise and there are syntax errors below.
>> 
>> Holger
>> 
>> 
>>> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> I need only 3 elements in the enum, 
>>> 
>>> But, I tried at the first the source code edition, and told you the result 
>>> I got:
>>> 
>>> **
>>> 
>>> 1. I tried to add the code by myself, but it seems there is something wrong 
>>> with the code:
>>> sh:in (
>>>   myontology:value1
>>>myontology _:value2
>>>   myontology :value3
>>> ) ;
>>> myontology:property1;
>>> myontology:property2;
>>> myontology:enumproperty;
>>> 
>>> Please, take in account that I edited the enum property just after the 
>>> sh:in, but the editor put it at the end
>>> of the list of properties.
>>> 
>>> Part of the result was this black datatype property in properties list
>>> 
>>> 
>>> 
>>> and in the undeclared property there is a list with these values:
>>> 
>>> in  [myontology:property1;
>>>   myontology:property1;
>>>   myontology:enumproperty;]
>>> 
>>> is thát the expected result?
>>> 
>>> **
>>> 
>>> 
>>> Luis 
>>> 
>>> El mié, 17 abr 2024 a las 14:33, Holger Knublauch (>> >) escribió:
 
 
> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> Thanks for your quick answer, 
> 
> But, dear, where should I add this code?.
> 
> Because I tried to add it in the source code panel, and it didn't work, 
> same with the script panel,
> where I expected it should work, but it did not. 
> 
> So, I owner in which panel should I add this code?.
> 
> I do not have any idea how to use it.
 
 Yes, it requires JS experience. There is no out-of-the-box solution for 
 what you are trying to express.
 
 How many enumerations do you need? If it's just a few, I would suggest 
 going ahead with manual editing of sh:in lists in the Source Code.
 
 Holger
 
 
> 
> 
> Luis 
> 
> 
> 
> El mié, 17 abr 2024 a las 13:45, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid 
>>> Suite Users >> > wrote:
>>> 
>>> I am working with version Version: 7.5.1 (20230316-1531).
>> 
>> Ok then the script may not work, assuming the RDFNodeUtil object was 
>> introduced later.
>> 
>> In that case source code editing may be your best solution, unless you 
>> know how to use this
>> 
>> 
>> createList: (nodes) => {
>> let nil = graph.namedNode(rdf.NS + 'nil');
>> if(nodes.length == 0) {
>> return nil;
>> }
>> let root = graph.blankNode();
>> let current = root;
>> nodes.forEach((node, index) => {
>> current.add(rdf.first, node);
>> let rest = index < nodes.length - 1 ? graph.blankNode() : 
>> nil;
>> 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch
Can you paste us the complete content of the source code panel, e.g. as a 
screenshot? It's hard to see otherwise and there are syntax errors below.

Holger


> On 17 Apr 2024, at 2:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> I need only 3 elements in the enum,
> 
> But, I tried at the first the source code edition, and told you the result I 
> got:
> 
> **
> 
> 1. I tried to add the code by myself, but it seems there is something wrong 
> with the code:
> sh:in (
>   myontology:value1
>myontology _:value2
>   myontology :value3
> ) ;
> myontology:property1;
> myontology:property2;
> myontology:enumproperty;
> 
> Please, take in account that I edited the enum property just after the sh:in, 
> but the editor put it at the end
> of the list of properties.
> 
> Part of the result was this black datatype property in properties list
> 
> 
> 
> and in the undeclared property there is a list with these values:
> 
> in  [myontology:property1;
>   myontology:property1;
>   myontology:enumproperty;]
> 
> is thát the expected result?
> 
> **
> 
> 
> Luis
> 
> El mié, 17 abr 2024 a las 14:33, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> Thanks for your quick answer,
>>> 
>>> But, dear, where should I add this code?.
>>> 
>>> Because I tried to add it in the source code panel, and it didn't work, 
>>> same with the script panel,
>>> where I expected it should work, but it did not.
>>> 
>>> So, I owner in which panel should I add this code?.
>>> 
>>> I do not have any idea how to use it.
>> 
>> Yes, it requires JS experience. There is no out-of-the-box solution for what 
>> you are trying to express.
>> 
>> How many enumerations do you need? If it's just a few, I would suggest going 
>> ahead with manual editing of sh:in lists in the Source Code.
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 13:45, Holger Knublauch (>> >) escribió:
 
 
> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> I am working with version Version: 7.5.1 (20230316-1531).
 
 Ok then the script may not work, assuming the RDFNodeUtil object was 
 introduced later.
 
 In that case source code editing may be your best solution, unless you 
 know how to use this
 
 
 createList: (nodes) => {
 let nil = graph.namedNode(rdf.NS + 'nil');
 if(nodes.length == 0) {
 return nil;
 }
 let root = graph.blankNode();
 let current = root;
 nodes.forEach((node, index) => {
 current.add(rdf.first, node);
 let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
 current.add(rdf.rest, rest);
 current = rest;
 })
 return root;
 },
 
 
> 
> I included an script panel, refreshed it, and I have this view:
> 
> When I run the script I can see my class, the one for which I want to 
> create the enum, is the result of focusNode.
> 
> But, when I click in "Declare enumerations from instances" I get the same 
> result again:
> 
> 
> I have a question:
> 
> how does my script know from which class I do want to get my instances 
> for the enum list?.
 
 The infrastructure around the ModifyAction will make sure that the 
 variable focusNode points at the asset that
 the action was called from (in the Modify menu).
 
 
> 
> Because I think you are using the same class color?, how do I relate the 
> class traffic light there?
> 
> What I want to say is something like this:
> 
> Product hasSize oneof  Size (short, medium, large)
> 
> And at this moment my focus is in Product, not in Size.
 
 In SHACL you can either add sh:in to a class/node shape or to a property 
 shape. If you just want to add it to a specific property then a different 
 script would be needed.
 
 Holger
 
 
> 
> 
> Luis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 11:50, Holger Knublauch 
> (mailto:hol...@topquadrant.com>>) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
I need only 3 elements in the enum,

But, I tried at the first the source code edition, and told you the result
I got:

**

1. I tried to add the code by myself, but it seems there is something wrong
with the code:
sh:in (
  myontology:value1
   myontology _:value2
  myontology :value3
) ;
myontology:property1;
myontology:property2;
myontology:enumproperty;

Please, take in account that I edited the enum property just after the
sh:in, but the editor put it at the end
of the list of properties.

Part of the result was this black datatype property in properties list

[image: image.png]

and in the undeclared property there is a list with these values:

in  [myontology:property1;
  myontology:property1;
  myontology:enumproperty;]

is thát the expected result?

**


Luis

El mié, 17 abr 2024 a las 14:33, Holger Knublauch ()
escribió:

>
>
> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> Thanks for your quick answer,
>
> But, dear, where should I add this code?.
>
> Because I tried to add it in the source code panel, and it didn't work,
> same with the script panel,
> where I expected it should work, but it did not.
>
> So, I owner in which panel should I add this code?.
>
> I do not have any idea how to use it.
>
>
> Yes, it requires JS experience. There is no out-of-the-box solution for
> what you are trying to express.
>
> How many enumerations do you need? If it's just a few, I would suggest
> going ahead with manual editing of sh:in lists in the Source Code.
>
> Holger
>
>
>
>
> Luis
>
>
>
> El mié, 17 abr 2024 a las 13:45, Holger Knublauch ()
> escribió:
>
>>
>>
>> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> I am working with version Version: 7.5.1 (20230316-1531).
>>
>>
>> Ok then the script may not work, assuming the RDFNodeUtil object was
>> introduced later.
>>
>> In that case source code editing may be your best solution, unless you
>> know how to use this
>>
>>
>> createList: (nodes) => {
>> let nil = graph.namedNode(rdf.NS + 'nil');
>> if(nodes.length == 0) {
>> return nil;
>> }
>> let root = graph.blankNode();
>> let current = root;
>> nodes.forEach((node, index) => {
>> current.add(rdf.first, node);
>> let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
>> current.add(rdf.rest, rest);
>> current = rest;
>> })
>> return root;
>> },
>>
>>
>>
>> I included an script panel, refreshed it, and I have this view:
>> 
>> When I run the script I can see my class, the one for which I want to
>> create the enum, is the result of focusNode.
>>
>> But, when I click in "Declare enumerations from instances" I get the same
>> result again:
>>
>> 
>> I have a question:
>>
>> how does my script know from which class I do want to get my instances
>> for the enum list?.
>>
>>
>> The infrastructure around the ModifyAction will make sure that the
>> variable focusNode points at the asset that
>> the action was called from (in the Modify menu).
>>
>>
>>
>> Because I think you are using the same class color?, how do I relate the
>> class traffic light there?
>>
>> What I want to say is something like this:
>>
>> Product hasSize oneof  Size (short, medium, large)
>>
>> And at this moment my focus is in *Product*, not in *Size*.
>>
>>
>> In SHACL you can either add sh:in to a class/node shape or to a property
>> shape. If you just want to add it to a specific property then a different
>> script would be needed.
>>
>> Holger
>>
>>
>>
>>
>> Luis
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> El mié, 17 abr 2024 a las 11:50, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>>
>>>
>>> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid
>>> Suite Users  wrote:
>>>
>>> I added the code at the end of the code of the target class, and got
>>> this result:
>>>
>>> 
>>> When I click in "Declare enumeration from instances, I get this view:
>>>
>>> 
>>>
>>>
>>> This looks unexpected. What version are you on? The RDFNodeUtil object
>>> should be there. Maybe try the Refresh button in the Script Editor panel.
>>>
>>>
>>> 
>>> Then, I wonder how to make the system know where my list of enum values
>>> are?
>>>
>>>
>>> It will simply look at the already-existing instances of the currently
>>> selected class, see graph.every(focusNode) where focusNode is the current
>>> class.
>>>
>>> Holger
>>>
>>>
>>>
>>>
>>>
>>> Luis
>>>
>>>
>>>
>>> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García (<
>>> luisenriqueramos1...@googlemail.com>) escribió:
>>>
 Hi Holger,
 Thanks for your answer, but to be frank I find these procedures very
 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch


> On 17 Apr 2024, at 2:30 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> Thanks for your quick answer,
> 
> But, dear, where should I add this code?.
> 
> Because I tried to add it in the source code panel, and it didn't work, same 
> with the script panel,
> where I expected it should work, but it did not.
> 
> So, I owner in which panel should I add this code?.
> 
> I do not have any idea how to use it.

Yes, it requires JS experience. There is no out-of-the-box solution for what 
you are trying to express.

How many enumerations do you need? If it's just a few, I would suggest going 
ahead with manual editing of sh:in lists in the Source Code.

Holger


> 
> 
> Luis
> 
> 
> 
> El mié, 17 abr 2024 a las 13:45, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> I am working with version Version: 7.5.1 (20230316-1531).
>> 
>> Ok then the script may not work, assuming the RDFNodeUtil object was 
>> introduced later.
>> 
>> In that case source code editing may be your best solution, unless you know 
>> how to use this
>> 
>> 
>> createList: (nodes) => {
>> let nil = graph.namedNode(rdf.NS + 'nil');
>> if(nodes.length == 0) {
>> return nil;
>> }
>> let root = graph.blankNode();
>> let current = root;
>> nodes.forEach((node, index) => {
>> current.add(rdf.first, node);
>> let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
>> current.add(rdf.rest, rest);
>> current = rest;
>> })
>> return root;
>> },
>> 
>> 
>>> 
>>> I included an script panel, refreshed it, and I have this view:
>>> 
>>> When I run the script I can see my class, the one for which I want to 
>>> create the enum, is the result of focusNode.
>>> 
>>> But, when I click in "Declare enumerations from instances" I get the same 
>>> result again:
>>> 
>>> 
>>> I have a question:
>>> 
>>> how does my script know from which class I do want to get my instances for 
>>> the enum list?.
>> 
>> The infrastructure around the ModifyAction will make sure that the variable 
>> focusNode points at the asset that
>> the action was called from (in the Modify menu).
>> 
>> 
>>> 
>>> Because I think you are using the same class color?, how do I relate the 
>>> class traffic light there?
>>> 
>>> What I want to say is something like this:
>>> 
>>> Product hasSize oneof  Size (short, medium, large)
>>> 
>>> And at this moment my focus is in Product, not in Size.
>> 
>> In SHACL you can either add sh:in to a class/node shape or to a property 
>> shape. If you just want to add it to a specific property then a different 
>> script would be needed.
>> 
>> Holger
>> 
>> 
>>> 
>>> 
>>> Luis
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 11:50, Holger Knublauch (>> >) escribió:
 
 
> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid 
> Suite Users  > wrote:
> 
> I added the code at the end of the code of the target class, and got this 
> result:
> 
> 
> When I click in "Declare enumeration from instances, I get this view:
> 
> 
 
 This looks unexpected. What version are you on? The RDFNodeUtil object 
 should be there. Maybe try the Refresh button in the Script Editor panel.
 
> 
> 
> Then, I wonder how to make the system know where my list of enum values 
> are?
 
 It will simply look at the already-existing instances of the currently 
 selected class, see graph.every(focusNode) where focusNode is the current 
 class.
 
 Holger
 
 
 
> 
> 
> Luis 
> 
> 
> 
> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García 
> ( >) escribió:
>> Hi Holger, 
>> Thanks for your answer, but to be frank I find these procedures very 
>> complicated. 
>> In my opinion the enum is a very common pattern, and I understand when 
>> to use it. 
>> 
>> Anyway, let's try to solve the issue
>> 
>> 1. I tried to add the code by myself, but it seems there is something 
>> wrong with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>> 
>> Please, take in account that I edited the enum property just after the 
>> sh:in, but the editor put it at the end
>> of the list of properties.
>> 
>> Part of the result was this black datatype property in properties list
>> 
>> 
>> 
>> and 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
Thanks for your quick answer,

But, dear, where should I add this code?.

Because I tried to add it in the source code panel, and it didn't work,
same with the script panel,
where I expected it should work, but it did not.

So, I owner in which panel should I add this code?.

I do not have any idea how to use it.


Luis



El mié, 17 abr 2024 a las 13:45, Holger Knublauch ()
escribió:

>
>
> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite
> Users  wrote:
>
> I am working with version Version: 7.5.1 (20230316-1531).
>
>
> Ok then the script may not work, assuming the RDFNodeUtil object was
> introduced later.
>
> In that case source code editing may be your best solution, unless you
> know how to use this
>
>
> createList: (nodes) => {
> let nil = graph.namedNode(rdf.NS + 'nil');
> if(nodes.length == 0) {
> return nil;
> }
> let root = graph.blankNode();
> let current = root;
> nodes.forEach((node, index) => {
> current.add(rdf.first, node);
> let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
> current.add(rdf.rest, rest);
> current = rest;
> })
> return root;
> },
>
>
>
> I included an script panel, refreshed it, and I have this view:
> 
> When I run the script I can see my class, the one for which I want to
> create the enum, is the result of focusNode.
>
> But, when I click in "Declare enumerations from instances" I get the same
> result again:
>
> 
> I have a question:
>
> how does my script know from which class I do want to get my instances for
> the enum list?.
>
>
> The infrastructure around the ModifyAction will make sure that the
> variable focusNode points at the asset that
> the action was called from (in the Modify menu).
>
>
>
> Because I think you are using the same class color?, how do I relate the
> class traffic light there?
>
> What I want to say is something like this:
>
> Product hasSize oneof  Size (short, medium, large)
>
> And at this moment my focus is in *Product*, not in *Size*.
>
>
> In SHACL you can either add sh:in to a class/node shape or to a property
> shape. If you just want to add it to a specific property then a different
> script would be needed.
>
> Holger
>
>
>
>
> Luis
>
>
>
>
>
>
>
>
>
>
>
>
>
> El mié, 17 abr 2024 a las 11:50, Holger Knublauch ()
> escribió:
>
>>
>>
>> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid
>> Suite Users  wrote:
>>
>> I added the code at the end of the code of the target class, and got this
>> result:
>>
>> 
>> When I click in "Declare enumeration from instances, I get this view:
>>
>> 
>>
>>
>> This looks unexpected. What version are you on? The RDFNodeUtil object
>> should be there. Maybe try the Refresh button in the Script Editor panel.
>>
>>
>> 
>> Then, I wonder how to make the system know where my list of enum values
>> are?
>>
>>
>> It will simply look at the already-existing instances of the currently
>> selected class, see graph.every(focusNode) where focusNode is the current
>> class.
>>
>> Holger
>>
>>
>>
>>
>>
>> Luis
>>
>>
>>
>> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García (<
>> luisenriqueramos1...@googlemail.com>) escribió:
>>
>>> Hi Holger,
>>> Thanks for your answer, but to be frank I find these procedures very
>>> complicated.
>>> In my opinion the enum is a very common pattern, and I understand when
>>> to use it.
>>>
>>> Anyway, let's try to solve the issue
>>>
>>> 1. I tried to add the code by myself, but it seems there is something
>>> wrong with the code:
>>> sh:in (
>>>   myontology:value1
>>>myontology _:value2
>>>   myontology :value3
>>> ) ;
>>> myontology:property1;
>>> myontology:property2;
>>> myontology:enumproperty;
>>>
>>> Please, take in account that I edited the enum property just after the
>>> sh:in, but the editor put it at the end
>>> of the list of properties.
>>>
>>> Part of the result was this black datatype property in properties list
>>>
>>> 
>>>
>>> and in the undeclared property there is a list with these values:
>>>
>>> in  [myontology:property1;
>>>   myontology:property1;
>>>   myontology:enumproperty;]
>>>
>>> is thát the expected result?
>>>
>>> if not, for the second option,
>>>
>>> where do I have to insert this code:
>>>
>>> focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
>>>
>>>
>>> do I have to add this code at the beginning of the code of my ontology?
>>>
>>>
>>> myontology:ClassActionsGroup
>>> a dash:ActionGroup ;
>>> rdfs:label "Class actions group" ;
>>> .
>>> myontology:DeclareEnumerationFromInstances
>>> a dash:ModifyAction ;
>>> dash:actionGroup myontology:ClassActionsGroup ;
>>> dash:js "focusNode.add(sh.in,
>>> RDFNodeUtil.createList(graph.every(focusNode)))" ;
>>> rdfs:comment "Adds a sh:in declaration that enumerates all (current)
>>> instances of the selected class." ;
>>> rdfs:label "Declare enumeration from instances" ;
>>> .
>>> 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch


> On 17 Apr 2024, at 1:38 PM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> I am working with version Version: 7.5.1 (20230316-1531).

Ok then the script may not work, assuming the RDFNodeUtil object was introduced 
later.

In that case source code editing may be your best solution, unless you know how 
to use this


createList: (nodes) => {
let nil = graph.namedNode(rdf.NS + 'nil');
if(nodes.length == 0) {
return nil;
}
let root = graph.blankNode();
let current = root;
nodes.forEach((node, index) => {
current.add(rdf.first, node);
let rest = index < nodes.length - 1 ? graph.blankNode() : nil;
current.add(rdf.rest, rest);
current = rest;
})
return root;
},


> 
> I included an script panel, refreshed it, and I have this view:
> 
> When I run the script I can see my class, the one for which I want to create 
> the enum, is the result of focusNode.
> 
> But, when I click in "Declare enumerations from instances" I get the same 
> result again:
> 
> 
> I have a question:
> 
> how does my script know from which class I do want to get my instances for 
> the enum list?.

The infrastructure around the ModifyAction will make sure that the variable 
focusNode points at the asset that
the action was called from (in the Modify menu).


> 
> Because I think you are using the same class color?, how do I relate the 
> class traffic light there?
> 
> What I want to say is something like this:
> 
> Product hasSize oneof  Size (short, medium, large)
> 
> And at this moment my focus is in Product, not in Size.

In SHACL you can either add sh:in to a class/node shape or to a property shape. 
If you just want to add it to a specific property then a different script would 
be needed.

Holger


> 
> 
> Luis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> El mié, 17 abr 2024 a las 11:50, Holger Knublauch ( >) escribió:
>> 
>> 
>>> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
>>> Users >> > wrote:
>>> 
>>> I added the code at the end of the code of the target class, and got this 
>>> result:
>>> 
>>> 
>>> When I click in "Declare enumeration from instances, I get this view:
>>> 
>>> 
>> 
>> This looks unexpected. What version are you on? The RDFNodeUtil object 
>> should be there. Maybe try the Refresh button in the Script Editor panel.
>> 
>>> 
>>> 
>>> Then, I wonder how to make the system know where my list of enum values are?
>> 
>> It will simply look at the already-existing instances of the currently 
>> selected class, see graph.every(focusNode) where focusNode is the current 
>> class.
>> 
>> Holger
>> 
>> 
>> 
>>> 
>>> 
>>> Luis 
>>> 
>>> 
>>> 
>>> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García 
>>> (>> >) escribió:
 Hi Holger, 
 Thanks for your answer, but to be frank I find these procedures very 
 complicated. 
 In my opinion the enum is a very common pattern, and I understand when to 
 use it. 
 
 Anyway, let's try to solve the issue
 
 1. I tried to add the code by myself, but it seems there is something 
 wrong with the code:
 sh:in (
   myontology:value1
myontology _:value2
   myontology :value3
 ) ;
 myontology:property1;
 myontology:property2;
 myontology:enumproperty;
 
 Please, take in account that I edited the enum property just after the 
 sh:in, but the editor put it at the end
 of the list of properties.
 
 Part of the result was this black datatype property in properties list
 
 
 
 and in the undeclared property there is a list with these values:
 
 in  [myontology:property1;
   myontology:property1;
   myontology:enumproperty;]
 
 is thát the expected result?
 
 if not, for the second option,
 
 where do I have to insert this code:
 
 focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
 
 
 do I have to add this code at the beginning of the code of my ontology?
 
 
 myontology:ClassActionsGroup
   a dash:ActionGroup ;
   rdfs:label "Class actions group" ;
 .
 myontology:DeclareEnumerationFromInstances
   a dash:ModifyAction ;
   dash:actionGroup myontology:ClassActionsGroup ;
   dash:js "focusNode.add(sh.in , 
 RDFNodeUtil.createList(graph.every(focusNode)))" ;
   rdfs:comment "Adds a sh:in declaration that enumerates all (current) 
 instances of the selected class." ;
   rdfs:label "Declare enumeration from instances" ;
 .
 rdfs:Class
   dash:resourceAction 

Re: [topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
I am working with version Version: 7.5.1 (20230316-1531).

I included an script panel, refreshed it, and I have this view:
[image: image.png]
When I run the script I can see my class, the one for which I want to
create the enum, is the result of focusNode.

But, when I click in "Declare enumerations from instances" I get the same
result again:

[image: image.png]
I have a question:

how does my script know from which class I do want to get my instances for
the enum list?.

Because I think you are using the same class color?, how do I relate the
class traffic light there?

What I want to say is something like this:

Product hasSize oneof  Size (short, medium, large)

And at this moment my focus is in *Product*, not in *Size*.


Luis













El mié, 17 abr 2024 a las 11:50, Holger Knublauch ()
escribió:

>
>
> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid
> Suite Users  wrote:
>
> I added the code at the end of the code of the target class, and got this
> result:
>
> 
> When I click in "Declare enumeration from instances, I get this view:
>
> 
>
>
> This looks unexpected. What version are you on? The RDFNodeUtil object
> should be there. Maybe try the Refresh button in the Script Editor panel.
>
>
> 
> Then, I wonder how to make the system know where my list of enum values
> are?
>
>
> It will simply look at the already-existing instances of the currently
> selected class, see graph.every(focusNode) where focusNode is the current
> class.
>
> Holger
>
>
>
>
>
> Luis
>
>
>
> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García (<
> luisenriqueramos1...@googlemail.com>) escribió:
>
>> Hi Holger,
>> Thanks for your answer, but to be frank I find these procedures very
>> complicated.
>> In my opinion the enum is a very common pattern, and I understand when to
>> use it.
>>
>> Anyway, let's try to solve the issue
>>
>> 1. I tried to add the code by myself, but it seems there is something
>> wrong with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>>
>> Please, take in account that I edited the enum property just after the
>> sh:in, but the editor put it at the end
>> of the list of properties.
>>
>> Part of the result was this black datatype property in properties list
>>
>> 
>>
>> and in the undeclared property there is a list with these values:
>>
>> in  [myontology:property1;
>>   myontology:property1;
>>   myontology:enumproperty;]
>>
>> is thát the expected result?
>>
>> if not, for the second option,
>>
>> where do I have to insert this code:
>>
>> focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
>>
>>
>> do I have to add this code at the beginning of the code of my ontology?
>>
>>
>> myontology:ClassActionsGroup
>> a dash:ActionGroup ;
>> rdfs:label "Class actions group" ;
>> .
>> myontology:DeclareEnumerationFromInstances
>> a dash:ModifyAction ;
>> dash:actionGroup myontology:ClassActionsGroup ;
>> dash:js "focusNode.add(sh.in,
>> RDFNodeUtil.createList(graph.every(focusNode)))" ;
>> rdfs:comment "Adds a sh:in declaration that enumerates all (current)
>> instances of the selected class." ;
>> rdfs:label "Declare enumeration from instances" ;
>> .
>> rdfs:Class
>> dash:resourceAction myontology:DeclareEnumerationFromInstances ;
>>
>> I have not done this before, if you have a tutorial or some document I
>> could read, I would really appreciate
>> if you can share it with me.
>>
>>
>>
>>
>> Best regards
>>
>>
>>
>> Luis Ramos
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> El mié, 17 abr 2024 a las 10:00, Holger Knublauch (<
>> hol...@topquadrant.com>) escribió:
>>
>>> Hi Luis,
>>>
>>> declaring an enumerated class is achieved in SHACL via sh:in. There is
>>> no dedicated user interface for creating those quickly, as this isn't
>>> anything that we have seen used much so far. I guess this is because the
>>> user interface for entering instance data is already a drop down box
>>> anyway, typically deemed good enough.
>>>
>>> The main reason for creating enumerations would be to make sure that
>>> ONLY those enumerated values will ever be permitted. For example, the
>>> colors of a traffic light must only be red, green, yellow, but never blue
>>> even if someone adds such an instance later.
>>>
>>> To create those, you have various options. Advanced users would use the
>>> source code panel to enter the sh:in expression. However, similar to what
>>> we had in TBC, I think this can be automated easily. Basically the
>>> following ADS script produces an sh:in enumeration for the selected class:
>>>
>>> focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
>>>
>>> We can wrap this into a Modify Action (feel free to add the below to
>>> your Ontology or a file that is 

Re: [topbraid-users] enum creation

2024-04-17 Thread Holger Knublauch


> On 17 Apr 2024, at 11:29 AM, 'Luis Enrique Ramos García' via TopBraid Suite 
> Users  wrote:
> 
> I added the code at the end of the code of the target class, and got this 
> result:
> 
> 
> When I click in "Declare enumeration from instances, I get this view:
> 
> 

This looks unexpected. What version are you on? The RDFNodeUtil object should 
be there. Maybe try the Refresh button in the Script Editor panel.

> 
> 
> Then, I wonder how to make the system know where my list of enum values are?

It will simply look at the already-existing instances of the currently selected 
class, see graph.every(focusNode) where focusNode is the current class.

Holger



> 
> 
> Luis 
> 
> 
> 
> El mié, 17 abr 2024 a las 10:51, Luis Enrique Ramos García 
> ( >) escribió:
>> Hi Holger, 
>> Thanks for your answer, but to be frank I find these procedures very 
>> complicated. 
>> In my opinion the enum is a very common pattern, and I understand when to 
>> use it. 
>> 
>> Anyway, let's try to solve the issue
>> 
>> 1. I tried to add the code by myself, but it seems there is something wrong 
>> with the code:
>> sh:in (
>>   myontology:value1
>>myontology _:value2
>>   myontology :value3
>> ) ;
>> myontology:property1;
>> myontology:property2;
>> myontology:enumproperty;
>> 
>> Please, take in account that I edited the enum property just after the 
>> sh:in, but the editor put it at the end
>> of the list of properties.
>> 
>> Part of the result was this black datatype property in properties list
>> 
>> 
>> 
>> and in the undeclared property there is a list with these values:
>> 
>> in  [myontology:property1;
>>   myontology:property1;
>>   myontology:enumproperty;]
>> 
>> is thát the expected result?
>> 
>> if not, for the second option,
>> 
>> where do I have to insert this code:
>> 
>> focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
>> 
>> 
>> do I have to add this code at the beginning of the code of my ontology?
>> 
>> 
>> myontology:ClassActionsGroup
>>   a dash:ActionGroup ;
>>   rdfs:label "Class actions group" ;
>> .
>> myontology:DeclareEnumerationFromInstances
>>   a dash:ModifyAction ;
>>   dash:actionGroup myontology:ClassActionsGroup ;
>>   dash:js "focusNode.add(sh.in , 
>> RDFNodeUtil.createList(graph.every(focusNode)))" ;
>>   rdfs:comment "Adds a sh:in declaration that enumerates all (current) 
>> instances of the selected class." ;
>>   rdfs:label "Declare enumeration from instances" ;
>> .
>> rdfs:Class
>>   dash:resourceAction myontology:DeclareEnumerationFromInstances ;
>> 
>> I have not done this before, if you have a tutorial or some document I could 
>> read, I would really appreciate 
>> if you can share it with me.
>> 
>> 
>> 
>> 
>> Best regards
>> 
>> 
>> 
>> Luis Ramos
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> El mié, 17 abr 2024 a las 10:00, Holger Knublauch (> >) escribió:
>>> Hi Luis,
>>> 
>>> declaring an enumerated class is achieved in SHACL via sh:in. There is no 
>>> dedicated user interface for creating those quickly, as this isn't anything 
>>> that we have seen used much so far. I guess this is because the user 
>>> interface for entering instance data is already a drop down box anyway, 
>>> typically deemed good enough.
>>> 
>>> The main reason for creating enumerations would be to make sure that ONLY 
>>> those enumerated values will ever be permitted. For example, the colors of 
>>> a traffic light must only be red, green, yellow, but never blue even if 
>>> someone adds such an instance later.
>>> 
>>> To create those, you have various options. Advanced users would use the 
>>> source code panel to enter the sh:in expression. However, similar to what 
>>> we had in TBC, I think this can be automated easily. Basically the 
>>> following ADS script produces an sh:in enumeration for the selected class:
>>> 
>>> focusNode.add(sh.in, RDFNodeUtil.createList(graph.every(focusNode)))
>>> 
>>> We can wrap this into a Modify Action (feel free to add the below to your 
>>> Ontology or a file that is included into your ontology):
>>> 
>>> 
>>> myontology:ClassActionsGroup
>>>   a dash:ActionGroup ;
>>>   rdfs:label "Class actions group" ;
>>> .
>>> myontology:DeclareEnumerationFromInstances
>>>   a dash:ModifyAction ;
>>>   dash:actionGroup myontology:ClassActionsGroup ;
>>>   dash:js "focusNode.add(sh.in , 
>>> RDFNodeUtil.createList(graph.every(focusNode)))" ;
>>>   rdfs:comment "Adds a sh:in declaration that enumerates all (current) 
>>> instances of the selected class." ;
>>>   rdfs:label "Declare enumeration from instances" ;
>>> .
>>> rdfs:Class
>>>   dash:resourceAction myontology:DeclareEnumerationFromInstances ;
>>> .
>>> 
>>> With this in place, you can run it from the Modify menu of any 

[topbraid-users] enum creation

2024-04-17 Thread 'Luis Enrique Ramos García' via TopBraid Suite Users
 

I need to model an enum, 

and found this non uptodate tutorial:

https://topbraidcomposer.org/html/Create_an_enumeration.htm

Thus, I wonder if there is an uptodate procedure to create an enum in EDG?

 

Thanks


Luis 

-- 
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/6621d600-2195-4e9c-9b5d-58ce8172722bn%40googlegroups.com.