Hello,
Consider the query
insert
$r isa resource, has hex "00t";
This query is correctly validated (and the data not inserted) in the schema
define
hex sub attribute, value string,
regex "^([0-9a-f]{2})+$";
resource sub entity,
owns hex;
However, an analogous query with invalid hex values succeeds in the following schema
define
hex sub attribute, value string, abstract,
regex "^([0-9a-f]{2})+$";
checksum sub hex;
address sub hex;
resource sub entity,
owns checksum,
owns address;
This suggests that regex
constraints defined for abstract attributes are ignored by its subtypes.
- Is this the expected behavior?
- In that case, out of curiosity, could you please roughly elaborate on the reasons for such a decision?
I think that the second model would be useful, e.g., to define a “data type” (such as hex) as a super type of several attributes in a large schema. The alternative seems to be defining the regex for each subtype.
define
hex sub attribute, value string, abstract;
checksum sub hex, regex "^([0-9a-f]{2})+$";
address sub hex, regex "^([0-9a-f]{2})+$";
...
Thanks in advance