You will need to use SHACL SPARQL for this constraint. The pattern of “value of property p1 must exist if property p2 has value X” seems to be generally useful, so defining it declaratively as a new type of constraint component would make sense.
> On Jul 31, 2019, at 5:12 AM, Stefan Verweij <[email protected]> wrote: > > I have a new question regarding the class 'time' in this ontology. I found a > simpler datatype xsd:duration > <http://www.datypic.com/sc/xsd/t-xsd_duration.html> resulting in a single > attribute 'has duration' (sh:datatype xsd:duration ;) with the format > PnYnMnDTnHnMnS. > > In some cases there is no duration and things happen instantly at t=0 (e.g. > in the case of experiments). The datatype xsd:duration forbids t=0 however. > Now I can choose to make the attribute 'has duration' optional by only > setting a max count of 1. However, I would like time to be mandatory to avoid > any ambiguity between a thing, let's say an experiment happening at t=0 > (possible) or an experiment where the scientist simply forgot to mention its > duration (not possible!!!). Therefore I created a boolean attribute 'is > instant'. Now I would like to link this boolean attribute to my attribute > 'has duration' in a way that if 'is instant'=False it leads to the > co-existence of 'has duration', but if 'is instant=True there is no 'has > duration'. I thought of using 'co-existence with', but I can only link this > to a property and not to the value of that property. > > is instant=True --> nothing > is instant=False --> 'has duration'=P5Y > > Or if there is a better way of describing this relationship, please let me > know! > > Stefan > > > Op donderdag 25 juli 2019 15:10:54 UTC+2 schreef Irene Polikoff: > Have you tried adding sh:datatype XSD:integer constraint? Or do you want > values to be strings? > > -- > You received this message because you are subscribed to the Google Groups > "TopBraid Suite Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/topbraid-users/d8992643-d56c-4579-b1e3-ab406af547be%40googlegroups.com > > <https://groups.google.com/d/msgid/topbraid-users/d8992643-d56c-4579-b1e3-ab406af547be%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/90771967-2568-47F2-83FE-204AD02AB1DE%40topquadrant.com.
