--
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/01759423-765a-4084-a991-2caa46eb49e8n%40googlegroups.com.





To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/6CE83445-5B78-424E-A92F-7E5FDE25E275%40topquadrant.com.
This is in fact how the built-in URI generation policy "counter" is implemented. Open teamwork.ui.ttlx and go to
teamwork:IncrementCounterEditRule
The main difference is that we store this "counter" in the TCH
graphs.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/6CE83445-5B78-424E-A92F-7E5FDE25E275%40topquadrant.com.
On 17 Mar 2021, at 21:56, Irene Polikoff <ir...@topquadrant.com> wrote:Another approach is to use a property value rule to automatically calculate the autoIncrementIDIt sounds like you want to get a count of all instances plus some number.
What is autoIncrementID a property of?Is it a property that each instance of a class has, so that for each instance you can get the count of ll instances of a class plus a number ?
Then, you would define it for the class Animal and create a property value rule as follows
<PastedGraphic-65.png>
Select Count number of inverse property values
<PastedGraphic-67.png>
<PastedGraphic-70.png>
If you want to add some number to the count, use sparql:add function in your rule - http://datashapes.org/sparqlYou can also associate the property with the class itself, then you do not need to change the rule that will be generated by the template.To associate a property with a class, switch the class hierarchy root to Resource, find owl:Class in the tree and define the property and a rule for it.
<PastedGraphic-68.png>
Then, you will get the generated autoIncrementID value for every class in your ontology
<PastedGraphic-69.png>
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/26067D09-E4E1-4C22-908D-814BDB0E23D7%40topquadrant.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/FB3F08CF-85E9-49B8-B3A7-5F272C0AE3C7%40topquadrant.com.
When a new instance is created in this other system, how does it know that you already created Animal10254 and gave it autoincrementID == 960?It would seem that when the other system creates a new animal, it could be a different animal from the one you created. Yet, they will both have the same autoincrementID. Further, if you rely on querying this other system for the max autoincrementID, when you create another animal, after creating Animal10254 and you query the other system, it may not have added a new animal yet and it would again return 959 as the last id used.In other words, if you have 2 systems that add new instances and you want them to use a common id counter, you need to have a common component for assigning it. There should be a service you could access that will give you the next available autoincrementID. And this other system should use the same service so that when it creates a new animal, it knows that you already used 960.Provided that such service is available, you need to call it from EDG to get the autoincrementID.
If all instances in the other system are already created and only you are adding new instances, then you could just store the max ID from the other system and can increment from this number.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d968627f-a6cd-4089-b0e4-6c320b423bd6n%40googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/c2d91ae4-299f-4d5b-a3da-2defe076cf83n%40googlegroups.com.
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/mmBWNb72dgc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/BE4706BE-3976-4D1A-8D4E-8882CC4315A2%40topquadrant.com.


On Mar 22, 2021, at 11:29 AM, Maja Kiszka <kiszk...@gmail.com> wrote:
I think a solution that will work 100% for my problem is finding the current highest value for autoincrementID and whenever a new Animal is created just add 1 to it.How would I deploy this in EDG? I do not see where in EGD I can add EDG Edit Rule like David suggested.Thanks,Maja
tor. 18. mar. 2021 kl. 18:16 skrev Irene Polikoff <ir...@topquadrant.com>:
Whatever way you want.
You could, for example, store it at the class level e.g.ex:Animal ex:autoincrementStart 959.With the approach David outlined, you only need this for the first instance you create. After that, you increment from the max number. So, you could also simply create the first instance and manually enter its autocrementID that takes into account offset.Or you could, within David’s approach, include logic that will use this fixed number (either hard coded in the code or stored at the class level) if no instances exist yet or will increment the max available ID if there are instances.As Holger mentioned, another option is to set your URI generation to the counter method. This lets you put in a starting number - counter offset. URI construction rules are available on creation of an asset collection and, if you forget to set it on creation, you can later set it on the Manage tab
<PastedGraphic-71.png>
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAPqMuoo%3Db%2BKH-U65cu11V_Hf9%3DwBkir%3Dp2RYhriH1RqSD5DqZw%40mail.gmail.com.