Auto generate in Datareference sets

8 views
Skip to first unread message

Jan Campschroer

unread,
Apr 15, 2024, 11:11:57 AMApr 15
to TopBraid Suite Users
I've got the following situation:
a reference dataset  RD-Merk
a class ont-merk:Merk with
  1. instances of Merk are elements in RD-Merk
  2. a property ont-merk:ID (integer) (min count = max count =1)
  3. a property M_ID (min count = max count =1)
    1. with the property dash:uriStart "http://data/politie/merk/"
    2. this value is used to create the URI's of the instances of class Merk.
  4. the value of M_ID is based on the value of ID following this pattern:
    1.  1 --> "M00001"
    2. 998 -> "M00998"
Question: If a new Merk is added in RD-Merk, 
  1. the value of ID should be the max of existing ID's in RD-Merk plus 1.
  2. the value of M_ID should be generated 
How to build this in the UI of RD-Merk?
Is this possible using the URI Construction Rules on the Manage Tab?

grz Jan

Holger Knublauch

unread,
Apr 16, 2024, 3:37:10 AMApr 16
to 'Richard Nagelmaeker' via TopBraid Suite Users
Hello Jan,

I believe you can use dash:constructors for this, see https://archive.topquadrant.com/doc/latest/ext/points.html#constructors

Constructors are used whenever someone attempts to create a new instance using the New buttons of a class that declares a constructor. You need to implement the actual logic in JavaScript. (If you are not familiar with that, TQ can help you with professional services).

Keep in mind though that relying on a specific numbering order may be fragile, e.g. if two people are working in parallel on workflows and instances get added without knowing about each other. That's why some customers prefer using UUIDs to create unique identifiers.

Holger


--
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/bf08d766-1805-4f66-a6f4-878fb64051cbn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages